help: Segmentation fault

Mon, 20 Jan 2003 10:01:09 +0800

In using gmp-4.1.2 in IBM RS6000 AIX 4.2.1, I encountered the following
problem. The same program runs well under Linux in many other PC based

I compiled the program using -g, and run debug. In the following, all the
mpz+AF8-t variables are capitalized and they are global. The line 450 was not
originally part of my program. If this line is deleted, the same problem
occurs. The problem is then in the line 452, the subprogram that went wrong
is then mpz+AF8-add.

+ACQ- dbx ../gsieve
Type 'help' for help.
reading symbolic information ...
(dbx) run
GQS SIEVE 2.0, Extended Interval, Prime +AD0- 3 mod 4, Constant Threshold
process 0
+AEA-start: u+AD0-0+ACI-, s+AD0-0+ACI-
    first run.
+AEA-write gqs.fb: u+AD0-0+ACI-, s+AD0-0+ACI-
+AEA-sieve: u+AD0-0+ACI-, s+AD0-0+ACI-

Segmentation fault in splay at 0xd0002a18
0xd0002a18 (splay+-0x48) 80df000c        lwz   r6,0xc(r31)
(dbx) where
splay(??, ??) at 0xd0002a18
free+AF8-y(??) at 0xd0003eb4
free(??) at 0xd0002280
+AF8AXw-gmp+AF8-default+AF8-free(??, ??), line 137 in +ACI-memory.c+ACI-
+AF8AXw-gmpz+AF8-clear(??), line 29 in +ACI-clear.c+ACI-
tdiv(x +AD0- -18044), line 450 in +ACI-gsieve.c+ACI-
main(argc +AD0- 1, argv +AD0- 0x2ff22c08), line 692 in +ACI-gsieve.c+ACI-
(dbx) l 445
  445   +AH0-
(dbx) l
  446   int tdiv(const int x)
  447   +AHs-
  448           int i,j,k,a,b,q,t+ADs-
  450   mpz+AF8-clear(S)+ADs- mpz+AF8-clear(T)+ADs- mpz+AF8-init(S)+ADs- mpz+AF8-init(T)+ADs-
  451           sn+-+-+ADs-
  452           mpz+AF8-mul+AF8-si(S,D,x)+ADs- mpz+AF8-add(S,S,E)+ADs-
  453           mpz+AF8-mul(T,S,S)+ADs- mpz+AF8-mod(T,T,M)+ADs-
  454           t+AD0-0+ADs- if (mpz+AF8-cmp(T,U)+AD4-0) +AHs-mpz+AF8-sub(T,M,T)+ADs- t+AD0-1+ADsAfQA7-

Anyone has any idea what went wrong?