aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2010-09-09 15:44:04 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2010-09-09 15:44:04 +0200
commit4fb0b3f0ddf99a0a6eae445efc44fbd16600d504 (patch)
tree5bb42b5c9fd503b30a6ce3e268ee8f709af55414 /gcc
parentffc3bba45ebcd2680b64b060298c5d7e84772629 (diff)
downloadgcc-4fb0b3f0ddf99a0a6eae445efc44fbd16600d504.zip
gcc-4fb0b3f0ddf99a0a6eae445efc44fbd16600d504.tar.gz
gcc-4fb0b3f0ddf99a0a6eae445efc44fbd16600d504.tar.bz2
[multiple changes]
2010-09-09 Ed Schonberg <schonberg@adacore.com> * sem_eval.adb (Is_Same_Value): Two occurrences of the same discriminant cannot be assumed to be the same value because they may refer to bounds of a component of two different instances of a discriminated type. 2010-09-09 Gary Dismukes <dismukes@adacore.com> * checks.adb (Apply_Arithmetic_Overflow_Check): When converting the operands of an operator to the type of an enclosing conversion, rewrite the operator so the conversion can't be flagged as redundant. Remove useless assignments to Typ and Rtyp. 2010-09-09 Eric Botcazou <ebotcazou@adacore.com> * gnat_ugn.texi: Fix another long line. 2010-09-09 Bob Duff <duff@adacore.com> * sem_warn.adb (Output_Reference_Error): Don't warn for renames read but never assigned. From-SVN: r164096
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog23
-rw-r--r--gcc/ada/checks.adb13
-rw-r--r--gcc/ada/gnat_ugn.texi3
-rw-r--r--gcc/ada/sem_eval.adb6
-rw-r--r--gcc/ada/sem_warn.adb6
5 files changed, 44 insertions, 7 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index d1ea672..941603e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,26 @@
+2010-09-09 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_eval.adb (Is_Same_Value): Two occurrences of the same
+ discriminant cannot be assumed to be the same value because they may
+ refer to bounds of a component of two different instances of a
+ discriminated type.
+
+2010-09-09 Gary Dismukes <dismukes@adacore.com>
+
+ * checks.adb (Apply_Arithmetic_Overflow_Check): When converting the
+ operands of an operator to the type of an enclosing conversion, rewrite
+ the operator so the conversion can't be flagged as redundant.
+ Remove useless assignments to Typ and Rtyp.
+
+2010-09-09 Eric Botcazou <ebotcazou@adacore.com>
+
+ * gnat_ugn.texi: Fix another long line.
+
+2010-09-09 Bob Duff <duff@adacore.com>
+
+ * sem_warn.adb (Output_Reference_Error): Don't warn for renames read
+ but never assigned.
+
2010-09-09 Matthew Heaney <heaney@adacore.com>
* a-convec.adb, a-coinve.adb (Clear, Delete, Delete_Last, Finalize,
diff --git a/gcc/ada/checks.adb b/gcc/ada/checks.adb
index 59270e8..793526e 100644
--- a/gcc/ada/checks.adb
+++ b/gcc/ada/checks.adb
@@ -722,8 +722,8 @@ package body Checks is
procedure Apply_Arithmetic_Overflow_Check (N : Node_Id) is
Loc : constant Source_Ptr := Sloc (N);
- Typ : Entity_Id := Etype (N);
- Rtyp : Entity_Id := Root_Type (Typ);
+ Typ : constant Entity_Id := Etype (N);
+ Rtyp : constant Entity_Id := Root_Type (Typ);
begin
-- An interesting special case. If the arithmetic operation appears as
@@ -815,9 +815,14 @@ package body Checks is
Subtype_Mark => New_Occurrence_Of (Target_Type, Loc),
Expression => Relocate_Node (Right_Opnd (N))));
+ -- Rewrite the conversion operand so that the original
+ -- node is retained, in order to avoid the warning for
+ -- redundant conversions in Resolve_Type_Conversion.
+
+ Rewrite (N, Relocate_Node (N));
+
Set_Etype (N, Target_Type);
- Typ := Target_Type;
- Rtyp := Root_Type (Typ);
+
Analyze_And_Resolve (Left_Opnd (N), Target_Type);
Analyze_And_Resolve (Right_Opnd (N), Target_Type);
diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi
index 5221482..6a49f04 100644
--- a/gcc/ada/gnat_ugn.texi
+++ b/gcc/ada/gnat_ugn.texi
@@ -10109,7 +10109,8 @@ the slowest compilation time.
@item ^-O3^/OPTIMIZE=INLINING^
Full optimization as in @option{-O2};
-also uses more aggressive automatic inlining of subprograms within a unit (@pxref{Inlining of Subprograms}) and attemps to vectorize loops.
+also uses more aggressive automatic inlining of subprograms within a unit
+(@pxref{Inlining of Subprograms}) and attemps to vectorize loops.
@item ^-Os^/OPTIMIZE=SPACE^
Optimize space usage (code and data) of resulting program.
diff --git a/gcc/ada/sem_eval.adb b/gcc/ada/sem_eval.adb
index 467fafa..68c9ce8 100644
--- a/gcc/ada/sem_eval.adb
+++ b/gcc/ada/sem_eval.adb
@@ -642,9 +642,15 @@ package body Sem_Eval is
-- types, since we may have two NaN values and they should never
-- compare equal.
+ -- If the entity is a discriminant, the two expressions may be
+ -- bounds of components of objects of the same discriminated
+ -- type. The values of the discriminants are not static, and
+ -- therefore the result is unknown.
+
if Nkind_In (Lf, N_Identifier, N_Expanded_Name)
and then Nkind_In (Rf, N_Identifier, N_Expanded_Name)
and then Entity (Lf) = Entity (Rf)
+ and then Ekind (Entity (Lf)) /= E_Discriminant
and then Present (Entity (Lf))
and then not Is_Floating_Point_Type (Etype (L))
and then not Is_Volatile_Reference (L)
diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb
index fc7e344..953229c 100644
--- a/gcc/ada/sem_warn.adb
+++ b/gcc/ada/sem_warn.adb
@@ -858,9 +858,11 @@ package body Sem_Warn is
procedure Output_Reference_Error (M : String) is
begin
- -- Never issue messages for internal names
+ -- Never issue messages for internal names, nor for renamings
- if Is_Internal_Name (Chars (E1)) then
+ if Is_Internal_Name (Chars (E1))
+ or else Nkind (Parent (E1)) = N_Object_Renaming_Declaration
+ then
return;
end if;