[Bug ada/14988] New: Analysis of ACATS cxg2006 failures at -O1

laurent at guerby dot net gcc-bugzilla@gcc.gnu.org
Fri Apr 16 22:33:00 GMT 2004


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;

-- 
           Summary: Analysis of ACATS cxg2006 failures at -O1
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: laurent at guerby dot net
                CC: gcc-bugs at gcc dot gnu dot org,laurent at guerby dot
                    net
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14988



More information about the Gcc-bugs mailing list