From: Eric Botcazou Date: Mon, 1 Jun 2015 07:51:02 +0000 (+0000) Subject: trans.c (lvalue_required_p): Deal with character and enumeration literals as index... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=ed98eed866d587f64cb43967de50adc107597cc5;p=gcc.git trans.c (lvalue_required_p): Deal with character and enumeration literals as index values. * gcc-interface/trans.c (lvalue_required_p) : Deal with character and enumeration literals as index values. From-SVN: r223913 --- diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index a2887e88b0e..2c2b237608e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,8 @@ +2015-06-01 Eric Botcazou + + * gcc-interface/trans.c (lvalue_required_p) : Deal + with character and enumeration literals as index values. + 2015-06-01 Eric Botcazou * gcc-interface/gigi.h (build_simple_component_ref): Declare. 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 ... */