Internal err 274 on dynamic array (Was: tt #1533 - Bug in g++?)
James F. Carter
jimc@math.ucla.edu
Wed Oct 11 15:59:00 GMT 2000
/*bug04.C -- Internal compiler error 274 on dynamic auto array
In obscure circumstances involving a dynamic array where one dimension is
a nontrivial expression (and none of the dimensions are const, not that
it seems to matter), the compiler gets one of two fatal errors: internal
compiler error 274, or signal 11 (segment violation). It fails on Sparc
(sparc-sun-solaris2.5) but not on egcs-2.91.66 19990314/Linux
(i386-slackware-linux). Seemingly trivial changes in the source code make
the error behavior change radically or disappear entirely.
gcc version: 2.95.2 19991024 (release)
System type: sparc-sun-solaris2.5
Command line: g++ bug04.C
Discovered by: "Duane Nykamp" <nykamp@math.ucla.edu>
Submitted by: "James F. Carter" <jimc@math.ucla.edu>
Submitted date: 2000-10-11
Output complained about:
bug04.C: In function `int main()':
bug04.C:50: Internal compiler error 274.
bug04.C:50: Please submit a full bug report.
bug04.C:50: See <URL: http://www.gnu.org/software/gcc/faq.html#bugreport > for instructions.
James F. Carter Voice 310 825 2897 FAX 310 206 6673
UCLA-Mathnet; 6115 MSA; 405 Hilgard Ave.; Los Angeles, CA, USA 90095-1555
Internet: jimc@math.ucla.edu (finger for PGP key)
UUCP:...!{ucsd,ames,ncar,gatech,purdue,rutgers,decvax,uunet}!math.ucla.edu!jimc
*/
extern int write(int, const void*, unsigned int);
int main() {
int fileid /* = creat(...) */;
/* With the following exit() in place, the error message is
Internal compiler error 274.
With exit() removed, the error is
g++: Internal compiler error: program cc1plus got fatal signal 11
Further testing retains exit() in the code. */
if(fileid==-1) exit(1);
int Nn=2;
int Nbins = 4;
double mean_sb[Nn][Nbins];
double cov[Nn][Nn][2*Nbins]; /*With Nbins instead of 2*Nbins wherever
occurring, the error does not appear.*/
/* With both of these statements in place, the error occurs. If either is
commented out, the error hides. */
write(fileid, *mean_sb, Nn*Nbins*sizeof(double));
write(fileid, **cov, Nn*Nn*(2*Nbins)*sizeof(double)); //error reported here
}
More information about the Gcc-bugs
mailing list