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.
Created attachment 18400 [details] Reduced testcase.
(In reply to comment #0) I was able to re-produce and fix the error using the reduced test case but the testcase given in the description - c43205b - does not fail for me anywhere. > > Looks like the new SRA is not fully prepared to handle arrays with > non-constant bounds for its TYPE_DOMAIN. > Right. The following patch will stop SRA from looking at such arrays. After this gets in, can you please add the reduced test case to the test suite? I am not sure where (and exactly how) to put it. Thanks. 2009-09-02 Martin Jambor <mjambor@suse.cz> * tree-sra.c (type_internals_preclude_sra_p): Disqualify array types with non-constant domain bounds. Index: mine/gcc/tree-sra.c =================================================================== --- mine.orig/gcc/tree-sra.c +++ mine/gcc/tree-sra.c @@ -548,6 +548,8 @@ type_internals_preclude_sra_p (tree type return false; case ARRAY_TYPE: + if (TREE_CODE (TYPE_MIN_VALUE (TYPE_DOMAIN (type))) != INTEGER_CST) + return false; et = TREE_TYPE (type); if (AGGREGATE_TYPE_P (et))
Subject: Bug 41112 Author: jamborm Date: Fri Sep 4 11:08:12 2009 New Revision: 151420 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151420 Log: 2009-09-04 Martin Jambor <mjambor@suse.cz> PR tree-optimization/41112 * tree-sra.c (build_ref_for_offset_1): Signal that we cannot handle variable-bounded arrays. (expr_with_var_bounded_array_refs_p): New function. (analyze_access_subtree): Call expr_with_var_bounded_array_refs_p. * testsuite/gnat.dg/array8.adb: New test. Added: trunk/gcc/testsuite/gnat.dg/array8.adb Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-sra.c
So this is hopefully fixed.
*** Bug 41310 has been marked as a duplicate of this bug. ***
Subject: Bug 41112 Author: hjl Date: Thu Sep 10 18:57:46 2009 New Revision: 151611 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=151611 Log: 2009-09-10 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2009-09-10 Richard Guenther <rguenther@suse.de> PR middle-end/41257 * g++.dg/torture/pr41257-2.C: New testcase. 2009-09-08 Alexandre Oliva <aoliva@redhat.com> PR debug/41229 PR debug/41291 PR debug/41300 * gfortran.dg/pr41229.f90: New. 2009-09-08 Alexandre Oliva <aoliva@redhat.com> PR debug/41232 * gcc.dg/pr41232.c: New. 2009-09-07 Martin Jambor <mjambor@suse.cz> PR middle-end/41282 * gcc.c-torture/compile/pr41282.c: New test. 2009-09-06 Jakub Jelinek <jakub@redhat.com> PR bootstrap/41241 * gcc.dg/pr41241.c: New test. 2009-09-06 Richard Guenther <rguenther@suse.de> PR middle-end/41144 * g++.dg/torture/pr41144.C: New testcase. 2009-09-06 Richard Guenther <rguenther@suse.de> PR middle-end/41261 * gcc.dg/torture/pr41261.c: New testcase. 2009-09-05 Richard Guenther <rguenther@suse.de> PR middle-end/41181 * gcc.c-torture/compile/pr41181.c: New testcase. 2009-09-05 Richard Guenther <rguenther@suse.de> PR debug/41273 * g++.dg/torture/pr41273.C: New testcase. 2009-09-04 Alexandre Oliva <aoliva@redhat.com> PR debug/41225 * gfortran.dg/pr41225.f90: New. 2009-09-04 Richard Guenther <rguenther@suse.de> PR middle-end/41257 * g++.dg/torture/pr41257.C: New testcase. 2009-09-04 Martin Jambor <mjambor@suse.cz> PR tree-optimization/41112 * gnat.dg/array8.adb: New test. Added: branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr41144.C - copied unchanged from r151610, trunk/gcc/testsuite/g++.dg/torture/pr41144.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr41257-2.C - copied unchanged from r151609, trunk/gcc/testsuite/g++.dg/torture/pr41257-2.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr41257.C - copied unchanged from r151610, trunk/gcc/testsuite/g++.dg/torture/pr41257.C branches/gcc-4_4-branch/gcc/testsuite/g++.dg/torture/pr41273.C - copied unchanged from r151610, trunk/gcc/testsuite/g++.dg/torture/pr41273.C branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41181.c - copied unchanged from r151610, trunk/gcc/testsuite/gcc.c-torture/compile/pr41181.c branches/gcc-4_4-branch/gcc/testsuite/gcc.c-torture/compile/pr41282.c - copied unchanged from r151609, trunk/gcc/testsuite/gcc.c-torture/compile/pr41282.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41232.c - copied unchanged from r151609, trunk/gcc/testsuite/gcc.dg/pr41232.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/pr41241.c - copied unchanged from r151610, trunk/gcc/testsuite/gcc.dg/pr41241.c branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/torture/pr41261.c - copied unchanged from r151610, trunk/gcc/testsuite/gcc.dg/torture/pr41261.c branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41225.f90 - copied unchanged from r151610, trunk/gcc/testsuite/gfortran.dg/pr41225.f90 branches/gcc-4_4-branch/gcc/testsuite/gfortran.dg/pr41229.f90 - copied unchanged from r151609, trunk/gcc/testsuite/gfortran.dg/pr41229.f90 branches/gcc-4_4-branch/gcc/testsuite/gnat.dg/array8.adb - copied unchanged from r151610, trunk/gcc/testsuite/gnat.dg/array8.adb Modified: branches/gcc-4_4-branch/gcc/testsuite/ChangeLog