This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/17540] New: Duplicate symbols while building Ada


Filed to enable tracking, from "Ada system.fat_lflt.fat_long_float.scaling
problem analysis" discussion on gcc@gcc.gnu.org:

On Mon, 2004-09-13 at 23:24, Richard Kenner wrote:
>     s-fatlfl.o(.bss+0x0): In function `system.fat_lflt.fat_long_float.scaling':
>    
/home/guerby/work/gcc/build/build-20040913T200122/gcc/ada/rts/s-fatgen.adb:540:
multiple definition of `r'
>    
s-fatflt.o(.bss+0x0):/home/guerby/work/gcc/build/build-20040913T200122/gcc/ada/rts/s-fatgen.adb:540:
first defined here
> 
> I'm assuming this is a problem in the Ada front end, though I haven't
> gotten a chance to look at it yet.

I looked at the expanded code for s-fatflt.ads and found the "r":

xa : constant system.system__address := 
           system__fat_flt__fat_float__valid__to_addressGP22755__target!
           (system__fat_flt__fat_float__valid__float_access(x));
r : system__fat_flt__fat_float__valid__float_rep;
        pragma import (ada, r);
        for r'address use xa;
        freeze r []

The following reduced test case shows the problem:

procedure P is
   procedure P1 (X : access Integer) is
      R : Integer;
      pragma Import (Ada, R);
      for R'Address use X.all'Address;
   begin
      null;
   end P1;
   procedure P2 (X : access Integer) is
      R : Integer;
      pragma Import (Ada, R);
      for R'Address use X.all'Address;
   begin
      null;
   end P2;
begin
   null;
end P;

$ /home/guerby/work/gcc/build/build-20040917T192720/gcc/xgcc
-B/home/guerby/work/gcc/build/build-20040917T192720/gcc/ -c p.adb
/tmp/ccK6lePn.s: Assembler messages:
/tmp/ccK6lePn.s:13: Error: symbol `r' is already defined

My guess is that the r symbol is not flagged as local when
there's an address clause and an Import pragma, so it
might be a gigi problem.


Very similar code is present in GNAT sources and is causing the ACATS
failures, see s-fatgen.adb, function Valid:

      XA : constant System.Address := To_Address (Float_Access (X));

      R : Float_Rep;
      pragma Import (Ada, R);
      for R'Address use XA;
      --  R is a view of the input floating-point parameter. Note that we
      --  must avoid copying the actual bits of this parameter in float
      --  form (since it may be a signalling NaN.

Since it's a generic, it might lead to generated code
as I've writen in my example if multiple instanciation
are present. Such a construct has worked for all versions of GNAT, but might depend
on some specific code generation behaviour that is no longer present.

-- 
           Summary: Duplicate symbols while building Ada
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: laurent at guerby dot net
                CC: dewar at gnat dot com,gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]