Bug 18659 - [4.2 Regression] ACATS failures c32001e c64105b c95086b
Summary: [4.2 Regression] ACATS failures c32001e c64105b c95086b
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 4.0.0
: P5 major
Target Milestone: 4.2.0
Assignee: Eric Botcazou
URL:
Keywords: ice-on-valid-code
: 24896 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-11-24 21:36 UTC by Laurent GUERBY
Modified: 2006-02-15 10:07 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-01-25 11:38:04


Attachments
Reduced testcase. (183 bytes, text/plain)
2005-11-24 14:09 UTC, Eric Botcazou
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Laurent GUERBY 2004-11-24 21:36:28 UTC
This happens on x86 but not on x86_64, 6 ACATS test have the following ICE:
+===========================GNAT BUG DETECTED==============================+
| 4.0.0 20041122 (experimental) (i686-pc-linux-gnu) GCC error:             |
| in generate_element_copy, at tree-sra.c:1507                             |
| Error detected at c32001e.adb:253:5                                      |

c32001e
c52011a
c64105b
c95086b
cd2b11a
cd2b11b
Comment 1 Andrew Pinski 2004-11-24 21:39:55 UTC
Confirmed, also fails on ppc-darwin.
Comment 2 Andrew Pinski 2004-11-24 21:44:36 UTC
This might be fixed by:
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg02030.html

But since I have not tried it yet and it looks like the build is broken, I don't know.
Comment 3 Laurent GUERBY 2004-11-24 22:21:47 UTC
These 6 ACATS FAIL appeared between 20041027 13:16:33 CET and 20041107 12:23:42
CET (together with 21 additional ACATS FAIL...).
Comment 4 Laurent GUERBY 2004-12-05 16:27:41 UTC
Also fails the same way for the same tests on ia64-linux.
Comment 5 Laurent GUERBY 2004-12-06 20:12:24 UTC
This test PASS at -O0 on x86, x86_64 and ia64.
Comment 6 Andrew Pinski 2005-01-21 18:48:23 UTC
Removing the target milestone as per <http://gcc.gnu.org/ml/gcc/2005-01/msg01255.html> as this 
is only known to happen in Ada.
Comment 7 Andrew Pinski 2005-02-15 07:12:46 UTC
Reconfirmed, reduced testcase from c32001e:
PROCEDURE C32001E IS
BEGIN
     DECLARE
          PACKAGE PKG1 IS
               TYPE PACC IS PRIVATE;
               FUNCTION INIT5 (I : INTEGER) RETURN PACC;
               PROCEDURE CHECK5 (V : PACC; S : STRING);
          PRIVATE
               TYPE VECTOR IS ARRAY (NATURAL RANGE <>) OF INTEGER;
               TYPE PACC IS ACCESS VECTOR;
          END PKG1;
          PACKAGE BODY PKG1 IS
               FUNCTION INIT5 (I : INTEGER) RETURN PACC IS
                    ACCV : PACC := NEW VECTOR'(1 .. 0 => 0);
               BEGIN
                    RETURN ACCV;
               END INIT5;
               PROCEDURE CHECK5 (V : PACC; S : STRING) IS
               BEGIN
                    NULL;
               END CHECK5;
          END PKG1;
       USE PKG1;
       V1, V2   : PACC  := INIT5 (9);
     BEGIN
          NULL;          
     END;
END C32001E;


This still looks like a front-end bug because any slight removal of code it will not ICE.
Comment 8 Eric Botcazou 2005-02-18 12:31:03 UTC
SRA is an Ada killer because of the the abuse of VIEW_CONVERT_EXPRs by the Ada
front-end.  I think it should be disabled in the Ada compiler for 4.0.x.
Comment 9 charlet@adacore.com 2005-02-18 12:58:11 UTC
Subject: Re:  [4.0 Regression] ACATS ICE in bug in tree-sra.c:1507 on x86 and ppc-darwin (6 FAIL)

> SRA is an Ada killer because of the the abuse of VIEW_CONVERT_EXPRs by the Ada
> front-end.  I think it should be disabled in the Ada compiler for 4.0.x.

Sounds reasonable to me.

