aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2015-06-01 07:51:02 +0000
committerEric Botcazou <ebotcazou@adacore.com>2015-06-01 07:51:02 +0000
commit2e30f9d9d78589dcf02734b1e441882e946b1d6a (patch)
tree781e6893e9ed4d48796deb9cfc660c9b2be0a226
parent6a9dba20cadea5d5eb9c59e2c28af184a320f527 (diff)
* gcc-interface/trans.c (lvalue_required_p) <N_Indexed_Component>: Deal
with character and enumeration literals as index values. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@223913 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ada/ChangeLog5
-rw-r--r--gcc/ada/gcc-interface/trans.c13
2 files changed, 13 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index a2887e88b0e..2c2b237608e 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,5 +1,10 @@
2015-06-01 Eric Botcazou <ebotcazou@adacore.com>
+ * gcc-interface/trans.c (lvalue_required_p) <N_Indexed_Component>: Deal
+ with character and enumeration literals as index values.
+
+2015-06-01 Eric Botcazou <ebotcazou@adacore.com>
+
* gcc-interface/gigi.h (build_simple_component_ref): Declare.
* gcc-interface/decl.c (gnat_to_gnu_entity) <E_Variable>: Deal with
address clause on aliased object with unconstrained nominal subtype.
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 0750051b6a0..b561bf015a3 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -858,14 +858,17 @@ lvalue_required_p (Node_Id gnat_node, tree gnu_type, bool constant,
if (Prefix (gnat_parent) != gnat_node)
return 0;
- /* ??? Consider that referencing an indexed component with a
- non-constant index forces the whole aggregate to memory.
- Note that N_Integer_Literal is conservative, any static
- expression in the RM sense could probably be accepted. */
+ /* ??? Consider that referencing an indexed component with a variable
+ index forces the whole aggregate to memory. Note that testing only
+ for literals is conservative, any static expression in the RM sense
+ could probably be accepted with some additional work. */
for (gnat_temp = First (Expressions (gnat_parent));
Present (gnat_temp);
gnat_temp = Next (gnat_temp))
- if (Nkind (gnat_temp) != N_Integer_Literal)
+ if (Nkind (gnat_temp) != N_Character_Literal
+ && Nkind (gnat_temp) != N_Integer_Literal
+ && !(Is_Entity_Name (gnat_temp)
+ && Ekind (Entity (gnat_temp)) == E_Enumeration_Literal))
return 1;
/* ... fall through ... */