Article View: gnu.gcc.bug
Article #1470gcc 2.2.2 bug re-post (with more info)
From: Alan Walsh
Date: Sun, 22 Nov 1992 06:50
Date: Sun, 22 Nov 1992 06:50
576 lines
18884 bytes
18884 bytes
Sorry about the incomplete first report. It took some checking to find the
manual (not the man pages...)
Machine: HP 9000/720
OS : HP-UX 8.07
Configure: hp9k720-hpux8.07
SOURCE PATCH: I had to make the following mod's to get gcc to run...
>From bothner@cygnus.com Fri Oct 16 15:30 EDT 1992
>Received: from relay1.UU.NET by theory5.chem.pitt.edu with SMTP
> (16.8/16.2) id AA11003; Fri, 16 Oct 92 15:30:58 -0400
>Return-Path: <bothner@cygnus.com>
>Received: from cygnus.com by relay1.UU.NET with SMTP
> (5.61/UUNET-internet-primary) id AB20024; Fri, 16 Oct 92 15:32:29 -0400
>Received: from localhost.cygnus.com by cygnus.com (4.1/SMI-4.1)
> id AA24129; Fri, 16 Oct 92 12:31:24 PDT
>Message-Id: <9210161931.AA24129@cygnus.com>
>To: Alan Walsh <walsh@theory5.chem.pitt.edu>
>Subject: Re: libg++
>In-Reply-To: Your message of "Fri, 16 Oct 92 14:55:57 EDT."
> <9210161858.AA17825@cygnus.com>
>Date: Fri, 16 Oct 92 12:31:23 -0700
>From: bothner@cygnus.com
>Status: RO
>
>Replace the appropriate code in utils/gen-params with the following.
>
> --Per Bothner
>Cygnus Support bothner@cygnus.com
>
>
>#This program is used to test if the compiler prepends '_' before identifiers
># It is also used to check the g++ uses '$' or '.' various places.
>
>if test -z "${NAMES_HAVE_UNDERSCORE}" -o -z "${DOLLAR_IN_LABEL}" ; then
> cat >dummy.C <<!EOF!
> struct filebuf {
> virtual int foo();
> };
> filebuf ff;
> extern "C" int FUNC(int);
> int FUNC(int i) { return i+10; }
>!EOF!
>
> ${CC} -c dummy.C
> if test -n "${NAMES_HAVE_UNDERSCORE}" ; then
> echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE ${NAMES_HAVE_UNDERSCORE}"
> elif test "`${CONFIG_NM} dummy.o | grep _FUNC`" != ""; then
> echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE 1"
> elif test "`${CONFIG_NM} dummy.o | grep FUNC`" != ""; then
> echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE 0"
> else
> echo "${CONFIG_NM} failed to find FUNC in dummy.o!" 1>&2; exit -1;
> fi
>
> if test -n "${DOLLAR_IN_LABEL}" ; then
> echo "#define ${macro_prefix}DOLLAR_IN_LABEL ${DOLLAR_IN_LABEL}"
> elif test "`${CONFIG_NM} dummy.o | grep 'vt[$$]filebuf'`" != ""; then
> echo "#define ${macro_prefix}DOLLAR_IN_LABEL 1"
> elif test "`${CONFIG_NM} dummy.o | grep 'vt[.]filebuf'`" != ""; then
> echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
> else
> echo "${CONFIG_NM} failed to find vt[.\$]filebuf in dummy.o!" 1>&2; exit 1
> fi
>fi
>
command line (for both files): gcc -O[2] -c <file>
files that cause the compiler to crash:
1) The compiler crashes on this file. if the 'exit(0)' command three lines
from the bottom of the program is commented out, the compiler doesn't
crash.
#include <stdio.h>
#include <math.h>
#define L 32
#define LM (L-1)
#define L3 (L*L*L)
#define FTOL 1.0e-2
main()
{
extern void fourn();
int a,b,c,d,e,f,r12;
int nxm,nxp,nym,nyp,nzm,nzp,nxyz;
int np, npl, nmin, it, itave; /* number of poly balls */
int density; /* counter-ion density */
int nimp; /* number of counter ions */
int locpol[3][20]; /* location of poly balls */
int pbp[L],pbm[L]; /* indices for PB cond's */
int nn[3], dim, sign;
double amf,action,feqn,nit;
double sumexp, sumexm, gammap, gammam;
double cp, cm, ep, ef, phiold;
double t1, t2;
double phi[L3],vexc[L3]; /* field, poly-repulsions */
double beta, z;
double pil,il3;
float dphi[L3][2],psq[L3];
double eps,psqcut;
pil = M_PI/L;
il3 = 1.0/L3;
fscanf(stdin,"%d\n",&np);
for (a=0;a<np;a++)
fscanf(stdin,"%d %d %d\n",&locpol[0][a],&locpol[1][a],&locpol[2][a]);
np = 3;
for (a=0;a<L;a++) {
pbp[a] = (a+1)%L;
pbm[a] = (a+LM)%L;
}
fscanf(stdin,"%le %le\n",&beta,&z);
fscanf(stdin,"%d\n",&density);
nimp=density*L3;
/* nimp = 4000; */
fscanf(stdin,"%le %le\n",&eps,&psqcut);
/* initialize needed stuff for fft acceleration */
nn[0] = L;
nn[1] = L;
nn[2] = L;
dim = 3;
for (a=0;a<L;a++)
for (b=0;b<L;b++)
for (c=0;c<L;c++)
if ( a+b+c == 0 ) psq[0] = 1.0;
else psq[a+b*L+c*L*L]= 3.0/
(pow(sin(a*pil),2.0)+pow(sin(b*pil),2.0)+pow(sin(c*pil),2.0)+psqcut);
nit = 0.0; itave = 0;
for (a=0;a<L3;a++) vexc[a] = 0.0;
locpol[0][0] = locpol[1][0] = locpol[2][0] = 0;
locpol[0][1] = locpol[1][1] = locpol[2][1] = 0;
locpol[0][2] = locpol[1][2] = locpol[2][2] = 0;
/* the first two colloids are position along the x axis, and the third is
placed on all the other lattice points in the 1/4th plane nearest the
orign. the configurations with both "extra" colloids along the x axis
are not double counted due to the test that locpol[0][2] > locpol[0][1].
only one "plane" is needed since in principal the sysem has a c_inf
axis along any pair of colloids (3 points determine a plane...)
These configurations represent all the unique 3-body configurations. */
for ( locpol[0][1] = 3; locpol[0][1] < L/2; locpol[0][1]++ )
for ( locpol[1][2] = 0; locpol[1][2] < L/2; locpol[1][2]++ )
for ( locpol[0][2] = 0; locpol[0][2] < L/2; locpol[0][2]++ )
if ( locpol[1][2] || locpol[2][2] || (locpol[0][2] > locpol[0][1]) ) {
for (a=0;a<np;a++)
vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 250.0;
for (a=0;a<L3;a++)
phi[a]=0.0;
/* set (npl,nmin)=(total # + simple ions,total # - simple ions) */
npl=np*z + nimp;
nmin=nimp;
/* intialize gamma, based on DH level phi's: */
sumexp=0.0;
sumexm=0.0;
for (a=0;a<L3;a++) {
sumexm += exp(-phi[a]-vexc[a]);
sumexp += exp(phi[a]-vexc[a]);
}
gammap = npl/sumexp;
gammam = nmin/sumexm;
printf("initial gammap= %e %e %d\n",gammap,sumexp,L3);
printf("initial gammam= %e %e\n",gammam,sumexm);
action=0.0;
for(a=0;a<np;a++)
action -= phi[locpol[0][a]*L*L + locpol[1][a]*L + locpol[2][a]];
action *= z;
for (a=0,nxyz=0;a<L3;a+=L*L) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=0;c<L;c++,nxyz++) {
nzp = pbp[c];
nzm = pbm[c];
action += -0.5*beta*phi[nxyz]*
(phi[nxp+b+c] + phi[a+nyp+c] + phi[a+b+nzp] +
phi[nxm+b+c] + phi[a+nym+c] + phi[a+b+nzm] - 6*phi[nxyz]) +
gammap*exp(phi[nxyz]-vexc[nxyz]) +
gammam*exp(-phi[nxyz]-vexc[nxyz]);
}
}
}
printf("initial action = %le\n",action);
feqn = 2*FTOL;
nit += 1.0;
it = 0;
while ( fabs(feqn) > FTOL ){
it++; itave++;
for (a=f=0,nxyz=0;a<L3;a+=L*L,f++) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=e=0;c<L;c++,nxyz++,e+=L*L) {
nzp = pbp[c];
nzm = pbm[c];
t1 = -beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
+ phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm] - 6*phi[nxyz]);
for (d=0;d<np;d++)
if ( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
t1 -= z;
t1 += gammap*exp(phi[nxyz]-vexc[nxyz]) -
gammam*exp(-phi[nxyz]-vexc[nxyz]);
dphi[f+b+e][0] = eps*t1;
dphi[f+b+e][1] = 0;
}
}
}
sign = 1;
fourn(dphi,nn,&dim,&sign);
/* fourier accelerate */
for (a=0;a<L3;a++) {
dphi[a][0] *= psq[a];
dphi[a][1] *= psq[a];
}
sign = -1;
fourn(dphi,nn,&dim,&sign);
for (nxyz=f=0;f<L;f++)
for (b=0;b<L*L;b+=L)
for (d=0;d<L3;d+=L*L,nxyz++)
phi[nxyz]=phi[nxyz]-il3*dphi[f+b+d][0];
action=0.0;
sumexp=0.0;
sumexm=0.0;
feqn=0.0;
for (a=0,nxyz=0;a<L3;a+=L*L) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=0;c<L;c++,nxyz++) {
nzp = pbp[c];
nzm = pbm[c];
t1 = exp(phi[nxyz]-vexc[nxyz]);
t2 = exp(-phi[nxyz]-vexc[nxyz]);
ep = beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
+ phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]-6*phi[nxyz]);
action -= 0.5*phi[nxyz]*ep;
ef = -ep + gammap*t1 - gammam*t2;
for (d=0;d<np;d++)
if( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
ef -= z;
feqn += ef*ef;
sumexp += t1;
sumexm += t2;
}
}
}
feqn=feqn/L3;
feqn=sqrt(feqn);
action += gammap*sumexp + gammam*sumexm;
for (a=0;a<np;a++)
action -= z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
printf("action=%le accuracy=%le\n",action,feqn);
gammap=npl/sumexp;
gammam=nmin/sumexm;
printf("gammap=%le gammam=%le\n",gammap,gammam);
}
/*
C compute Helmholtz free energy (meanfield)
*/
amf=0.0;
for (a=0;a<L*L*L;a++)
amf += gammap*(0.5*phi[a]-1.0)*exp(phi[a]-vexc[a])
-gammam*(0.5*phi[a]+1.0)*exp(-phi[a]-vexc[a]);
for (a=0;a<np;a++)
amf += 0.5*z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
amf += npl*log(gammap)+nmin*log(gammam);
printf("%d %d %d %d %20.16le\n",locpol[0][1],locpol[0][2],
locpol[1][2],locpol[2][2],amf);
for (a=0;a<np;a++)
vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 0.0;
/* commenting out the next line apparently solves the compile problem... */
exit(0);
}
fprintf(stderr,"%le\n",itave/nit);
}
when this program is compiled, the compiler returns
fft.c: In function `main':
fft.c:220: internal error--insn does not satisfy its constraints:
(insn 4296 4294 719 (set (reg:SI 66)
(mem:SI (reg:SI 1))) 34 {movsi+3} (nil)
(nil))
gcc: Internal compiler error: program cc1 got fatal signal 6
***************************************************************************
2) the second file that causes the compiler to crash is this the following.
when line 65 is uncommented the compiler doesn't crash.
#include <stdio.h>
#include <math.h>
#define L 32
#define LM (L-1)
#define L3 (L*L*L)
#define FTOL 1.0e-2
main()
{
extern double fmin3();
int a,b,c,d,r12;
int nxm,nxp,nym,nyp,nzm,nzp,nxyz;
int np, npl, nmin, it, itave; /* number of poly balls */
int density; /* counter-ion density */
int nimp; /* number of counter ions */
int locpol[3][20]; /* location of poly balls */
int pbp[L],pbm[L]; /* indices for PB cond's */
double amf,action,feqn,nit;
double sumexp, sumexm, gammap, gammam;
double cp, cm, ep, ef, phiold;
double t1, t2, dpavg, dptot;
double phi[L3],vexc[L3]; /* field, poly-repulsions */
double beta, z;
/* double kludge[75][10]; */
/*
size = 10;
cinp(kludge,size);
*/
fscanf(stdin,"%d\n",&np);
/* printf("%d\n",np); */
for (a=0;a<np;a++) {
fscanf(stdin,"%d %d %d\n",&locpol[0][a],&locpol[1][a],&locpol[2][a]);
/* printf("%d %d %d\n",locpol[0][a],locpol[1][a],locpol[2][a]); */
}
np = 3;
for (a=0;a<L;a++) {
pbp[a] = (a+1)%L;
pbm[a] = (a+LM)%L;
}
fscanf(stdin,"%le %le\n",&beta,&z);
/* printf("%le %le\n",beta,z); */
fscanf(stdin,"%d\n",&density);
/* printf("%d\n",density); */
nimp=density*L3;
nit = 0.0; itave = 0;
for (a=0;a<L3;a++) vexc[a] = 0.0;
locpol[0][0] = locpol[1][0] = locpol[2][0] = 0;
locpol[0][1] = locpol[1][1] = locpol[2][1] = 0;
locpol[0][2] = locpol[1][2] = locpol[2][2] = 0;
/* the first two colloids are position along the x axis, and the third is
placed on all the other lattice points in the 1/4th plane nearest the
orign. the configurations with both "extra" colloids along the x axis
are not double counted due to the test that locpol[0][2] > locpol[0][1].
only one "plane" is needed since in principal the sysem has a c_inf
axis along any pair of colloids (3 points determine a plane...)
These configurations represent all the unique 3-body configurations. */
for ( locpol[0][1] = 1; locpol[0][1] < L/2; locpol[0][1]++ )
/* for ( locpol[1][2] = 0; locpol[1][2] < L/2; locpol[1][2]++ ) */
for ( locpol[0][2] = 0; locpol[0][2] < L/2; locpol[0][2]++ )
if ( locpol[1][2] || locpol[2][2] || (locpol[0][2] > locpol[0][1]) ) {
for (a=0;a<np;a++)
vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 250.0;
for (a=0;a<L3;a++)
phi[a]=0.0;
/* set (npl,nmin)=(total # + simple ions,total # - simple ions) */
npl=np*z + nimp;
nmin=nimp;
/* intialize gamma, based on DH level phi's: */
sumexp=0.0;
sumexm=0.0;
for (a=0;a<L3;a++) {
sumexm += exp(-phi[a]-vexc[a]);
sumexp += exp(phi[a]-vexc[a]);
/*
sumexm += exp(-phi[a]);
sumexp += exp(-phi[a]);
if ( exp(-phi[a]) != 1.0 ) printf("phi(%d) %le\n",a,exp(-phi[a]));
*/
}
gammap = npl/sumexp;
gammam = nmin/sumexm;
/* printf("initial gammap= %e %e %d\n",gammap,sumexp,L3); */
/* printf("initial gammam= %e %e\n",gammam,sumexm); */
action=0.0;
for(a=0;a<np;a++)
action -= phi[locpol[0][a],locpol[1][a],locpol[2][a]];
action *= z;
for (a=0,nxyz=0;a<L3;a+=L*L) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=0;c<L;c++,nxyz++) {
nzp = pbp[c];
nzm = pbm[c];
action += -0.5*beta*phi[nxyz]*
(phi[nxp+b+c] + phi[a+nyp+c] + phi[a+b+nzp] +
phi[nxm+b+c] + phi[a+nym+c] + phi[a+b+nzm] - 6*phi[nxyz]) +
gammap*exp(phi[nxyz]-vexc[nxyz]) +
gammam*exp(-phi[nxyz]-vexc[nxyz]);
}
}
}
/* printf("initial action = %le\n",action); */
feqn = 2*FTOL;
nit += 1.0;
it = 0;
while ( fabs(feqn) > FTOL){
it++; itave++;
dptot=0.0;
dpavg=2.0;
for (a=0,nxyz=0;a<L3;a+=L*L) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=0;c<L;c++,nxyz++) {
nzp = pbp[c];
nzm = pbm[c];
t1 = -beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
+ phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]);
for (d=0;d<np;d++)
if ( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
t1 -= z;
if ( vexc[nxyz] < 1.0 ) {
cp = gammap;
cm = gammam;
}
else { cp = cm = 0.0; }
phiold = phi[nxyz];
phi[nxyz] = fmin3(3*beta,t1,cp,cm,phiold);
dptot = fabs(phiold-phi[nxyz])+dptot;
}
}
}
dpavg = dptot/L3;
action=0.0;
sumexp=0.0;
sumexm=0.0;
feqn=0.0;
for (a=0,nxyz=0;a<L3;a+=L*L) {
nxp = pbp[a/(L*L)]*L*L;
nxm = pbm[a/(L*L)]*L*L;
for (b=0;b<L*L;b+=L) {
nyp = pbp[b/L]*L;
nym = pbm[b/L]*L;
for (c=0;c<L;c++,nxyz++) {
nzp = pbp[c];
nzm = pbm[c];
t1 = exp(phi[nxyz]-vexc[nxyz]);
t2 = exp(-phi[nxyz]-vexc[nxyz]);
ep = beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
+ phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]-6*phi[nxyz]);
action -= 0.5*phi[nxyz]*ep;
ef = -ep + gammap*t1 - gammam*t2;
for (d=0;d<np;d++)
if( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
ef -= z;
feqn += ef*ef;
sumexp += t1;
sumexm += t2;
}
}
}
feqn=feqn/L3;
feqn=sqrt(feqn);
action += gammap*sumexp + gammam*sumexm;
for (a=0;a<np;a++)
action -= z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
if ( ! (it % 10) ) {
gammap=npl/sumexp;
gammam=nmin/sumexm;
/*
printf("action=%le accuracy=%le\n gammap=%le gammam=%le\n",
action,feqn,gammap,gammam);
*/
}
}
/*
C compute Helmholtz free energy (meanfield)
*/
amf=0.0;
for (a=0;a<L*L*L;a++)
amf += gammap*(0.5*phi[a]-1.0)*exp(phi[a]-vexc[a])
-gammam*(0.5*phi[a]+1.0)*exp(-phi[a]-vexc[a]);
for (a=0;a<np;a++)
amf += 0.5*z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
amf += npl*log(gammap)+nmin*log(gammam);
printf("%d %d %d %d %20.16le\n",locpol[0][1],locpol[0][2],
locpol[1][2],locpol[2][2],amf);
for (a=0;a<np;a++)
vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 0.0;
}
fprintf(stderr,"%le\n",itave/nit);
/*
write(numout,80) (((phi(nx,ny,nz),nz=0,lm),ny=0,lm),nx=0,lm)
80 format(4d16.9)
do 120 nx=0,lm
write(17,21) 1.*nx,phi(nx,0,0)
if(nx.gt.0) then
write(18,21) 1.*nx,gammap*dexp(phi(nx,0,0))
else
end if
21 format(13f10.5)
120 continue
write(17,21) (lm+1)*1.,phi(0,0,0)
stop
end
*/
}
/*
c uses newton-raphson scheme to find root of
c f(x)=2*a*x + b + cp*exp(x) - cm*exp(-x)
*/
double fmin3(a,b,cp,cm,phiold)
double a,b,cp,cm,phiold;
{
int ic;
double x0, f0, fpr0, xrt, frt;
x0=phiold;
f0=2*a*x0 + b + cp*exp(x0) - cm*exp(-x0);
for (ic=0;ic<20;ic++) {
fpr0= 2*a + cp*exp(x0) + cm*exp(-x0);
/* approximate root: */
xrt=x0 - f0/fpr0;
frt=2*a*xrt + b + cp*exp(xrt) - cm*exp(-xrt);
if( fabs(frt) < 0.01 ) return(xrt);
x0=xrt;
f0=frt;
}
fprintf(stderr,"root not found in fmin3\n");
exit(0);
return(1.0);
}
the message returned by the compiler is:
trio16.c: In function `main':
trio16.c:227: internal error--insn does not satisfy its constraints:
(insn 4669 4667 2073 (set (reg:SI 64)
(mem:SI (reg:SI 13))) 34 {movsi+3} (nil)
(nil))
gcc: Internal compiler error: program cc1 got fatal signal 6
i think this is all the info requested in the manual.
alan
Technical Details
Message-ID:
<9211221652.AA14266@life.ai.mit.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!theory5.chem.pitt.edu!walshShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!theory5.chem.pitt.edu!walsh From: walsh@theory5.chem.pitt.edu (Alan Walsh) Subject: gcc 2.2.2 bug re-post (with more info) Message-ID: <9211221652.AA14266@life.ai.mit.edu> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sun, 22 Nov 1992 06:50:36 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 577