Bug 64055 - [5 regression] gnat.dg/derived_aggregate.adb FAILs on 32-bit i386
Summary: [5 regression] gnat.dg/derived_aggregate.adb FAILs on 32-bit i386
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 5.0
: P1 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-24 15:08 UTC by Rainer Orth
Modified: 2015-01-12 10:18 UTC (History)
2 users (show)

See Also:
Host: i?86-*-*
Target: i?86-*-*
Build: i?86-*-*
Known to work:
Known to fail:
Last reconfirmed: 2014-11-24 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rainer Orth 2014-11-24 15:08:43 UTC
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
Comment 1 Richard Biener 2014-11-24 16:07:07 UTC
Confirmed - same on x86_64-linux.
Comment 2 Dominique d'Humieres 2014-11-24 23:06:18 UTC
Revision r217101 is OK.
Comment 3 ro@CeBiTec.Uni-Bielefeld.DE 2014-11-25 12:12:25 UTC
> --- 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
Comment 4 Eric Botcazou 2014-11-28 11:07:21 UTC
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.
Comment 5 Eric Botcazou 2014-11-28 11:07:48 UTC
Recategorizing.
Comment 6 Ilya Enkovich 2014-11-28 15:40:28 UTC
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++)
Comment 7 Eric Botcazou 2014-11-28 17:02:13 UTC
> 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.
Comment 8 Ilya Enkovich 2014-12-01 12:43:37 UTC
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
Comment 9 Richard Biener 2015-01-12 10:18:44 UTC
Fixed.