home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / gnu / gcc / bug / 2821 < prev    next >
Encoding:
Text File  |  1992-11-22  |  17.9 KB  |  590 lines

  1. Newsgroups: gnu.gcc.bug
  2. Path: sparky!uunet!spool.mu.edu!agate!usenet.ins.cwru.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!theory5.chem.pitt.edu!walsh
  3. From: walsh@theory5.chem.pitt.edu (Alan Walsh)
  4. Subject: gcc 2.2.2 bug re-post (with more info)
  5. Message-ID: <9211221652.AA14266@life.ai.mit.edu>
  6. Sender: gnulists@ai.mit.edu
  7. Organization: GNUs Not Usenet
  8. Distribution: gnu
  9. Date: Sun, 22 Nov 1992 06:50:36 GMT
  10. Approved: bug-gcc@prep.ai.mit.edu
  11. Lines: 577
  12.  
  13. Sorry about the incomplete first report.  It took some checking to find the
  14. manual (not the man pages...)
  15.  
  16. Machine: HP 9000/720
  17. OS     : HP-UX 8.07
  18. Configure: hp9k720-hpux8.07
  19. SOURCE PATCH: I had to make the following mod's to get gcc to run...
  20.   >From bothner@cygnus.com Fri Oct 16 15:30 EDT 1992
  21.   >Received: from relay1.UU.NET by theory5.chem.pitt.edu with SMTP
  22.   >    (16.8/16.2) id AA11003; Fri, 16 Oct 92 15:30:58 -0400
  23.   >Return-Path: <bothner@cygnus.com>
  24.   >Received: from cygnus.com by relay1.UU.NET with SMTP 
  25.   >    (5.61/UUNET-internet-primary) id AB20024; Fri, 16 Oct 92 15:32:29 -0400
  26.   >Received: from localhost.cygnus.com by cygnus.com (4.1/SMI-4.1)
  27.   >    id AA24129; Fri, 16 Oct 92 12:31:24 PDT
  28.   >Message-Id: <9210161931.AA24129@cygnus.com>
  29.   >To: Alan Walsh <walsh@theory5.chem.pitt.edu>
  30.   >Subject: Re: libg++ 
  31.   >In-Reply-To: Your message of "Fri, 16 Oct 92 14:55:57 EDT."
  32.   >             <9210161858.AA17825@cygnus.com> 
  33.   >Date: Fri, 16 Oct 92 12:31:23 -0700
  34.   >From: bothner@cygnus.com
  35.   >Status: RO
  36.   >
  37.   >Replace the appropriate code in utils/gen-params with the following.
  38.   >
  39.   >    --Per Bothner
  40.   >Cygnus Support     bothner@cygnus.com
  41.   >
  42.   >
  43.   >#This program is used to test if the compiler prepends '_' before identifiers
  44.   ># It is also used to check the g++ uses '$' or '.' various places.
  45.   >
  46.   >if test -z "${NAMES_HAVE_UNDERSCORE}" -o -z "${DOLLAR_IN_LABEL}" ; then
  47.   >  cat >dummy.C <<!EOF!
  48.   >  struct filebuf {
  49.   >      virtual int foo();
  50.   >  };
  51.   >  filebuf ff;
  52.   >  extern "C" int FUNC(int);
  53.   >  int FUNC(int i) { return i+10; }
  54.   >!EOF!
  55.   >
  56.   >  ${CC} -c dummy.C
  57.   >  if test -n "${NAMES_HAVE_UNDERSCORE}" ; then
  58.   > echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE ${NAMES_HAVE_UNDERSCORE}"
  59.   >  elif test "`${CONFIG_NM} dummy.o | grep _FUNC`" != ""; then
  60.   >    echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE 1"
  61.   >  elif test "`${CONFIG_NM} dummy.o | grep FUNC`" != ""; then
  62.   >    echo "#define ${macro_prefix}NAMES_HAVE_UNDERSCORE 0"
  63.   >  else
  64.   >    echo "${CONFIG_NM} failed to find FUNC in dummy.o!" 1>&2; exit -1;
  65.   >  fi
  66.   >
  67.   >  if test -n "${DOLLAR_IN_LABEL}" ; then
  68.   >    echo "#define ${macro_prefix}DOLLAR_IN_LABEL ${DOLLAR_IN_LABEL}"
  69.   >  elif test "`${CONFIG_NM} dummy.o | grep 'vt[$$]filebuf'`" != ""; then
  70.   >    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 1"
  71.   >  elif test "`${CONFIG_NM} dummy.o | grep 'vt[.]filebuf'`" != ""; then
  72.   >    echo "#define ${macro_prefix}DOLLAR_IN_LABEL 0"
  73.   >  else
  74.   >   echo "${CONFIG_NM} failed to find vt[.\$]filebuf in dummy.o!" 1>&2; exit 1
  75.   >  fi
  76.   >fi
  77.   >
  78.  
  79. command line (for both files): gcc -O[2] -c <file>
  80.  
  81. files that cause the compiler to crash:
  82.  
  83. 1) The compiler crashes on this file.  if the 'exit(0)' command three lines
  84.    from the bottom of the program is commented out, the compiler doesn't
  85.    crash.
  86.  
  87. #include <stdio.h>
  88. #include <math.h>
  89.  
  90. #define L    32
  91. #define LM    (L-1)
  92. #define L3    (L*L*L)
  93. #define FTOL    1.0e-2
  94.  
  95. main()
  96. {
  97.   extern void fourn();
  98.  
  99.   int a,b,c,d,e,f,r12;
  100.   int nxm,nxp,nym,nyp,nzm,nzp,nxyz;
  101.   int np, npl, nmin, it, itave;        /* number of poly balls */
  102.   int density;                /* counter-ion density */
  103.   int nimp;                /* number of counter ions */
  104.   int locpol[3][20];             /* location of poly balls */
  105.   int pbp[L],pbm[L];            /* indices for PB cond's */
  106.   int nn[3], dim, sign;
  107.   double amf,action,feqn,nit;
  108.   double sumexp, sumexm, gammap, gammam;
  109.   double cp, cm, ep, ef, phiold;
  110.   double t1, t2;
  111.   double phi[L3],vexc[L3];         /* field, poly-repulsions */
  112.   double beta, z;
  113.   double pil,il3;
  114.   float dphi[L3][2],psq[L3];
  115.   double eps,psqcut;
  116.  
  117.   pil = M_PI/L;
  118.   il3 = 1.0/L3;
  119.   fscanf(stdin,"%d\n",&np);
  120.   for (a=0;a<np;a++)
  121.     fscanf(stdin,"%d %d %d\n",&locpol[0][a],&locpol[1][a],&locpol[2][a]);
  122.   np = 3;
  123.  
  124.   for (a=0;a<L;a++) {
  125.     pbp[a] = (a+1)%L;
  126.     pbm[a] = (a+LM)%L;
  127.   }
  128.   fscanf(stdin,"%le %le\n",&beta,&z);
  129.   fscanf(stdin,"%d\n",&density);
  130.   nimp=density*L3;
  131.   /* nimp = 4000; */
  132.  
  133.   fscanf(stdin,"%le %le\n",&eps,&psqcut);
  134. /* initialize needed stuff for fft acceleration */
  135.   nn[0] = L;
  136.   nn[1] = L;
  137.   nn[2] = L;
  138.   dim = 3;
  139.   for (a=0;a<L;a++)
  140.     for (b=0;b<L;b++)
  141.       for (c=0;c<L;c++)
  142.     if ( a+b+c == 0 ) psq[0] = 1.0;
  143.     else psq[a+b*L+c*L*L]= 3.0/
  144.       (pow(sin(a*pil),2.0)+pow(sin(b*pil),2.0)+pow(sin(c*pil),2.0)+psqcut);
  145.  
  146.   nit = 0.0; itave = 0;
  147.   for (a=0;a<L3;a++) vexc[a] = 0.0;
  148.   locpol[0][0] = locpol[1][0] = locpol[2][0] = 0;
  149.   locpol[0][1] = locpol[1][1] = locpol[2][1] = 0;
  150.   locpol[0][2] = locpol[1][2] = locpol[2][2] = 0;
  151.  
  152. /* the first two colloids are position along the x axis, and the third is
  153.    placed on all the other lattice points in the 1/4th plane nearest the
  154.    orign.  the configurations with both "extra" colloids along the x axis
  155.    are not double counted due to the test that locpol[0][2] > locpol[0][1].
  156.    only one "plane" is needed since in principal the sysem has a c_inf
  157.    axis along any pair of colloids (3 points determine a plane...)
  158.    These configurations represent all the unique 3-body configurations. */
  159.   for ( locpol[0][1] = 3; locpol[0][1] < L/2; locpol[0][1]++ )
  160.   for ( locpol[1][2] = 0; locpol[1][2] < L/2; locpol[1][2]++ )
  161.   for ( locpol[0][2] = 0; locpol[0][2] < L/2; locpol[0][2]++ )
  162.   if ( locpol[1][2] || locpol[2][2] || (locpol[0][2] > locpol[0][1]) ) {
  163.     for (a=0;a<np;a++)
  164.       vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 250.0;
  165.     for (a=0;a<L3;a++)
  166.       phi[a]=0.0;
  167. /* set (npl,nmin)=(total # + simple ions,total # - simple ions) */
  168.     npl=np*z + nimp;
  169.     nmin=nimp;
  170. /* intialize gamma, based on DH level phi's: */
  171.     sumexp=0.0;
  172.     sumexm=0.0;
  173.     for (a=0;a<L3;a++) {
  174.       sumexm += exp(-phi[a]-vexc[a]);
  175.       sumexp += exp(phi[a]-vexc[a]);
  176.     }
  177.     gammap = npl/sumexp;
  178.     gammam = nmin/sumexm;
  179.     printf("initial gammap= %e %e %d\n",gammap,sumexp,L3);
  180.     printf("initial gammam= %e %e\n",gammam,sumexm);
  181.  
  182.     action=0.0;
  183.     for(a=0;a<np;a++) 
  184.       action -= phi[locpol[0][a]*L*L + locpol[1][a]*L + locpol[2][a]];
  185.     action *= z;
  186.  
  187.     for (a=0,nxyz=0;a<L3;a+=L*L) {
  188.       nxp = pbp[a/(L*L)]*L*L;
  189.       nxm = pbm[a/(L*L)]*L*L;
  190.       for (b=0;b<L*L;b+=L) {
  191.         nyp = pbp[b/L]*L;
  192.         nym = pbm[b/L]*L;
  193.         for (c=0;c<L;c++,nxyz++) {
  194.           nzp = pbp[c];
  195.           nzm = pbm[c];
  196.       action += -0.5*beta*phi[nxyz]*
  197.            (phi[nxp+b+c] + phi[a+nyp+c] + phi[a+b+nzp] +
  198.             phi[nxm+b+c] + phi[a+nym+c] + phi[a+b+nzm] - 6*phi[nxyz]) +
  199.             gammap*exp(phi[nxyz]-vexc[nxyz]) +
  200.             gammam*exp(-phi[nxyz]-vexc[nxyz]);
  201.     }
  202.       }
  203.     }
  204.     printf("initial action = %le\n",action);
  205.  
  206.     feqn = 2*FTOL;
  207.     nit += 1.0;
  208.     it = 0;
  209.     while ( fabs(feqn) > FTOL ){
  210.       it++; itave++;
  211.  
  212.       for (a=f=0,nxyz=0;a<L3;a+=L*L,f++) {
  213.         nxp = pbp[a/(L*L)]*L*L;
  214.         nxm = pbm[a/(L*L)]*L*L;
  215.         for (b=0;b<L*L;b+=L) {
  216.           nyp = pbp[b/L]*L;
  217.           nym = pbm[b/L]*L;
  218.           for (c=e=0;c<L;c++,nxyz++,e+=L*L) {
  219.             nzp = pbp[c];
  220.             nzm = pbm[c];
  221.             t1 = -beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
  222.                  + phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm] - 6*phi[nxyz]);
  223.             for (d=0;d<np;d++)
  224.               if ( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
  225.                 t1 -= z;
  226.             t1 += gammap*exp(phi[nxyz]-vexc[nxyz]) -
  227.                gammam*exp(-phi[nxyz]-vexc[nxyz]);
  228.             dphi[f+b+e][0] = eps*t1;
  229.             dphi[f+b+e][1] = 0;
  230.           }
  231.     }
  232.       }
  233.       sign = 1;
  234.       fourn(dphi,nn,&dim,&sign);
  235. /* fourier accelerate */
  236.       for (a=0;a<L3;a++) {
  237.         dphi[a][0] *= psq[a];
  238.         dphi[a][1] *= psq[a];
  239.       }
  240.       sign = -1;
  241.       fourn(dphi,nn,&dim,&sign);
  242.  
  243.       for (nxyz=f=0;f<L;f++)
  244.         for (b=0;b<L*L;b+=L)
  245.           for (d=0;d<L3;d+=L*L,nxyz++)
  246.             phi[nxyz]=phi[nxyz]-il3*dphi[f+b+d][0];
  247.  
  248.       action=0.0;
  249.       sumexp=0.0;
  250.       sumexm=0.0;
  251.       feqn=0.0;
  252.  
  253.       for (a=0,nxyz=0;a<L3;a+=L*L) {
  254.         nxp = pbp[a/(L*L)]*L*L;
  255.         nxm = pbm[a/(L*L)]*L*L;
  256.         for (b=0;b<L*L;b+=L) {
  257.           nyp = pbp[b/L]*L;
  258.           nym = pbm[b/L]*L;
  259.           for (c=0;c<L;c++,nxyz++) {
  260.             nzp = pbp[c];
  261.             nzm = pbm[c];
  262.         t1 = exp(phi[nxyz]-vexc[nxyz]);
  263.         t2 = exp(-phi[nxyz]-vexc[nxyz]);
  264.             ep = beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
  265.                  + phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]-6*phi[nxyz]);
  266.             action -= 0.5*phi[nxyz]*ep;
  267.             ef = -ep + gammap*t1 - gammam*t2;
  268.             for (d=0;d<np;d++)
  269.               if( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
  270.                 ef -= z;
  271.             feqn += ef*ef;
  272.             sumexp += t1;
  273.             sumexm += t2;
  274.           }
  275.     }
  276.       }
  277.       feqn=feqn/L3;
  278.       feqn=sqrt(feqn);
  279.       action += gammap*sumexp + gammam*sumexm;
  280.       for (a=0;a<np;a++)
  281.         action -= z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
  282.       printf("action=%le accuracy=%le\n",action,feqn);
  283.       gammap=npl/sumexp;
  284.       gammam=nmin/sumexm;
  285.       printf("gammap=%le gammam=%le\n",gammap,gammam);
  286.     }
  287.  
  288. /*
  289. C  compute Helmholtz free energy (meanfield)
  290. */
  291.     amf=0.0;
  292.     for (a=0;a<L*L*L;a++)
  293.       amf += gammap*(0.5*phi[a]-1.0)*exp(phi[a]-vexc[a])
  294.         -gammam*(0.5*phi[a]+1.0)*exp(-phi[a]-vexc[a]);
  295.     for (a=0;a<np;a++)
  296.       amf += 0.5*z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
  297.     amf += npl*log(gammap)+nmin*log(gammam);
  298.     printf("%d %d %d %d %20.16le\n",locpol[0][1],locpol[0][2],
  299.                    locpol[1][2],locpol[2][2],amf);
  300.     for (a=0;a<np;a++)
  301.       vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 0.0;
  302.     /* commenting out the next line apparently solves the compile problem... */
  303.     exit(0);
  304.   }
  305.       fprintf(stderr,"%le\n",itave/nit);
  306. }
  307.  
  308. when this program is compiled, the compiler returns
  309.  
  310. fft.c: In function `main':
  311. fft.c:220: internal error--insn does not satisfy its constraints:
  312. (insn 4296 4294 719 (set (reg:SI 66)
  313.        (mem:SI (reg:SI 1))) 34 {movsi+3} (nil)
  314.    (nil))
  315. gcc: Internal compiler error: program cc1 got fatal signal 6
  316.  
  317. ***************************************************************************
  318.  
  319. 2) the second file that causes the compiler to crash is this the following.
  320.    when line 65 is uncommented the compiler doesn't crash.
  321.  
  322. #include <stdio.h>
  323. #include <math.h>
  324.  
  325. #define L    32
  326. #define LM    (L-1)
  327. #define L3    (L*L*L)
  328. #define FTOL    1.0e-2
  329.  
  330. main()
  331. {
  332.   extern double fmin3();
  333.  
  334.   int a,b,c,d,r12;
  335.   int nxm,nxp,nym,nyp,nzm,nzp,nxyz;
  336.   int np, npl, nmin, it, itave;        /* number of poly balls */
  337.   int density;                /* counter-ion density */
  338.   int nimp;                /* number of counter ions */
  339.   int locpol[3][20];             /* location of poly balls */
  340.   int pbp[L],pbm[L];            /* indices for PB cond's */
  341.   double amf,action,feqn,nit;
  342.   double sumexp, sumexm, gammap, gammam;
  343.   double cp, cm, ep, ef, phiold;
  344.   double t1, t2, dpavg, dptot;
  345.   double phi[L3],vexc[L3];         /* field, poly-repulsions */
  346.   double beta, z;
  347. /* double kludge[75][10]; */
  348.  
  349.  
  350. /*
  351.       size = 10;
  352.       cinp(kludge,size);
  353. */
  354.   fscanf(stdin,"%d\n",&np);
  355.   /* printf("%d\n",np); */
  356.   for (a=0;a<np;a++) {
  357.     fscanf(stdin,"%d %d %d\n",&locpol[0][a],&locpol[1][a],&locpol[2][a]);
  358.     /* printf("%d %d %d\n",locpol[0][a],locpol[1][a],locpol[2][a]); */
  359.   }
  360.   np = 3;
  361.  
  362.   for (a=0;a<L;a++) {
  363.     pbp[a] = (a+1)%L;
  364.     pbm[a] = (a+LM)%L;
  365.   }
  366.   fscanf(stdin,"%le %le\n",&beta,&z);
  367.   /* printf("%le %le\n",beta,z); */
  368.   fscanf(stdin,"%d\n",&density);
  369.   /* printf("%d\n",density); */
  370.   nimp=density*L3;
  371.  
  372.   nit = 0.0; itave = 0;
  373.   for (a=0;a<L3;a++) vexc[a] = 0.0;
  374.   locpol[0][0] = locpol[1][0] = locpol[2][0] = 0;
  375.   locpol[0][1] = locpol[1][1] = locpol[2][1] = 0;
  376.   locpol[0][2] = locpol[1][2] = locpol[2][2] = 0;
  377.  
  378. /* the first two colloids are position along the x axis, and the third is
  379.    placed on all the other lattice points in the 1/4th plane nearest the
  380.    orign.  the configurations with both "extra" colloids along the x axis
  381.    are not double counted due to the test that locpol[0][2] > locpol[0][1].
  382.    only one "plane" is needed since in principal the sysem has a c_inf
  383.    axis along any pair of colloids (3 points determine a plane...)
  384.    These configurations represent all the unique 3-body configurations. */
  385.   for ( locpol[0][1] = 1; locpol[0][1] < L/2; locpol[0][1]++ )
  386.   /* for ( locpol[1][2] = 0; locpol[1][2] < L/2; locpol[1][2]++ ) */
  387.   for ( locpol[0][2] = 0; locpol[0][2] < L/2; locpol[0][2]++ )
  388.   if ( locpol[1][2] || locpol[2][2] || (locpol[0][2] > locpol[0][1]) ) {
  389.     for (a=0;a<np;a++)
  390.       vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 250.0;
  391.     for (a=0;a<L3;a++)
  392.       phi[a]=0.0;
  393. /* set (npl,nmin)=(total # + simple ions,total # - simple ions) */
  394.     npl=np*z + nimp;
  395.     nmin=nimp;
  396. /* intialize gamma, based on DH level phi's: */
  397.     sumexp=0.0;
  398.     sumexm=0.0;
  399.     for (a=0;a<L3;a++) {
  400.       sumexm += exp(-phi[a]-vexc[a]);
  401.       sumexp += exp(phi[a]-vexc[a]);
  402.       /*
  403.       sumexm += exp(-phi[a]);
  404.       sumexp += exp(-phi[a]);
  405.       if ( exp(-phi[a]) != 1.0 ) printf("phi(%d) %le\n",a,exp(-phi[a]));
  406.       */
  407.     }
  408.     gammap = npl/sumexp;
  409.     gammam = nmin/sumexm;
  410.     /* printf("initial gammap= %e %e %d\n",gammap,sumexp,L3); */
  411.     /* printf("initial gammam= %e %e\n",gammam,sumexm); */
  412.  
  413.     action=0.0;
  414.     for(a=0;a<np;a++) 
  415.       action -= phi[locpol[0][a],locpol[1][a],locpol[2][a]];
  416.     action *= z;
  417.  
  418.     for (a=0,nxyz=0;a<L3;a+=L*L) {
  419.       nxp = pbp[a/(L*L)]*L*L;
  420.       nxm = pbm[a/(L*L)]*L*L;
  421.       for (b=0;b<L*L;b+=L) {
  422.         nyp = pbp[b/L]*L;
  423.         nym = pbm[b/L]*L;
  424.         for (c=0;c<L;c++,nxyz++) {
  425.           nzp = pbp[c];
  426.           nzm = pbm[c];
  427.       action += -0.5*beta*phi[nxyz]*
  428.            (phi[nxp+b+c] + phi[a+nyp+c] + phi[a+b+nzp] +
  429.             phi[nxm+b+c] + phi[a+nym+c] + phi[a+b+nzm] - 6*phi[nxyz]) +
  430.             gammap*exp(phi[nxyz]-vexc[nxyz]) +
  431.             gammam*exp(-phi[nxyz]-vexc[nxyz]);
  432.     }
  433.       }
  434.     }
  435.     /* printf("initial action = %le\n",action); */
  436.  
  437.     feqn = 2*FTOL;
  438.     nit += 1.0;
  439.     it = 0;
  440.     while ( fabs(feqn) > FTOL){
  441.       it++; itave++;
  442.       dptot=0.0;
  443.       dpavg=2.0;
  444.  
  445.       for (a=0,nxyz=0;a<L3;a+=L*L) {
  446.         nxp = pbp[a/(L*L)]*L*L;
  447.         nxm = pbm[a/(L*L)]*L*L;
  448.         for (b=0;b<L*L;b+=L) {
  449.           nyp = pbp[b/L]*L;
  450.           nym = pbm[b/L]*L;
  451.           for (c=0;c<L;c++,nxyz++) {
  452.             nzp = pbp[c];
  453.             nzm = pbm[c];
  454.             t1 = -beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
  455.                  + phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]);
  456.             for (d=0;d<np;d++)
  457.               if ( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
  458.                 t1 -= z;
  459.         if ( vexc[nxyz] < 1.0 ) {
  460.               cp = gammap;
  461.               cm = gammam;
  462.         }
  463.         else { cp = cm = 0.0; }
  464.             phiold = phi[nxyz];
  465.             phi[nxyz] = fmin3(3*beta,t1,cp,cm,phiold);
  466.             dptot = fabs(phiold-phi[nxyz])+dptot;
  467.           }
  468.     }
  469.       }
  470.       dpavg = dptot/L3;
  471.  
  472.       action=0.0;
  473.       sumexp=0.0;
  474.       sumexm=0.0;
  475.       feqn=0.0;
  476.  
  477.       for (a=0,nxyz=0;a<L3;a+=L*L) {
  478.         nxp = pbp[a/(L*L)]*L*L;
  479.         nxm = pbm[a/(L*L)]*L*L;
  480.         for (b=0;b<L*L;b+=L) {
  481.           nyp = pbp[b/L]*L;
  482.           nym = pbm[b/L]*L;
  483.           for (c=0;c<L;c++,nxyz++) {
  484.             nzp = pbp[c];
  485.             nzm = pbm[c];
  486.         t1 = exp(phi[nxyz]-vexc[nxyz]);
  487.         t2 = exp(-phi[nxyz]-vexc[nxyz]);
  488.             ep = beta*(phi[nxp+b+c]+phi[a+nyp+c]+phi[a+b+nzp]
  489.                  + phi[nxm+b+c]+phi[a+nym+c]+phi[a+b+nzm]-6*phi[nxyz]);
  490.             action -= 0.5*phi[nxyz]*ep;
  491.             ef = -ep + gammap*t1 - gammam*t2;
  492.             for (d=0;d<np;d++)
  493.               if( nxyz == locpol[0][d]*L*L+locpol[1][d]*L+locpol[2][d] )
  494.                 ef -= z;
  495.             feqn += ef*ef;
  496.             sumexp += t1;
  497.             sumexm += t2;
  498.           }
  499.     }
  500.       }
  501.       feqn=feqn/L3;
  502.       feqn=sqrt(feqn);
  503.       action += gammap*sumexp + gammam*sumexm;
  504.       for (a=0;a<np;a++)
  505.         action -= z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
  506.       if ( ! (it % 10) ) {
  507.         gammap=npl/sumexp;
  508.         gammam=nmin/sumexm;
  509.     /*
  510.     printf("action=%le accuracy=%le\n gammap=%le gammam=%le\n",
  511.          action,feqn,gammap,gammam);
  512.     */
  513.       }
  514.     }
  515.  
  516. /*
  517. C  compute Helmholtz free energy (meanfield)
  518. */
  519.     amf=0.0;
  520.     for (a=0;a<L*L*L;a++)
  521.       amf += gammap*(0.5*phi[a]-1.0)*exp(phi[a]-vexc[a])
  522.         -gammam*(0.5*phi[a]+1.0)*exp(-phi[a]-vexc[a]);
  523.     for (a=0;a<np;a++)
  524.       amf += 0.5*z*phi[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]];
  525.     amf += npl*log(gammap)+nmin*log(gammam);
  526.     printf("%d %d %d %d %20.16le\n",locpol[0][1],locpol[0][2],
  527.                    locpol[1][2],locpol[2][2],amf);
  528.     for (a=0;a<np;a++)
  529.       vexc[locpol[0][a]*L*L+locpol[1][a]*L+locpol[2][a]] = 0.0;
  530.   }
  531.       fprintf(stderr,"%le\n",itave/nit);
  532.       /*
  533.       write(numout,80) (((phi(nx,ny,nz),nz=0,lm),ny=0,lm),nx=0,lm)
  534. 80    format(4d16.9)    
  535.       do 120 nx=0,lm
  536.       write(17,21) 1.*nx,phi(nx,0,0)
  537.       if(nx.gt.0) then
  538.       write(18,21) 1.*nx,gammap*dexp(phi(nx,0,0))
  539.       else
  540.       end if
  541. 21    format(13f10.5)
  542. 120   continue
  543.       write(17,21) (lm+1)*1.,phi(0,0,0)
  544.       stop
  545.       end
  546.       */
  547.  
  548. }
  549.  
  550.  
  551. /*
  552. c uses newton-raphson scheme to find root of
  553. c f(x)=2*a*x + b + cp*exp(x) - cm*exp(-x)
  554. */
  555. double fmin3(a,b,cp,cm,phiold)
  556. double a,b,cp,cm,phiold;
  557. {
  558.   int ic;
  559.   double x0, f0, fpr0, xrt, frt;
  560.  
  561.   x0=phiold;
  562.   f0=2*a*x0 + b + cp*exp(x0) - cm*exp(-x0);
  563.   for (ic=0;ic<20;ic++) {
  564.     fpr0= 2*a + cp*exp(x0) + cm*exp(-x0);
  565.   /* approximate root: */
  566.     xrt=x0 - f0/fpr0;
  567.     frt=2*a*xrt + b + cp*exp(xrt) - cm*exp(-xrt);
  568.     if( fabs(frt) < 0.01 ) return(xrt);
  569.  
  570.     x0=xrt;
  571.     f0=frt;
  572.   }
  573.   fprintf(stderr,"root not found in fmin3\n");
  574.   exit(0);
  575.   return(1.0);
  576. }
  577.  
  578. the message returned by the compiler is:
  579. trio16.c: In function `main':
  580. trio16.c:227: internal error--insn does not satisfy its constraints:
  581. (insn 4669 4667 2073 (set (reg:SI 64)
  582.        (mem:SI (reg:SI 13))) 34 {movsi+3} (nil)
  583.    (nil))
  584. gcc: Internal compiler error: program cc1 got fatal signal 6
  585.  
  586. i think this is all the info requested in the manual.
  587.  
  588. alan
  589.  
  590.