ICE on Alpha with gcc 4.2 20060508: tbm@juist:~/delta/bin$ /usr/lib/gcc-snapshot/bin/gcc -c -O1 mini.c mini.c: In function 'fann_run': mini.c:23: internal compiler error: in expand_simple_unop, at optabs.c:2307 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. tbm@juist:~/delta/bin$ /usr/lib/gcc-snapshot/bin/gcc -c mini.c tbm@juist:~/delta/bin$ gcc-4.0 -c -O2 mini.c tbm@juist:~/delta/bin$ gcc-4.1 -c -O2 mini.c tbm@juist:~/delta/bin$ tbm@juist:~/delta/bin$ cat mini.c typedef double fann_type; typedef struct { } _G_fpos64_t; struct fann_neuron { fann_type value; } __attribute__ ((packed)); struct fann_layer { struct fann_neuron *last_neuron; }; struct fann { struct fann_layer *first_layer; }; fann_run (struct fann *ann, fann_type * input) { struct fann_layer *layer_it, *layer_it2, *last_layer; for (layer_it = ann->first_layer + 1; layer_it != last_layer; layer_it++) { ((layer_it - 1)->last_neuron - 1)->value = 1; } }
Confirmed with 4.2.0 20060606. Cleaned up test case: struct fann_neuron { double value; } __attribute__ ((packed)); void fann_run (struct fann_neuron **last_neuron) { while (1) (*last_neuron)->value = 1; } The same ICE occurs in the ufraw package, test case: void f(double); void SaveNikonDataFile(void) { while (1) { union { double d; unsigned char b[8]; } dat1, dat2; dat1.d = 1; dat2.d = 1; dat2.b[7] = dat1.b[0]; f(dat2.d); } } This one occurs only with -ffast-math.
A regression hunt using an alpha-linux cross compiler on powerpc-linux with the first testcase from comment #1 identified this patch: http://gcc.gnu.org/viewcvs?view=rev&rev=110912 r110912 | rakdver | 2006-02-13 11:21:23 +0000 (Mon, 13 Feb 2006)
Patch: http://gcc.gnu.org/ml/gcc-patches/2006-07/msg01064.html
Subject: Bug 27907 Author: rakdver Date: Wed Jul 26 16:47:28 2006 New Revision: 115760 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=115760 Log: PR rtl-optimization/27907 * expr.c (force_operand): Use convert_move to handle FLOAT_EXTEND and FLOAT_TRUNCATE. * gcc.c-torture/compile/pr27907.c: New test. Added: trunk/gcc/testsuite/gcc.c-torture/compile/pr27907.c Modified: trunk/gcc/ChangeLog trunk/gcc/expr.c trunk/gcc/testsuite/ChangeLog
Fixed.