diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-26 07:39:39 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2008-03-26 07:39:39 +0000 |
commit | 92f75e58a6a19db73d6f2676dede2806db71e39d (patch) | |
tree | 49b583aa825aa02482631f1ef26b0030641c041b /gcc | |
parent | 70966f505556a8c259831256d2cfbc0f15d9b9c3 (diff) | |
download | gcc-92f75e58a6a19db73d6f2676dede2806db71e39d.tar.gz |
2008-03-26 Ed Schonberg <schonberg@adacore.com>
* exp_pakd.adb (Expand_Bit_Packed_Element_Set): If the component
assignment is within the initialization procedure for a packed array,
and Initialize_Scalars is enabled, compile right-hand side with checks
off, because the value is purposely out of range.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@133566 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/exp_pakd.adb | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/gcc/ada/exp_pakd.adb b/gcc/ada/exp_pakd.adb index f3ead191c96..68feec5aa3f 100644 --- a/gcc/ada/exp_pakd.adb +++ b/gcc/ada/exp_pakd.adb @@ -33,6 +33,7 @@ with Layout; use Layout; with Namet; use Namet; with Nlists; use Nlists; with Nmake; use Nmake; +with Opt; use Opt; with Rtsfind; use Rtsfind; with Sem; use Sem; with Sem_Ch3; use Sem_Ch3; @@ -1359,7 +1360,19 @@ package body Exp_Pakd is Rhs := Convert_To (Ctyp, Rhs); Set_Parent (Rhs, N); - Analyze_And_Resolve (Rhs, Ctyp); + + -- If we are building the initialization procedure for a packed array, + -- and Initialize_Scalars is enabled, each component assignment is an + -- out-of-range value by design. Compile this value without checks, + -- because a call to the array init_proc must not raise an exception. + + if Within_Init_Proc + and then Initialize_Scalars + then + Analyze_And_Resolve (Rhs, Ctyp, Suppress => All_Checks); + else + Analyze_And_Resolve (Rhs, Ctyp); + end if; -- Case of component size 1,2,4 or any component size for the modular -- case. These are the cases for which we can inline the code. |