Reduced testcase to be attached, compile in the build dir with:

gcc/xgcc -Bgcc -S p.adb -Igcc/ada/rts -O2

+===========================GNAT BUG DETECTED==============================+
| 4.5.0 20090818 (experimental) [trunk revision 150875] (i586-suse-linux-gnu)
GCC error:|
| tree check: expected integer_cst, have var_decl in int_const_binop,      |
|     at fold-const.c:1668                                                 |
| Error detected around p.adb:31:4            


(gdb) bt
#0  internal_error (gmsgid=0xab540b4 "tree check: %s, have %s in %s, at %s:%d")
    at /home/eric/svn/gcc/gcc/diagnostic.c:674
#1  0x0995d788 in tree_check_failed (node=0xf7dd90c0,
    file=0xaa4cd04 "/home/eric/svn/gcc/gcc/fold-const.c", line=1668,
    function=0xaa4d6a3 "int_const_binop") at /home/eric/svn/gcc/gcc/tree.c:7460
#2  0x0894c9ab in int_const_binop (code=PLUS_EXPR, arg1=0xf7dda658,
    arg2=0xf7dd90c0, notrunc=0) at /home/eric/svn/gcc/gcc/fold-const.c:1668
#3  0x0938768e in build_ref_for_offset_1 (res=0xffffcc90, type=0xf7dcdaf0,
    offset=0, exp_type=0xf7dbb9a0) at /home/eric/svn/gcc/gcc/tree-sra.c:1091
#4  0x09387804 in build_ref_for_offset (expr=0xffffcc90, type=0xf7dcdaf0,
    offset=0, exp_type=0xf7dbb9a0, allow_ptr=0 '\0')
    at /home/eric/svn/gcc/gcc/tree-sra.c:1136


(gdb) frame 3
#3  0x0938768e in build_ref_for_offset_1 (res=0xffffcc90, type=0xf7dcdaf0,
    offset=0, exp_type=0xf7dbb9a0) at /home/eric/svn/gcc/gcc/tree-sra.c:1091
1091                    index = int_const_binop (PLUS_EXPR, index,
(gdb) p debug_tree(type)
 <array_type 0xf7dcdaf0 p__proc2GP464__T10b
    type <integer_type 0xf7dbb9a0 integer
        type <integer_type 0xf7d0e310 integer sizes-gimplified public visited
SI
            size <integer_cst 0xf7d01498 constant 32>
            unit size <integer_cst 0xf7d01284 constant 4>
            align 32 symtab 0 alias set 2 canonical type 0xf7d0e310 precision
32 min <integer_cst 0xf7d01444 -2147483648> max <integer_cst 0xf7d01460
2147483647>
            pointer_to_this <pointer_type 0xf7d0ed20>>
        sizes-gimplified public SI size <integer_cst 0xf7d01498 32> unit size
<integer_cst 0xf7d01284 4>
        align 32 symtab 0 alias set 2 canonical type 0xf7dbb9a0 precision 32
min <integer_cst 0xf7d3fb28 -2147483648> max <integer_cst 0xf7dc716c
2147483647> RM size <integer_cst 0xf7d01498 32> RM min <integer_cst 0xf7d01444
-2147483648> RM max <integer_cst 0xf7d01460 2147483647>
        pointer_to_this <pointer_type 0xf7dc9230> chain <type_decl 0xf7dbba10
integer>>
    readonly sizes-gimplified nonaliased-component BLK
    size <integer_cst 0xf7d01690 type <integer_type 0xf7d0e070 bit_size_type>
constant 128>
    unit size <integer_cst 0xf7d016ac type <integer_type 0xf7d0e000 long int>
constant 16>
    align 32 symtab 0 alias set 6 canonical type 0xf7dcdaf0
    domain <integer_type 0xf7dcd850
        type <integer_type 0xf7d0e000 long int sizes-gimplified public visited
sizetype SI size <integer_cst 0xf7d01498 32> unit size <integer_cst 0xf7d01284
4>
            align 32 symtab 0 alias set -1 canonical type 0xf7d0e000 precision
32 min <integer_cst 0xf7d016e4 -2147483648> max <integer_cst 0xf7d01700
2147483647>>
        sizes-gimplified public SI size <integer_cst 0xf7d01498 32> unit size
<integer_cst 0xf7d01284 4>
        align 32 symtab 0 alias set -1 canonical type 0xf7dcd850 precision 32
min <var_decl 0xf7dd90c0 D.2323> max <var_decl 0xf7dd9180 D.2325>
        index type <integer_type 0xf7dcd770 p__proc2GP464__T9b___XD type
<integer_type 0xf7d0e310 integer>
            sizes-gimplified SI size <integer_cst 0xf7d01498 32> unit size
<integer_cst 0xf7d01284 4>
            align 32 symtab 0 alias set 2 canonical type 0xf7dcd770 precision
32 min <integer_cst 0xf7dc75b0 -2147483648> max <integer_cst 0xf7dc78a4
2147483647> RM size <integer_cst 0xf7d01498 32> RM min <nop_expr 0xf7dccd60> RM
max <plus_expr 0xf7dce318>
            chain <type_decl 0xf7dcd7e0 p__proc2GP464__T9b___XD>>
        chain <type_decl 0xf7dcd8c0 D.2234>>
    pointer_to_this <pointer_type 0xf7dd41c0>>


Looks like the new SRA is not fully prepared to handle arrays with non-constant
bounds for its TYPE_DOMAIN.


-- 
           Summary: [4.5 regression] ACATS c43205b fails at -O2 (tree-sra)
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ebotcazou at gcc dot gnu dot org
GCC target triplet: ix86-*-*


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

Reply via email to