Arno
Comment 10 Eric Botcazou 2005-02-18 19:20:43 UTC
> > SRA is an Ada killer because of the the abuse of VIEW_CONVERT_EXPRs by the Ada
> > front-end.  I think it should be disabled in the Ada compiler for 4.0.x.
> 
> Sounds reasonable to me.

OK, I'll submit a patch once 4.0.x is branched.  As of today, excluding the
problematic cxa3004 and cxb3006, as well as cxa4006 and cxa4017 for which I've
submitted a fix, we have 6 failures at -O2 -fno-tree-sra.
Comment 11 Laurent GUERBY 2005-02-19 18:28:59 UTC
I confirm all six ACATS tests PASS with -O2 -fno-tree-sra on x86-linux.
Comment 12 Laurent GUERBY 2005-04-05 21:23:48 UTC
Fails on sparc-linux as well.

Any resolution on this now that the release is near? With PR18819 these are the
cause of the x86 ACATS regressions (3.4 was ACATS failure free on x86).
Comment 13 CVS Commits 2005-04-07 06:51:44 UTC
Subject: Bug 18659

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	ebotcazou@gcc.gnu.org	2005-04-07 06:51:30

Modified files:
	gcc            : ChangeLog 
	gcc/doc        : invoke.texi 
	gcc/ada        : ChangeLog misc.c 

Log message:
	PR ada/18659
	PR ada/18819
	ada/
	* misc.c (tree_sra_requested): New global.
	(gnat_init_options): Detect -ftree-sra.
	(gnat_post_options): Enable Tree-SRA only if specifically requested.
	gcc/
	* doc/invoke.texi (Optimize Options): Document that
	-ftree-sra is not automatically enabled for the Ada compiler.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.144&r2=2.7592.2.145
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/invoke.texi.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.583.2.9&r2=1.583.2.10
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.638.4.10&r2=1.638.4.11
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/misc.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.96.6.1&r2=1.96.6.2

Comment 14 Eric Botcazou 2005-04-07 06:56:11 UTC
It only fails on mainline now.
Comment 15 Laurent GUERBY 2005-06-18 18:16:23 UTC
Still present on x86-linux as of 
LAST_UPDATED: Sat Jun 18 09:02:59 UTC 2005
Comment 16 Laurent GUERBY 2005-07-07 11:02:59 UTC
Between:

LAST_UPDATED: Sat Jul  2 09:40:45 UTC 2005
LAST_UPDATED: Wed Jul  6 23:57:55 UTC 2005

c52011a	cd2b11a	cd2b11b started passing instead of ICEing.

c32001e c64105b c95086b are still ICEing in generate_element_copy, at
tree-sra.c:1574     
Comment 17 Mark Mitchell 2005-08-22 02:23:28 UTC
Ada is not release-critical.
Comment 18 Eric Botcazou 2005-11-16 17:53:19 UTC
*** Bug 24896 has been marked as a duplicate of this bug. ***
Comment 19 Eric Botcazou 2005-11-22 10:44:43 UTC
Investigating.
Comment 20 Eric Botcazou 2005-11-24 14:09:30 UTC
Created attachment 10332 [details]
Reduced testcase.

Compile at -O on x86.
Comment 21 Eric Botcazou 2005-12-15 13:29:29 UTC
Subject: Bug 18659

Author: ebotcazou
Date: Thu Dec 15 13:29:14 2005
New Revision: 108576

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=108576
Log:
2005-12-15  Eric Botcazou  <ebotcazou@adacore.com>

	PR ada/18659
	PR ada/18819
ada/
	* misc.c (tree_sra_requested): New global.
	(gnat_init_options): Detect -ftree-sra.
	(gnat_post_options): Enable Tree-SRA only if specifically requested.

gcc/
	* doc/invoke.texi (Optimize Options): Document that
	-ftree-sra is not automatically enabled for the Ada compiler.


Modified:
    branches/gcc-4_1-branch/gcc/ChangeLog
    branches/gcc-4_1-branch/gcc/ada/ChangeLog
    branches/gcc-4_1-branch/gcc/ada/misc.c
    branches/gcc-4_1-branch/gcc/doc/invoke.texi

Comment 22 Laurent GUERBY 2006-01-12 21:29:12 UTC
On mainline as of 20060111, the three ACATS ICE are present when cross compiling from x86-linux to sparc-rtems4.7.
Comment 23 Eric Botcazou 2006-01-25 11:38:04 UTC
Working on it again.
Comment 24 Arnaud Charlet 2006-02-15 09:31:54 UTC
Subject: Bug 18659

