aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/exp_pakd.adb
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-09-10 15:26:00 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-09-10 15:26:00 +0200
commitf00c5f52285d2203317335960666a4f9a929444b (patch)
tree88c2b781de5c18323dd68c829a7e0615b44d7c9b /gcc/ada/exp_pakd.adb
parent199c6a1000df6695a1e4c7c041882db928b51221 (diff)
downloadgcc-f00c5f52285d2203317335960666a4f9a929444b.zip
gcc-f00c5f52285d2203317335960666a4f9a929444b.tar.gz
gcc-f00c5f52285d2203317335960666a4f9a929444b.tar.bz2
[multiple changes]
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
Diffstat (limited to 'gcc/ada/exp_pakd.adb')
-rw-r--r--gcc/ada/exp_pakd.adb8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb
index bd8a697..3b1a4cf 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