The following code produces an ICE with -O1 or -O2

$ cat foo.c
extern char buf1[10];
extern char buf2[10];
extern void b(int i, int j, int w);

void a() {
    int i,j;
    char *p;
    int w;

    p = buf1;
    for(j = 0;j < 10; j++) {
        for(i = 0;i < 10; i++) {
            w = *p;
            if(w != 1) {
                w = buf2[p - buf1];
                b(i*2+1, j, w);
            }
            p++;
        }
    }
}

$ gcc -O1 foo.c
foo.c: In function 'a':
foo.c:5: internal compiler error: in build2_stat, at tree.c:3116
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.3/README.Bugs> for instructions.


-- 
           Summary: internal compiler error: in build2_stat, at tree.c:3116
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: y at momonga-linux dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36245

Reply via email to