Various ACATS tests fail when compiled with optimizations, including cxg2006. It looks like the problem comes from Long_Long_Float handling, First LLF comes into play because System.Max_Digits is 18 on x86. A reduced test case follows, it looks like a simple aggregate used to represent long long complex numbers fails to be initialized properly at -O1. Interestingly the failure occurs only when using the standard package, and not when trying to do things by hand (you can try to uncomment GP+CP or the direct Complex type declation and both works fine). I also find the warning about "internal GNAT unit" suspicious, so may be something is simply wrong with some generic handling in the front-end. $ gnatmake -O1 p.adb gcc -c -O1 p.adb p.adb:1:18: warning: "Ada.Numerics.Long_Long_Complex_Types" is an internal GNAT unit p.adb:1:18: warning: use of this unit is non-portable and version-dependent gnatbind -x p.ali gnatlink p.ali [guerby@pc gcc]$ ./p raised PROGRAM_ERROR : p.adb:33 explicit raise [guerby@pc gcc]$ cat p.adb with Ada.Numerics.Long_Long_Complex_Types; use Ada.Numerics.Long_Long_Complex_Types; procedure P is -- generic -- type Real is digits <>; -- package GP is -- type Complex is record -- Re, Im : Real'Base; -- end record; -- end GP; -- package CP is new GP (Long_Long_Float); -- use CP; -- type Complex is record -- Re, Im : Long_Long_Float; -- end record; function My_Argument (X : Complex) return Long_Long_Float is begin if X.Im = 0.0 then return 0.0; else return 1.0; end if; end My_Argument; Z : Complex := (0.0, 0.0); X : Long_Long_Float; procedure Oops is begin raise Program_Error; end Oops; begin X := My_Argument (Z); if X /= 0.0 then Oops; end if; end P;
cxg2007 cxg2008 cxg2018 cxg2019 cxg2020 cxg2021 seems to be related to long_long_float complex types (mis)handling at -O1 too.
Subject: Bug 14988 CVSROOT: /cvs/gcc Module name: gcc Changes by: guerby@gcc.gnu.org 2004-04-17 12:13:54 Modified files: gcc/ada : ChangeLog impunit.adb Log message: 2004-04-17 Laurent GUERBY <laurent@guerby.net> PR ada/14988 (partial) * impunit.adb: Fix typo. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/ChangeLog.diff?cvsroot=gcc&r1=1.481&r2=1.482 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ada/impunit.adb.diff?cvsroot=gcc&r1=1.12&r2=1.13
So did the patch fix the bug or not, or did it just fix the warning?
Just the warning unfortunately. This report should stay open and be keyworded "wrong-code" once confirmed. Priority could be low since the unoticed up to now warning shows that the number of users of this is near zero :).
Trusting Laurent on this one.
The failure is also present at -O1 on the 3.4 branch. For the sake of completeness, the failures on that branch at -O2 with --enable-checking are: FAIL: c34005o FAIL: c34007g FAIL: c41325a FAIL: c43205i FAIL: c43214d FAIL: c87b32a FAIL: cxg2006 FAIL: cxg2007 FAIL: cxg2008 FAIL: cxg2018 FAIL: cxg2019 FAIL: cxg2020 FAIL: cxg2021
This is a middle-end problem and it is responsible for all the cxg20?? failures.
Subject: Bug 14988 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2004-05-02 13:46:24 Modified files: gcc : ChangeLog function.c Log message: PR middle-end/14988 * function.c (assign_stack_local_1): Use BITS_PER_UNIT alignment when passed -2 as 'align'. (put_var_into_stack): Use 'bool' as the type for the three local predicates. Adjust calls to put_reg_into_stack. When passed a CONCAT, instruct put_reg_into_stack to use a consecutive stack slot for the second part. (put_reg_into_stack): Remove 'promoted_mode' parameter, add 'consecutive_p' parameter. Turn the three predicates into 'bool' parameters. Retrieve the register mode from 'reg'. When consecutive_p is true, instruct assign_stack_local_1 to use BITS_PER_UNIT alignment. (put_addressof_into_stack): Use 'bool' as the type for the two local predicates. Adjust call to put_reg_into_stack. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.3551&r2=2.3552 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/function.c.diff?cvsroot=gcc&r1=1.514&r2=1.515
See http://gcc.gnu.org/ml/gcc-patches/2004-04/msg01601.html