Bug 27907 - [4.2 regression] ICE in expand_simple_unop, at optabs.c:2307
Summary: [4.2 regression] ICE in expand_simple_unop, at optabs.c:2307
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.2.0
Assignee: Zdenek Dvorak
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, patch
Depends on:
Blocks:
 
Reported: 2006-06-05 23:43 UTC by Martin Michlmayr
Modified: 2006-07-26 17:02 UTC (History)
3 users (show)

See Also:
Host: alpha-linux-gnu
Target: alpha-linux-gnu
Build: alpha-linux-gnu
Known to work:
Known to fail:
Last reconfirmed: 2006-07-23 22:14:31


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Michlmayr 2006-06-05 23:43:05 UTC
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;
    }
}
Comment 1 Falk Hueffner 2006-06-07 08:12:05 UTC
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.
Comment 2 Janis Johnson 2006-06-07 21:52:25 UTC
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)
Comment 3 Zdenek Dvorak 2006-07-25 12:20:03 UTC
Patch:
http://gcc.gnu.org/ml/gcc-patches/2006-07/msg01064.html
Comment 4 Zdenek Dvorak 2006-07-26 16:47:44 UTC
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

Comment 5 Andrew Pinski 2006-07-26 17:02:55 UTC
Fixed.