Author: charlet
Date: Wed Feb 15 09:31:40 2006
New Revision: 111030

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111030
Log:
2006-02-13  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
	    Olivier Hainque  <hainque@adacore.com>
	    Eric Botcazou  <ebotcazou@adacore.com>

	* ada-tree.h: (TYPE_UNCHECKED_UNION_P): Deleted.
	
	* gigi.h (value_factor_p): Add prototype and description, now public.

	* decl.c (gnat_to_gnu_field): Don't attempt BLKmode to integral type
	promotion for field with rep clause if the associated size was proven
	to be in error.
	Expand comments describing attempts to use a packable type.
	(gnat_to_gnu_entity) <E_Signed_Integer_Subtype,
	E_Floating_Point_Subtype>: Inherit alias set of what we are making a
	subtype of to ensure conflicts amongst all subtypes in a hierarchy,
	necessary since these are not different types and pointers may
	actually designate any subtype in this hierarchy.
	(gnat_to_gnu_entity, case E_Record_Type): Always make fields for
	discriminants but put them into record only if not Unchecked_Union;
	pass flag to components_to_record showing Unchecked_Union.
	(make_dummy_type): Use UNION_TYPE only if Unchecked_Union and no
	components before variants; don't set TYPE_UNCHECKED_UNION_P.
	(components_to_record): New argument UNCHECKED_UNION.
	Remove special case code for Unchecked_Union and instead use main code
	with small changes.

	PR ada/26096
	(gnat_to_gnu_entity) <E_Variable>: Do not initialize the
	aligning variable with the expression being built, only its inner
	field.

	* trans.c (Handled_Sequence_Of_Statements_to_gnu): Remove call to
	emit_sequence_entry_statements.
	(emit_sequence_entry_statements, body_with_handlers_p): Delete.
	(establish_gnat_vms_condition_handler): Move before
	Subprogram_Body_to_gnu.
	(Subprogram_Body_to_gnu): On VMS, establish_gnat_vms_condition_handler
	for a subprogram if it has a foreign convention or is exported.
	(Identifier_to_gnu): Manually unshare the DECL_INITIAL tree when it is
	substituted for a CONST_DECL.
	(tree_transform, case N_Aggregate): Remove code for UNION_TYPE and pass
	Etype to assoc_to_constructor.
	(assoc_to_constructor): New argument, GNAT_ENTITY; use it to ignore
	discriminants of Unchecked_Union.
	(TARGET_ABI_OPEN_VMS): Define to 0 if not defined, so that later uses
	don't need cluttering preprocessor directives.
	(establish_gnat_vms_condition_handler): New function. Establish the GNAT
	condition handler as current in the compiled function.
	(body_with_handlers_p): New function. Tell whether a given sequence of
	statements node is attached to a package or subprogram body and involves
	exception handlers possibly nested within inner block statements.
	(emit_sequence_entry_statements): New function, to emit special
	statements on entry of sequences when necessary. Establish GNAT
	condition handler in the proper cases for VMS.
	(Handled_Sequence_Of_Statements_to_gnu): Start block code with
	emit_sequence_entry_statements.

	* utils2.c (find_common_type): If both input types are BLKmode and
	have a constant size, use the smaller one.
	(build_simple_component_ref): Also match if FIELD and NEW_FIELD are
	the same.

	* utils.c (value_factor_p): Make public, to allow uses from other gigi
	units.
	(create_type_decl): Do not set the flag DECL_IGNORED_P for dummy types.
	(convert, case UNION_TYPE): Remove special treatment for unchecked
	unions.

	PR ada/18659
	(update_pointer_to): Update variants of pointer types to
	unconstrained arrays by attaching the list of fields of the main
	variant.


Modified:
    trunk/gcc/ada/ada-tree.h
    trunk/gcc/ada/decl.c
    trunk/gcc/ada/gigi.h
    trunk/gcc/ada/trans.c
    trunk/gcc/ada/utils.c
    trunk/gcc/ada/utils2.c

Comment 25 Eric Botcazou 2006-02-15 10:07:29 UTC
The fix is almost miraculous. :-)