Changeset 1112b76 in git


Ignore:
Timestamp:
Jun 22, 2010, 12:41:01 PM (13 years ago)
Author:
Oleksandr Motsak <motsak@…>
Branches:
(u'jengelh-datetime', 'ceac47cbc86fe4a15902392bdbb9bd2ae0ea02c6')(u'spielwiese', 'a800fe4b3e9d37a38c5a10cc0ae9dfa0c15a4ee6')
Children:
d61b83a9e2debd2805137931b5341399516d2a63
Parents:
d4531110717a559c771df1b82982574879ac0fc5
git-author:
Oleksandr Motsak <motsak@mathematik.uni-kl.de>2010-06-22 12:41:01+02:00
git-committer:
Mohamed Barakat <mohamed.barakat@rwth-aachen.de>2011-11-09 11:55:16+01:00
Message:
Bug in rmodulon.cc: nrnSetExp expects some previous initialization but ignores the given parameter
Location:
coeffs
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • coeffs/numbers.cc

    rd45311 r1112b76  
    88*/
    99
    10 #include <string.h>
    11 #include <stdlib.h>
     10#include "config.h"
     11#include <auxiliary.h>
     12
     13
     14
    1215#include "coeffs.h"
    13 #include "reporter.h"
    14 #include "omalloc.h"
     16
     17#include "numbers.h"
     18
     19#include <reporter.h>
     20#include <omalloc.h>
    1521#include "numbers.h"
    1622#include "longrat.h"
     
    2228#include "longtrans.h"
    2329#ifdef HAVE_RINGS
    24 #include <kernel/rmodulo2m.h>
    25 #include <kernel/rmodulon.h>
    26 #include <kernel/rintegers.h>
    27 
    28 extern omBin gmp_nrz_bin;
    29 #endif
    30 
    31 #ifndef assume
    32 #  define assume(a) if(!(a)){ Werror( "Assumption: is wrong: %s\n", #a ); };
    33 #endif
     30#include <rmodulo2m.h>
     31#include <rmodulon.h>
     32#include <rintegers.h>
     33#endif
     34#include <string.h>
     35#include <stdlib.h>
     36
    3437
    3538
     
    111114{
    112115  n_Procs_s *n=cf_root;
    113   while((n!=NULL) && (!n->nCoeffIsEqual(n,t,parameter)))
     116
     117  while((n!=NULL) && (n->nCoeffIsEqual!=NULL) && (!n->nCoeffIsEqual(n,t,parameter)))
    114118      n=n->next;
     119
    115120  if (n==NULL)
    116121  {
     
    135140    n->cfGcd  = ndGcd;
    136141    n->cfLcm  = ndGcd; /* tricky, isn't it ?*/
     142
    137143#ifdef HAVE_RINGS
    138144    n->cfDivComp = ndDivComp;
     
    189195     else
    190196       Werror("coeff init missing for %d",(int)t);
     197   
    191198    // post init settings:
    192199    if (n->cfRePart==NULL) n->cfRePart=n->cfCopy;
    193200    if (n->cfIntDiv==NULL) n->cfIntDiv=n->cfDiv;
     201   
    194202#ifdef HAVE_RINGS
    195203   if (n->cfGetUnit==NULL) n->cfGetUnit=n->cfCopy;
    196204#endif
     205   
    197206#ifndef NDEBUG
    198207   assume(n->nCoeffIsEqual!=NULL);
     
    239248   assume(n->cfInpMult!=NULL);
    240249   assume(n->cfInit_bigint!=NULL);
    241    #ifdef LDEBUG
     250#ifdef LDEBUG
    242251   assume(n->cfDBTest!=NULL);
    243    #endif
     252#endif
    244253   assume(n->type==t);
    245254#endif
  • coeffs/rmodulo2m.cc

    rd45311 r1112b76  
    2929
    3030/* for initializing function pointers */
    31 void nr2mInitChar (coeffs r, void*)
    32 {
    33      nr2mInitExp(r->ch, r);
     31void nr2mInitChar (coeffs r, void* p)
     32{
     33 
     34  nr2mInitExp((int)(long)(p), r);
     35
    3436     r->cfInit       = nr2mInit;
    3537     r->cfCopy       = ndCopy;
     
    613615 */
    614616
    615 void nr2mSetExp(int m, const coeffs r)
     617void nr2mSetExp(int m, coeffs r)
    616618{
    617619  if (m > 1)
     
    630632}
    631633
    632 void nr2mInitExp(int m, const coeffs r)
     634void nr2mInitExp(int m, coeffs r)
    633635{
    634636  nr2mSetExp(m, r);
  • coeffs/rmodulon.cc

    rd45311 r1112b76  
    3030
    3131/* for initializing function pointers */
    32 void nrnInitChar (coeffs r, void*)
    33 {
    34      nrnInitExp(r->ch, r);
     32void nrnInitChar (coeffs r, void* p)
     33{
     34 
     35  nrnInitExp((int)(long)(p), r);
     36 
    3537     r->cfInit       = nrnInit;
    3638     r->cfDelete     = nrnDelete;
     
    534536 */
    535537
    536 void nrnSetExp(int m, const coeffs r)
     538void nrnSetExp(int m, coeffs r)
    537539{
    538540  if ((r->nrnModul != NULL) && (mpz_cmp(r->nrnModul, r->ringflaga) == 0) && (nrnExponent == r->ringflagb)) return;
     
    546548    mpz_init(nrnMinusOne);
    547549  }
     550  // BUG:  r->ringflaga is undefined!
    548551  mpz_set(r->nrnModul, r->ringflaga);
    549552  mpz_pow_ui(r->nrnModul, r->nrnModul, nrnExponent);
     
    551554}
    552555
    553 void nrnInitExp(int m, const coeffs r)
     556void nrnInitExp(int m, coeffs r)
    554557{
    555558  nrnSetExp(m, r);
    556559
    557   if (mpz_cmp_ui(r->nrnModul,2) <= 0)
     560  if (mpz_cmp_ui(r->nrnModul, 2) <= 0) // ???
    558561  {
    559562    WarnS("nrnInitExp failed");
    560563  }
     564 
     565  r->ch = m; // ???
    561566}
    562567
  • coeffs/test.cc

    rd45311 r1112b76  
    22
    33#include <auxiliary.h>
     4
    45#include <coeffs.h>
    56#include <numbers.h>
     
    3940
    4041
    41 bool Test(const n_coeffType type)
     42bool Test(const n_coeffType type, void* p = NULL)
    4243{
    4344
     
    4546                "]: -----------------------" << endl;
    4647
    47   const coeffs r = nInitChar( type, NULL );
     48  const coeffs r = nInitChar( type, p );
    4849
    4950  assume( r != NULL );
     
    143144#ifdef HAVE_RINGS
    144145  type = nRegister( n_Z2m, nr2mInitChar); assume( type == n_Z2m );
    145   if( Test(type) )
     146  if( Test(type, (void*) 2) )
    146147    c ++;
    147148#endif
     
    150151#ifdef HAVE_RINGS
    151152  type = nRegister( n_Zn, nrnInitChar); assume( type == n_Zn );
    152   if( Test(type) )
     153  if( Test(type, (void*) 3) )
    153154    c ++;
    154155/* BUG:
     
    158159#0  0x00007ffff7b91f1b in __gmpz_set () from /usr/lib/libgmp.so.10
    159160#1  0x00000000004177a5 in nrnSetExp (m=0, r=0x7ffff7f44ae8) at rmodulon.cc:549
     161
    160162#2  0x0000000000417814 in nrnInitExp (m=0, r=0x7ffff7f44ae8) at rmodulon.cc:556
     163
    161164#3  0x0000000000416122 in nrnInitChar (r=0x7ffff7f44ae8) at rmodulon.cc:34
    162165#4  0x0000000000413278 in nInitChar (t=n_Zn, parameter=0x0) at numbers.cc:146
Note: See TracChangeset for help on using the changeset viewer.