Between 20141031 (r216981) and 20141106 (r217189), the gnat.dg/derived_aggregate.adb test started to FAIL on 32-bit x86 targets (Solaris/x86, Darwin/x86, Linux/x86): FAIL: gnat.dg/derived_aggregate.adb (test for excess errors) Excess errors: +===========================GNAT BUG DETECTED==============================+ | 5.0.0 20141121 (experimental) [trunk revision 217915] (i386-pc-solaris2.11) GCC error:| | tree check: expected integer_cst, have nop_expr in | | chkp_find_bound_slots_1, at tree-chkp.c:1571 | | Error detected around /vol/gcc/src/hg/trunk/local/gcc/testsuite/gnat.dg/derived_aggregate.adb:19:8| | Please submit a bug report; see http://gcc.gnu.org/bugs.html. | | Use a subject line meaningful to you and us to track the bug. | | Include the entire contents of this bug box in the report. | | Include the exact command that you entered. | | Also include sources listed below. | +==========================================================================+ Please include these source files with error report Note that list may not be accurate in some cases, so please double check that the problem can still be reproduced with the set of files listed. Consider also -gnatd.n switch (see debug.adb). /var/gcc/regression/trunk/11-gcc/build/i386-pc-solaris2.11/./libada/adainclude/system.ads /vol/gcc/src/hg/trunk/local/gcc/testsuite/gnat.dg/derived_aggregate.adb raised TYPES.UNRECOVERABLE_ERROR : comperr.adb:423 WARNING: gnat.dg/derived_aggregate.adb compilation failed to produce executable Rainer
Confirmed - same on x86_64-linux.
Revision r217101 is OK.
> --- Comment #2 from Dominique d'Humieres <dominiq at lps dot ens.fr> --- > Revision r217101 is OK. Not in my case: at r217915, the test FAILs for the 32-bit multilib of both the i386-apple-darwin14.0.0 and x86_64-apple-darwin14.0.0 configurations. Same for i686-unknown-linux-gnu and x86_64-unknown-linux-gnu and i386-pc-solaris2.1[01] and amd64-pc-solaris2.1[01]. Also (only checked i386-pc-solaris2.11) at r216981 and r217189. Rainer
ix86_function_arg_advance calls chkp_type_bounds_count which dies on an array type with variable bounds so the immediate workaround is: Index: tree-chkp.c =================================================================== --- tree-chkp.c (revision 218133) +++ tree-chkp.c (working copy) @@ -1565,7 +1565,9 @@ chkp_find_bound_slots_1 (const_tree type HOST_WIDE_INT esize = TREE_INT_CST_LOW (TYPE_SIZE (etype)); unsigned HOST_WIDE_INT cur; - if (!maxval || integer_minus_onep (maxval)) + if (!maxval + || integer_minus_onep (maxval) + || CONTAINS_PLACEHOLDER_P (maxval)) return; for (cur = 0; cur <= TREE_INT_CST_LOW (maxval); cur++) but a specialist needs to have a look here.
Recategorizing.
TREE_INT_CST_LOW (maxval) assumes integer constant anyway. Therefore we may use simpler check. It fixes gnat.dg/derived_aggregate.adb. diff --git a/gcc/tree-chkp.c b/gcc/tree-chkp.c index 0fb78cc..84886da 100644 --- a/gcc/tree-chkp.c +++ b/gcc/tree-chkp.c @@ -1568,7 +1568,9 @@ chkp_find_bound_slots_1 (const_tree type, bitmap have_bound, HOST_WIDE_INT esize = TREE_INT_CST_LOW (TYPE_SIZE (etype)); unsigned HOST_WIDE_INT cur; - if (!maxval || integer_minus_onep (maxval)) + if (!maxval + || TREE_CODE (maxval) != INTEGER_CST + || integer_minus_onep (maxval)) return; for (cur = 0; cur <= TREE_INT_CST_LOW (maxval); cur++)
> TREE_INT_CST_LOW (maxval) assumes integer constant anyway. Therefore we may > use simpler check. It fixes gnat.dg/derived_aggregate.adb. FWIW fine with me.
Author: ienkovich Date: Mon Dec 1 12:43:04 2014 New Revision: 218207 URL: https://gcc.gnu.org/viewcvs?rev=218207&root=gcc&view=rev Log: PR target/64055 * tree-chkp.c (chkp_find_bound_slots_1): Allow non constant values in array domain. Modified: trunk/gcc/ChangeLog trunk/gcc/tree-chkp.c
Fixed.