aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils2.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2014-01-25 10:51:47 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2014-01-25 10:51:47 +0000
commit88293f0384de09f14bdbb55afa363cc72006f9b2 (patch)
tree9af0986644e6850485cbac6372243960c42ad5af /gcc/ada/gcc-interface/utils2.c
parentae56e44284592b1e8cca35f870e0240e65e141c5 (diff)
downloadgcc-88293f0384de09f14bdbb55afa363cc72006f9b2.zip
gcc-88293f0384de09f14bdbb55afa363cc72006f9b2.tar.gz
gcc-88293f0384de09f14bdbb55afa363cc72006f9b2.tar.bz2
utils.c (convert_to_fat_pointer): Un-obfuscate the conversion from a thin pointer with a shifted value.
* gcc-interface/utils.c (convert_to_fat_pointer): Un-obfuscate the conversion from a thin pointer with a shifted value. * gcc-interface/utils2.c (gnat_build_constructor): Propagate the read-only flag from the values onto the result. (gnat_invariant_expr): Accept read-only CONSTRUCTORs. From-SVN: r207073
Diffstat (limited to 'gcc/ada/gcc-interface/utils2.c')
-rw-r--r--gcc/ada/gcc-interface/utils2.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index 224a87d..e716bdc 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -6,7 +6,7 @@
* *
* C Implementation File *
* *
- * Copyright (C) 1992-2013, Free Software Foundation, Inc. *
+ * Copyright (C) 1992-2014, 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- *
@@ -1850,6 +1850,7 @@ tree
gnat_build_constructor (tree type, vec<constructor_elt, va_gc> *v)
{
bool allconstant = (TREE_CODE (TYPE_SIZE (type)) == INTEGER_CST);
+ bool read_only = true;
bool side_effects = false;
tree result, obj, val;
unsigned int n_elmts;
@@ -1867,6 +1868,9 @@ gnat_build_constructor (tree type, vec<constructor_elt, va_gc> *v)
|| !initializer_constant_valid_p (val, TREE_TYPE (val)))
allconstant = false;
+ if (!TREE_READONLY (val))
+ read_only = false;
+
if (TREE_SIDE_EFFECTS (val))
side_effects = true;
}
@@ -1881,7 +1885,7 @@ gnat_build_constructor (tree type, vec<constructor_elt, va_gc> *v)
CONSTRUCTOR_NO_CLEARING (result) = 1;
TREE_CONSTANT (result) = TREE_STATIC (result) = allconstant;
TREE_SIDE_EFFECTS (result) = side_effects;
- TREE_READONLY (result) = TYPE_READONLY (type) || allconstant;
+ TREE_READONLY (result) = TYPE_READONLY (type) || read_only || allconstant;
return result;
}
@@ -2814,7 +2818,7 @@ object:
if (!TREE_READONLY (t))
return NULL_TREE;
- if (TREE_CODE (t) == PARM_DECL)
+ if (TREE_CODE (t) == CONSTRUCTOR || TREE_CODE (t) == PARM_DECL)
return fold_convert (type, expr);
if (TREE_CODE (t) == VAR_DECL