[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Fri, 10 Sep 2010 13:26:00 +0000 (15:26 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 10 Sep 2010 13:26:00 +0000 (15:26 +0200)
2010-09-10  Ed Schonberg  <schonberg@adacore.com>

* exp_ch6.adb (Make_Build_In_Place_In_Object_Declaration): Use proper
sloc for renaming declaration and set Comes_From_Source properly to
ensure that references are properly generated for an object declaration
that is built in place.

2010-09-10  Tristan Gingold  <gingold@adacore.com>

* symbols-processing-vms-alpha.adb: Allow gnatsym to work as a cross
tool.
* gcc-interface/Make-lang.in: Install gnatsym when cross compiling.
* gcc-interface/Makefile.in: gnat.hlp is now generated by
Make-generated.in

2010-09-10  Bob Duff  <duff@adacore.com>

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): For things like ""X(J)
:= ...;", remove side effects from the right-hand side, because they
might affect the value of the left-hand side, but the left-hand side is
first READ (so we can do shifting and masking) and then written back,
which would cause the side effects to be incorrectly overwritten.

From-SVN: r164171

gcc/ada/ChangeLog
gcc/ada/exp_ch6.adb
gcc/ada/exp_pakd.adb
gcc/ada/gcc-interface/Make-lang.in
gcc/ada/gcc-interface/Makefile.in
gcc/ada/symbols-processing-vms-alpha.adb

index 2143f7d..eb62a9c 100644 (file)
@@ -1,3 +1,26 @@
+2010-09-10  Ed Schonberg  <schonberg@adacore.com>
+
+       * exp_ch6.adb (Make_Build_In_Place_In_Object_Declaration): Use proper
+       sloc for renaming declaration and set Comes_From_Source properly to
+       ensure that references are properly generated for an object declaration
+       that is built in place.
+
+2010-09-10  Tristan Gingold  <gingold@adacore.com>
+
+       * symbols-processing-vms-alpha.adb: Allow gnatsym to work as a cross
+       tool.
+       * gcc-interface/Make-lang.in: Install gnatsym when cross compiling.
+       * gcc-interface/Makefile.in: gnat.hlp is now generated by
+       Make-generated.in
+
+2010-09-10  Bob Duff  <duff@adacore.com>
+
+       * exp_pakd.adb (Expand_Bit_Packed_Element_Set): For things like ""X(J)
+       := ...;", remove side effects from the right-hand side, because they
+       might affect the value of the left-hand side, but the left-hand side is
+       first READ (so we can do shifting and masking) and then written back,
+       which would cause the side effects to be incorrectly overwritten.
+
 2010-09-10  Robert Dewar  <dewar@adacore.com>
 
        * sem_ch4.adb: Minor reformatting.
index eda4aa4..553c8e1 100644 (file)
@@ -5784,6 +5784,7 @@ package body Exp_Ch6 is
            Make_Explicit_Dereference (Loc,
              Prefix => New_Reference_To (Def_Id, Loc));
 
+         Loc := Sloc (Object_Decl);
          Rewrite (Object_Decl,
            Make_Object_Renaming_Declaration (Loc,
              Defining_Identifier => Make_Temporary (Loc, 'D'),
@@ -5821,6 +5822,14 @@ package body Exp_Ch6 is
             Set_Homonym     (Renaming_Def_Id, Homonym (Obj_Def_Id));
 
             Exchange_Entities (Renaming_Def_Id, Obj_Def_Id);
+
+            --  Preserve source indication of original declaration, so that
+            --  xref information is properly generated for the right entity.
+
+            Preserve_Comes_From_Source
+              (Object_Decl, Original_Node (Object_Decl));
+            Set_Comes_From_Source (Obj_Def_Id, True);
+            Set_Comes_From_Source (Renaming_Def_Id, False);
          end;
       end if;
 
index bd8a697..3b1a4cf 100644 (file)
@@ -1340,6 +1340,14 @@ package body Exp_Pakd is
       Ctyp := Component_Type (Atyp);
       Csiz := UI_To_Int (Component_Size (Atyp));
 
+      --  We remove side effects, in case the rhs modifies the lhs, because we
+      --  are about to transform the rhs into an expression that first READS
+      --  the lhs, so we can do the necessary shifting and masking. Example:
+      --  "X(2) := F(...);" where F modifies X(3). Otherwise, the side effect
+      --  will be lost.
+
+      Remove_Side_Effects (Rhs);
+
       --  We convert the right hand side to the proper subtype to ensure
       --  that an appropriate range check is made (since the normal range
       --  check from assignment will be lost in the transformations). This
index dde90d1..787757b 100644 (file)
@@ -841,8 +841,11 @@ ada.install-common:
 #
        -if [ -f gnat1$(exeext) ] ; \
        then \
-         if [ -f gnatsym$(exeext) ] ; \
+         if [ -f gnatsym-cross$(exeext) ] ; \
          then \
+           $(RM) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatsym$(exeext); \
+           $(INSTALL_PROGRAM) gnatsym-cross$(exeext) $(DESTDIR)$(bindir)/$(target_noncanonical)-gnatsym$(exeext); \
+         else \
            $(RM) $(DESTDIR)$(bindir)/gnatsym$(exeext); \
            $(INSTALL_PROGRAM) gnatsym$(exeext) $(DESTDIR)$(bindir)/gnatsym$(exeext); \
          fi ; \
index f478d2c..6eedaa5 100644 (file)
@@ -1572,9 +1572,7 @@ adamsg.o: adamsg.msg
   EXTRA_LIBGNAT_OBJS+=adamsg.o
   EXTRA_GNATRTL_TASKING_OBJS=s-tpopde.o
   EXTRA_GNATTOOLS = \
-     ../../gnatsym$(exeext)  \
-     ../../vms_help$(exeext) \
-     ../../gnat.hlp
+     ../../gnatsym$(exeext)
   # This command transforms (YYYYMMDD) into YY,MMDD
   GSMATCH_VERSION := $(shell grep "^ *Gnat_Static_Version_String" $(fsrcpfx)ada/gnatvsn.ads | sed -e 's/.*(\(.*\)).*/\1/' -e 's/\(..\)\(..\)\(....\).*/\2,\3/')
   TOOLS_LIBS_LO := --for-linker=sys\\$$\$$library:trace.exe
@@ -2795,14 +2793,3 @@ tracebak.o  : tracebak.c tb-alvms.c tb-alvxw.c tb-gcc.c
 .PHONY: risky-stage1 risky-stage2 risky-stage3 risky-stage4
 
 force:
-
-# Vms_help and Gnat.hlp are only used on VMS
-
-../../vms_help$(exeext):
-       $(GNATMAKE) -c $(ADA_INCLUDES) vms_help --GCC="$(CC) $(ALL_ADAFLAGS)"
-       $(GNATBIND) $(ADA_INCLUDES) $(GNATBIND_FLAGS) vms_help
-       $(GNATLINK) -v vms_help -o $@ --GCC="$(GCC_LINK)" $(TOOLS_LIBS)
-
-../../gnat.hlp: ../../vms_help$(exeext)
-       ../../vms_help$(exeext) $(fsrcdir)/ada/gnat.help_in \
-                               $(fsrcdir)/ada/vms_data.ads ../../gnat.hlp
index 4cd92e2..668e473 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2003-2007, Free Software Foundation, Inc.         --
+--          Copyright (C) 2003-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -31,6 +31,9 @@ package body Processing is
    type Number is mod 2**16;
    --  16 bits unsigned number for number of characters
 
+   EMH : constant Number := 8;
+   --  Code for the Module Header section
+
    GSD : constant Number := 10;
    --  Code for the Global Symbol Definition section
 
@@ -45,6 +48,12 @@ package body Processing is
    Number_Of_Characters : Natural := 0;
    --  The number of characters of each section
 
+   Native_Format : Boolean;
+   --  True if records are decoded by the system (like on VMS).
+
+   Has_Pad : Boolean;
+   --  If true, a pad byte must be skipped before reading the next record.
+
    --  The following variables are used by procedure Process when reading an
    --  object file.
 
@@ -114,12 +123,72 @@ package body Processing is
 
       Success := True;
 
+      --  Check the file format in case of cross-tool.
+
+      Get (Code);
+      Get (Number_Of_Characters);
+      Get (Dummy);
+
+      if Code = Dummy and then Number_Of_Characters = Natural (EMH) then
+
+         --  Looks like a cross tools.
+
+         Native_Format := False;
+         Number_Of_Characters := Natural (Dummy) - 4;
+         Has_Pad := (Number_Of_Characters mod 2) = 1;
+
+      elsif Code = EMH then
+
+         Native_Format := True;
+         Number_Of_Characters := Number_Of_Characters - 6;
+         Has_Pad := False;
+
+      else
+
+         Put_Line ("file """ & Object_File & """ is not an object file");
+         Close (File);
+         Success := False;
+         return;
+
+      end if;
+
+      --  Skip the EMH section
+
+      for J in 1 .. Number_Of_Characters loop
+         Read (File, B);
+      end loop;
+
       --  Get the different sections one by one from the object file
 
       while not End_Of_File (File) loop
 
+         if not Native_Format then
+            if Has_Pad then
+               --  Skip pad byte
+
+               Get (B);
+            end if;
+
+            --  Skip record length
+
+            Get (Dummy);
+         end if;
+
          Get (Code);
          Get (Number_Of_Characters);
+
+         if not Native_Format then
+            if Natural (Dummy) /= Number_Of_Characters then
+               --  Format error.
+
+               raise Constraint_Error;
+            end if;
+
+            Has_Pad := (Number_Of_Characters mod 2) = 1;
+         end if;
+
+         --  The header is 4 bytes length
+
          Number_Of_Characters := Number_Of_Characters - 4;
 
          --  If this is not a Global Symbol Definition section, skip to the