diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-01-23 10:39:27 +0100 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2012-01-23 10:39:27 +0100 |
commit | 88a27b18dddb3a7fbf98f3f5ee0f3ff5a745d911 (patch) | |
tree | 1eeb3948fb02ea5d492dcba3de5efd26fcd5412b /gcc/ada/exp_ch4.adb | |
parent | 3c24c853da7ea2106fe07213fdf1efd43b86bddf (diff) | |
download | gcc-88a27b18dddb3a7fbf98f3f5ee0f3ff5a745d911.zip gcc-88a27b18dddb3a7fbf98f3f5ee0f3ff5a745d911.tar.gz gcc-88a27b18dddb3a7fbf98f3f5ee0f3ff5a745d911.tar.bz2 |
[multiple changes]
2012-01-23 Hristian Kirtchev <kirtchev@adacore.com>
* sem_ch12.adb (Analyze_Associations): Alphabetize local variables and
constants. Rename Actual_Types to Actuals_To_Freeze. Rename Next_Formal
to Saved_Formal.
Freeze all eligible subprograms which appear as actuals in
the instantiation.
(Has_Fully_Defined_Profile): New routine.
(Renames_Standard_Subprogram): New routine.
(Earlier): Add local variable N. Comment update. Do not use source
locations when trying to determine whether one node precedes another.
2012-01-23 Gary Dismukes <dismukes@adacore.com>
* exp_ch4.adb (Expand_Concatenate): In the case
where the result of a concatentation can be null, set the to
result have both the low and high bounds of the right operand (not
just the high bound, as was the case prior to this fix). Also,
fix the saved high bound setting (Last_Opnd_High_Bound) in the
empty string literal case (should have been low bound minus one,
rather than plus one).
2012-01-23 Thomas Quinot <quinot@adacore.com>
* scos.ads, put_scos.adb, get_scos.adb (Get_SCOs, Put_SCOs): Do not
omit statement SCOs for disabled pragmas.
From-SVN: r183419
Diffstat (limited to 'gcc/ada/exp_ch4.adb')
-rw-r--r-- | gcc/ada/exp_ch4.adb | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb index 8082cb0..b0a65cf 100644 --- a/gcc/ada/exp_ch4.adb +++ b/gcc/ada/exp_ch4.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2011, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2012, 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- -- @@ -2601,6 +2601,12 @@ package body Exp_Ch4 is -- This is either an integer literal node, or an identifier reference to -- a constant entity initialized to the appropriate value. + Last_Opnd_Low_Bound : Node_Id; + -- A tree node representing the low bound of the last operand. This + -- need only be set if the result could be null. It is used for the + -- special case of setting the right low bound for a null result. + -- This is of type Ityp. + Last_Opnd_High_Bound : Node_Id; -- A tree node representing the high bound of the last operand. This -- need only be set if the result could be null. It is used for the @@ -2811,11 +2817,14 @@ package body Exp_Ch4 is Result_May_Be_Null := False; end if; - -- Capture last operand high bound if result could be null + -- Capture last operand low and high bound if result could be null if J = N and then Result_May_Be_Null then + Last_Opnd_Low_Bound := + New_Copy_Tree (String_Literal_Low_Bound (Opnd_Typ)); + Last_Opnd_High_Bound := - Make_Op_Add (Loc, + Make_Op_Subtract (Loc, Left_Opnd => New_Copy_Tree (String_Literal_Low_Bound (Opnd_Typ)), Right_Opnd => Make_Integer_Literal (Loc, 1)); @@ -2871,9 +2880,13 @@ package body Exp_Ch4 is Result_May_Be_Null := False; end if; - -- Capture last operand bound if result could be null + -- Capture last operand bounds if result could be null if J = N and then Result_May_Be_Null then + Last_Opnd_Low_Bound := + Convert_To (Ityp, + Make_Integer_Literal (Loc, Expr_Value (Lo))); + Last_Opnd_High_Bound := Convert_To (Ityp, Make_Integer_Literal (Loc, Expr_Value (Hi))); @@ -2914,7 +2927,16 @@ package body Exp_Ch4 is Duplicate_Subexpr (Opnd, Name_Req => True), Attribute_Name => Name_First); + -- Capture last operand bounds if result could be null + if J = N and Result_May_Be_Null then + Last_Opnd_Low_Bound := + Convert_To (Ityp, + Make_Attribute_Reference (Loc, + Prefix => + Duplicate_Subexpr (Opnd, Name_Req => True), + Attribute_Name => Name_First)); + Last_Opnd_High_Bound := Convert_To (Ityp, Make_Attribute_Reference (Loc, @@ -3124,6 +3146,15 @@ package body Exp_Ch4 is -- bounds if the last operand is super-flat). if Result_May_Be_Null then + Low_Bound := + Make_Conditional_Expression (Loc, + Expressions => New_List ( + Make_Op_Eq (Loc, + Left_Opnd => New_Copy (Aggr_Length (NN)), + Right_Opnd => Make_Artyp_Literal (0)), + Last_Opnd_Low_Bound, + Low_Bound)); + High_Bound := Make_Conditional_Expression (Loc, Expressions => New_List ( |