summaryrefslogtreecommitdiff
path: root/gcc/ada/sem_attr.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 11:50:29 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2015-10-27 11:50:29 +0000
commite1da2e5d4c6b0c99577c44b705ffe07bcbedfe57 (patch)
tree2f1225e96583feab0f21bc963d590f85e1ce0444 /gcc/ada/sem_attr.adb
parent856311a7d14668cb10706e3e6222a49780b2530a (diff)
downloadgcc-e1da2e5d4c6b0c99577c44b705ffe07bcbedfe57.tar.gz
2015-10-27 Javier Miranda <miranda@adacore.com>
* sem_util.ads, sem_util.adb (Defining_Identifier): Adding a formal to indicate the needed behavior in case of nodes with errors. 2015-10-27 Ed Schonberg <schonberg@adacore.com> * sem_attr.adb (Eval_Attribute): If the prefix of attribute Enum_Rep is an object that is a generated loop variable for an element iterator, no folding is possible. * sem_res.adb (Resolve_Entity_Name): Do not check for a missing initialization in the case of a constant that is an object renaming. * exp_attr.adb (Expand_N_Attribute_Reference, case Enum_Rep): If the prefix is a constant that renames an expression there is nothing to evaluate statically. 2015-10-27 Vincent Celier <celier@adacore.com> * gnatlink.adb: Always delete the response file, even when the invocation of gcc to link failed. 2015-10-27 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch6.adb (Analyze_Subprogram_Body_Helper): Do not inherit the SPARK_Mode from the context if it has been set already. (Build_Subprogram_Declaration): Relocate relevant pragmas from the subprogram body to the generated corresponding spec. Do not copy aspect SPARK_Mode as this leads to circularity in Copy_Separate_Tree. Inherit the attributes that describe pragmas Ghost and SPARK_Mode. (Move_Pragmas): New routine. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229421 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/sem_attr.adb')
-rw-r--r--gcc/ada/sem_attr.adb9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/ada/sem_attr.adb b/gcc/ada/sem_attr.adb
index c7f1bf5ad1e..7112869f4a8 100644
--- a/gcc/ada/sem_attr.adb
+++ b/gcc/ada/sem_attr.adb
@@ -7286,9 +7286,14 @@ package body Sem_Attr is
if Is_Entity_Name (P) then
-- The prefix denotes a constant or an enumeration literal, the
- -- attribute can be folded.
+ -- attribute can be folded. A generated loop variable for an
+ -- iterator is a constant, but cannot be constant-folded.
- if Ekind_In (Entity (P), E_Constant, E_Enumeration_Literal) then
+ if Ekind (Entity (P)) = E_Enumeration_Literal
+ or else
+ (Ekind (Entity (P)) = E_Constant
+ and then Ekind (Scope (Entity (P))) /= E_Loop)
+ then
P_Entity := Etype (P);
-- The prefix denotes an enumeration type. Folding can occur