Happens both on x86 and x86_64, no analysis yet. ,.,. CDD2A02 ACATS 2.5 04-12-03 22:31:47 ---- CDD2A02 Check that the Read, Write, Input, and Output attributes are inherited for untagged derived types. * CDD2A02 Inherited Input and Output are not inverses of each other - 4. **** CDD2A02 FAILED ****************************.
Does this happen at -O0 and -O2?
It fails only at -O2, it pass at -O0 on x86, x86_64 and ia64.
Confirmed as of today on x86.
Investigating.
It's SRA again, but the problem really originates in the FE's type frobbing with VIEW_CONVERT_EXPR and the like. I think we should consider disabling SRA for the Ada compiler until this mess is sorted out.
I confirm the test PASS with -O2 -fno-tree-sra on x86 and x86_64-linux.
Subject: Bug 18819 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
It only fails on mainline now.
Still failing as of 4.1.0 Fri Jun 10 20:07:24 UTC 2005 on x86_64-linux.
Ada is not release-critical.
Investigating again.
Subject: Bug 18819 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
http://gcc.gnu.org/ml/gcc-testresults/2006-01/msg00663.html cdda01 fails on s390-linux on 4.1 with tree-sra disabled. ,.,. CDD2A01 ACATS 2.5 06-01-16 19:32:21 ---- CDD2A01 Check that the Read and Write attributes for a type extension are created from the parent type's attribute (which may be user-defined) and those for the extension components; also check that the default input and output attributes are used for a type extension, even if the parent type's attribute is user-defined. raised CONSTRAINT_ERROR : fdd2a00.adb:29 range check failed FAIL: cdd2a01 ,.,. CDD2A02 ACATS 2.5 06-01-16 19:32:25 ---- CDD2A02 Check that the Read, Write, Input, and Output attributes are inherited for untagged derived types. raised CONSTRAINT_ERROR : fdd2a00.adb:29 range check failed FAIL: cdd2a02
Some additional details about the s390x failure. This is caused by a miscompile of the fdd2a00__write__2 support routine: lg %r4,168(%r15) # 35 *movdi_64/8 [length = 6] lg %r3,160(%r15) # 36 *movdi_64/8 [length = 6] cgr %r4,%r3 # 37 *cmpdi_ccs/1 [length = 4] stg %r2,168(%r15) # 33 *movdi_64/9 [length = 6] Note how insn 35 reads a stack slot that is uninitialized because insn 33 has been scheduled later. This is apparently caused by an alias set issue. The code at the .t97.final_cleanup level reads: A.63 = system__arith_64__add_with_ovflo_check (D.1421, D.1426); R38b = (ada__streams__Tstream_element_offsetB *) &A.63; where the data type of A.63 is system__arith_64__int64. This gets expanded into (insn 32 31 33 3 (set (reg:DI 60) (reg:DI 2 %r2)) -1 (nil) (nil)) (insn 33 32 34 3 (set (mem/c/i:DI (plus:DI (reg/f:DI 39 virtual-stack-vars) (const_int -8 [0xfffffffffffffff8])) [26 A.63+0 S8 A64]) (reg:DI 60)) -1 (nil) (nil)) (insn 34 33 35 3 (parallel [ (set (reg:DI 43 [ R38b ]) (plus:DI (reg/f:DI 39 virtual-stack-vars) (const_int -8 [0xfffffffffffffff8]))) (clobber (reg:CC 33 %cc)) ]) -1 (nil) (nil)) (insn 35 34 36 3 (set (reg:DI 48 [ D.1430 ]) (mem:DI (reg:DI 43 [ R38b ]) [27 S8 A64])) -1 (nil) (nil)) Note alias set 26 in insn 33 vs. alias set 27 in insn 35. Any ideas why this would be the case?
4.2 fails on amd64-linux as of Fri Jan 20 20:40:28 UTC 2006 (revision 110036) http://gcc.gnu.org/ml/gcc-testresults/2006-01/msg01071.html RUN cdd2a02 ,.,. CDD2A02 ACATS 2.5 06-01-23 01:01:16 ---- CDD2A02 Check that the Read, Write, Input, and Output attributes are inherited for untagged derived types. * CDD2A02 Inherited Input and Output are not inverses of each other - 4. **** CDD2A02 FAILED ****************************.
> Any ideas why this would be the case? The types are not supposed to alias each other. The lines in the .dg file are: R8b : fdd2a00__write__A7b__2 := ada__streams__Tstream_element_offsetB?( system__arith_64__add_with_ovflo_check (interfaces__integer_64 ?(stream.last), interfaces__integer_64?( ada__streams__Tstream_element_offsetB(item'length))))'reference; [constraint_error when R8b.all >= R5b.all and then (R5b.all < 1 or else R8b.all > ada__streams__Tstream_element_offsetB(R3b)) "range check failed"] ada/trans.c:3053 case N_Reference: /* Like 'Access as far as we are concerned. */ gnu_result = gnat_to_gnu (Prefix (gnat_node)); gnu_result = build_unary_op (ADDR_EXPR, NULL_TREE, gnu_result); gnu_result_type = get_unpadded_type (Etype (gnat_node)); break; These N_Reference nodes are an endless source of problems because they cause gigi to take the address of objects that are not aliased. We have been working towards eliminating them as much as possible by using renaming instead; this case (check on the result of a function call) is probably the most delicate one. No real solution as of this writing, only a poor workaround: not compiling the support files with -gnato (overflow checks).
> No real solution as of this writing, only a poor workaround: not compiling the > support files with -gnato (overflow checks). Well, I may have spoken too soon. :-) We are calling Remove_Side_Effects on: N_Type_Conversion (Node_Id=1679) (analyzed) Rewritten: original node = N_Op_Add "Oadd" (Node_Id=39499) Parent = N_Range (Node_Id=1681) Sloc = 7611 fdd2a00.adb:6:38 Etype = N_Defining_Identifier "Tstream_element_offsetB" (Entity_Id=2017) Subtype_Mark = N_Identifier "Tstream_element_offsetB" (Node_Id=39497) Expression = N_Function_Call (Node_Id=39496) Conversion_OK = True It turns out that the fix is already present in the front-end, but inhibited: -- If this is a type conversion, leave the type conversion and remove -- the side effects in the expression. This is important in several -- circumstances: for change of representations, and also when this -- is a view conversion to a smaller object, where gigi can end up -- creating its own temporary of the wrong size. -- ??? this transformation is inhibited for elementary types that are -- not involved in a change of representation because it causes -- regressions that are not fully understood yet. elsif Nkind (Exp) = N_Type_Conversion and then (not Is_Elementary_Type (Underlying_Type (Exp_Type)) or else Nkind (Parent (Exp)) = N_Assignment_Statement) then Remove_Side_Effects (Expression (Exp), Name_Req, Variable_Ref); Scope_Suppress := Svg_Suppress; return; However, another possible fix is to make a copy when we know we will not be able to use a renaming. Tentative patch to be attached.
Created attachment 10701 [details] Patch for miscompilation on s390x.
Created attachment 10706 [details] Other patch for miscompilation on s390x.
Comment on attachment 10701 [details] Patch for miscompilation on s390x. Probably too gross.
Subject: Re: [4.1/4.2 Regression] ACATS cdd2a01 cdd2a02 fail at runtime > No real solution as of this writing, only a poor workaround: not compiling the > support files with -gnato (overflow checks). That's not really an option, since these files must be compiled with -gnato (well at least report.adb) for proper operation of some ACATS tests. Arno
> That's not really an option, since these files must be compiled with > -gnato (well at least report.adb) for proper operation of some ACATS tests. Agreed. Can I install the front-end fix on the 4.1 branch then?
Subject: Bug 18819 Author: ebotcazou Date: Wed Jan 25 14:06:59 2006 New Revision: 110213 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=110213 Log: PR ada/18819 * exp_util.adb (Remove_Side_Effects): Lift enclosing type conversion nodes for elementary types in all cases. Modified: branches/gcc-4_1-branch/gcc/ada/ChangeLog branches/gcc-4_1-branch/gcc/ada/exp_util.adb
Should be fixed on 4.1 branch.
Yes, the patch fixes the problem on s390x. Thanks!
Subject: Bug 18819 Author: charlet Date: Wed Feb 15 09:40:13 2006 New Revision: 111069 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=111069 Log: 2006-02-13 Ed Schonberg <schonberg@adacore.com> Javier Miranda <miranda@adacore.com> Eric Botcazou <ebotcazou@adacore.com> * exp_util.ads, exp_util.adb (Find_Prim_Op, Is_Predefined_Primitive_Operation): When searching for the predefined equality operator, verify that operands have the same type. (Is_Predefined_Dispatching_Operation): Remove the code that looks for the last entity in the list of aliased subprograms. This code was wrong in case of renamings. (Set_Renamed_Subprogram): New procedure (Remove_Side_Effects): Replace calls to Etype (Exp) with use of the Exp_Type constant computed when entering this subprogram. (Known_Null): New function (OK_To_Do_Constant_Replacement): New function (Known_Non_Null): Check scope before believing Is_Known_Non_Null flag (Side_Effect_Free): An attribute reference 'Input is not free of side effect, unlike other attributes that are functions. (from code reading). (Remove_Side_Effects): Expressions that involve packed arrays or records are copied at the point of reference, and therefore must be marked as renamings of objects. (Is_Predefined_Dispatching_Operation): Return false if the operation is not a dispatching operation. PR ada/18819 (Remove_Side_Effects): Lift enclosing type conversion nodes for elementary types in all cases. Modified: trunk/gcc/ada/exp_util.adb trunk/gcc/ada/exp_util.ads
Back to the original problem, purely related to SRA.
Richard, it's the only remaining failure in ACATS on most platforms: the bad interaction between SRA and aggregates under certain circumstances. Do you know what amount of work would be required to properly get rid of it?
Subject: Re: [4.2 Regression] ACATS cdd2a02 fail at runtime Richard, it's the only remaining failure in ACATS on most platforms: the bad interaction between SRA and aggregates under certain circumstances. Do you know what amount of work would be required to properly get rid of it? Is this the one with extension records that rename a discriminant? If so, the fix involves the front end materializing fields that don't semantically exist for the purposes of listing all fields in the record.
> Is this the one with extension records that rename a discriminant? If so, > the fix involves the front end materializing fields that don't semantically > exist for the purposes of listing all fields in the record. Yes, that's it. Is a front-end specialist working on that or...?
Subject: Re: [4.2 Regression] ACATS cdd2a02 fail at runtime Yes, that's it. Is a front-end specialist working on that or...? Nope. I spoke to Ed S. about it a while ago and he wasn't too enthusiastic about the idea. Why don't you make a small test case and let's take it from there.
Created attachment 10984 [details] Reduced testcase.
(In reply to comment #32) > Created an attachment (id=10984) [edit] > Reduced testcase. > any news?
> any news? The patch has been written at AdaCore. I'll try to dig it out.
Subject: Bug 18819 Author: ebotcazou Date: Wed Feb 21 22:58:44 2007 New Revision: 122208 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122208 Log: PR ada/18819 * sem_ch3.adb (Create_Constrained_Components): for a subtype of an untagged derived type, add hidden components to keep discriminant layout consistent, when a given discriminant of the derived type constraints several discriminants of the parent type. Added: trunk/gcc/testsuite/gnat.dg/derived_aggregate.adb Modified: trunk/gcc/ada/ChangeLog trunk/gcc/ada/sem_ch3.adb trunk/gcc/testsuite/ChangeLog
Subject: Bug 18819 Author: ebotcazou Date: Wed Feb 21 23:00:01 2007 New Revision: 122209 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=122209 Log: PR ada/18819 * sem_ch3.adb (Create_Constrained_Components): for a subtype of an untagged derived type, add hidden components to keep discriminant layout consistent, when a given discriminant of the derived type constraints several discriminants of the parent type. Added: branches/gcc-4_2-branch/gcc/testsuite/gnat.dg/derived_aggregate.adb Modified: branches/gcc-4_2-branch/gcc/ada/ChangeLog branches/gcc-4_2-branch/gcc/ada/sem_ch3.adb branches/gcc-4_2-branch/gcc/testsuite/ChangeLog
At long last.