summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-10 13:26:00 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2010-09-10 13:26:00 +0000
commit0041731bba894b3555a7029b8adbfccf3a7b60b3 (patch)
tree88c2b781de5c18323dd68c829a7e0615b44d7c9b
parentfe2a1ea0ba56e7444bfab0b6e04ad1eb7e0bcc13 (diff)
downloadgcc-0041731bba894b3555a7029b8adbfccf3a7b60b3.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164171 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog23
-rw-r--r--gcc/ada/exp_ch6.adb9
-rw-r--r--gcc/ada/exp_pakd.adb8
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in5
-rw-r--r--gcc/ada/gcc-interface/Makefile.in15
-rw-r--r--gcc/ada/symbols-processing-vms-alpha.adb71
6 files changed, 115 insertions, 16 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 2143f7df332..eb62a9c2e49 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -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.
diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb
index eda4aa4a7dd..553c8e1b484 100644
--- a/gcc/ada/exp_ch6.adb
+++ b/gcc/ada/exp_ch6.adb
@@ -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;
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index bd8a69771a4..3b1a4cf0973 100644
--- a/gcc/ada/exp_pakd.adb
+++ b/gcc/ada/exp_pakd.adb
@@ -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
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index dde90d1c668..787757b8632 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -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 ; \
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index f478d2c41c8..6eedaa58984 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -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
diff --git a/gcc/ada/symbols-processing-vms-alpha.adb b/gcc/ada/symbols-processing-vms-alpha.adb
index 4cd92e2b332..668e473680b 100644
--- a/gcc/ada/symbols-processing-vms-alpha.adb
+++ b/gcc/ada/symbols-processing-vms-alpha.adb
@@ -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