[Bug ada/24992] New: gcc aborts compiling record whose component definition refers to 'Size of current type
procedure Main is type Bar(E : Integer) is null record; type CurrentType(D : Integer) is record Field : Bar(CurrentType'Size); -- not sure if this is valid but the compiler shouldn't crash end record; begin null; end Main; command line is gcc -c main.adb gcc 4.0.0 says +===GNAT BUG DETECTED==+ | 4.0.0 (i686-pc-linux-gnu) in Attribute_to_gnu, at ada/trans.c:741| | Error detected at main.adb:5:22 | | Please submit a bug report; see http://gcc.gnu.org/bugs.html.| | Include the entire contents of this bug box in the report. | | Include the exact gcc or gnatmake command that you entered. | | Also include sources listed below in gnatchop format | | (concatenated together with no headers between files). | +==+ Both gcc 2.8.1 and gcc 4.0.0 aborts. The second line of the 2.8.1 box says | 3.15p (20020523) (i686-pc-linux-gnu) Gigi abort, Code=401 | gcc 4.0.0 was built from 4.0.0 source (last change log entry 2005-04-20) with default settings and c,c++,objc,ada enabled. -- Summary: gcc aborts compiling record whose component definition refers to 'Size of current type Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: ada AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stephaniechc-gccbug at yahoo dot com GCC host triplet: Linux 2.4.21-4-686-smp #1 SMP i686 GNU/Linux GCC target triplet: Linux 2.4.21-4-686-smp #1 SMP i686 GNU/Linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24992
[Bug c/31691] New: optimized code taking the wrong branch
The following example takes the "wrong_branch" when compiled with gcc -O3 -fno-inline gcc --version gcc (GCC) 4.1.2 Copyright (C) 2006 Free Software Foundation, Inc. = example = #include static int get_kind(int v) { volatile int k = v; return k; } static int some_call(void) { return 0; } static void wrong_branch(void) { printf("wrong_branch\n"); } static int example(int arg) { int kind; kind = get_kind(arg); if (kind == 9 || kind == 10 || kind == 5) { if (some_call() == 0) { int tmp; //kind = get_kind(arg); // ok if this call is inserted if (kind == 9 || kind == 10) { tmp = arg; } else { wrong_branch(); } /* if */ return 0; } } return 0; } int main(void) { int v = 10; example(v); return 0; } === The example prints "wrong_branch" when executed. If the second call to get_kind is uncommented, nothing is printed (which is correct). The generated assembly code is = example.s == example: save%sp, -112, %sp callget_kind, 0 mov%i0, %o0 add %o0, -9, %g1 subcc %g0, %g1, %g0 subx%g0, -1, %i0 cmp %g1, 1 bleu.LL11 cmp%o0, 5 be .LL11 nop .LL9: jmp %i7+8 restore %g0, 0, %o0 .LL11: callsome_call, 0 nop cmp %o0, 0 bne .LL9 cmp%i0, 0 bne .LL9 nop callwrong_branch, 0 mov0, %i0 jmp %i7+8 restore === -- Summary: optimized code taking the wrong branch Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: stephaniechc-gccbug at yahoo dot com GCC build triplet: sparc-sun-solaris2.8 GCC host triplet: sparc-sun-solaris2.8+ GCC target triplet: sparc-sun-solaris2.8+ http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31691
[Bug middle-end/31691] [4.1 regression] optimized code taking the wrong branch
--- Comment #4 from stephaniechc-gccbug at yahoo dot com 2007-04-25 14:26 --- Created an attachment (id=13438) --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=13438&action=view) output of -fdump-tree-optimized -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31691