aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2009-08-20 14:04:30 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2009-08-20 14:04:30 +0000
commit456976d81d0d5c3d01050d4f6c12b80db61b5d55 (patch)
tree06e8be604568a4fdad47be340fc9287316228a35 /gcc/ada/gcc-interface
parent197c68cc978ee36fab09445e9f09a5752f2585f1 (diff)
downloadgcc-456976d81d0d5c3d01050d4f6c12b80db61b5d55.zip
gcc-456976d81d0d5c3d01050d4f6c12b80db61b5d55.tar.gz
gcc-456976d81d0d5c3d01050d4f6c12b80db61b5d55.tar.bz2
ada-tree.h (SET_TYPE_RM_VALUE): Mark the expression as visited.
* gcc-interface/ada-tree.h (SET_TYPE_RM_VALUE): Mark the expression as visited. * gcc-interface/misc.c (gnat_get_subrange_bounds): Always return the bounds. * gcc-interface/trans.c (add_decl_expr): Do not mark gigi-specific fields. (gnat_gimplify_expr) <DECL_EXPR>: New case. From-SVN: r150963
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/ada-tree.h4
-rw-r--r--gcc/ada/gcc-interface/misc.c10
-rw-r--r--gcc/ada/gcc-interface/trans.c66
3 files changed, 47 insertions, 33 deletions
diff --git a/gcc/ada/gcc-interface/ada-tree.h b/gcc/ada/gcc-interface/ada-tree.h
index 8983139..18eb416 100644
--- a/gcc/ada/gcc-interface/ada-tree.h
+++ b/gcc/ada/gcc-interface/ada-tree.h
@@ -208,6 +208,10 @@ do { \
tree tmp = (X); \
if (!TYPE_RM_VALUES (NODE)) \
TYPE_RM_VALUES (NODE) = make_tree_vec (3); \
+ /* ??? The field is not visited by the generic \
+ code so we need to mark it manually. */ \
+ if (!TREE_CONSTANT (tmp)) \
+ mark_visited (&tmp); \
TREE_VEC_ELT (TYPE_RM_VALUES (NODE), (N)) = tmp; \
} while (0)
diff --git a/gcc/ada/gcc-interface/misc.c b/gcc/ada/gcc-interface/misc.c
index 4b68227..cc9eeaa 100644
--- a/gcc/ada/gcc-interface/misc.c
+++ b/gcc/ada/gcc-interface/misc.c
@@ -656,14 +656,8 @@ gnat_type_max_size (const_tree gnu_type)
static void
gnat_get_subrange_bounds (const_tree gnu_type, tree *lowval, tree *highval)
{
- tree min = TYPE_MIN_VALUE (gnu_type);
- tree max = TYPE_MAX_VALUE (gnu_type);
- /* If the bounds aren't constant, use non-representable constant values
- to get the same effect on debug info without tree sharing issues. */
- *lowval
- = TREE_CONSTANT (min) ? min : build_int_cstu (integer_type_node, -1);
- *highval
- = TREE_CONSTANT (max) ? max : build_int_cstu (integer_type_node, -1);
+ *lowval = TYPE_MIN_VALUE (gnu_type);
+ *highval = TYPE_MAX_VALUE (gnu_type);
}
/* GNU_TYPE is a type. Determine if it should be passed by reference by
diff --git a/gcc/ada/gcc-interface/trans.c b/gcc/ada/gcc-interface/trans.c
index 84053a4..b3a201f 100644
--- a/gcc/ada/gcc-interface/trans.c
+++ b/gcc/ada/gcc-interface/trans.c
@@ -5557,31 +5557,6 @@ add_decl_expr (tree gnu_decl, Entity_Id gnat_entity)
mark_visited (&DECL_SIZE_UNIT (gnu_decl));
mark_visited (&DECL_INITIAL (gnu_decl));
}
-
- /* In any case, we have to deal with our own fields. */
- else if (TREE_CODE (gnu_decl) == TYPE_DECL)
- switch (TREE_CODE (type))
- {
- case RECORD_TYPE:
- case UNION_TYPE:
- case QUAL_UNION_TYPE:
- if ((t = TYPE_ADA_SIZE (type)))
- mark_visited (&t);
- break;
-
- case INTEGER_TYPE:
- case ENUMERAL_TYPE:
- case BOOLEAN_TYPE:
- case REAL_TYPE:
- if ((t = TYPE_RM_MIN_VALUE (type)))
- mark_visited (&t);
- if ((t = TYPE_RM_MAX_VALUE (type)))
- mark_visited (&t);
- break;
-
- default:
- break;
- }
}
else
add_stmt_with_node (gnu_stmt, gnat_entity);
@@ -5875,6 +5850,47 @@ gnat_gimplify_expr (tree *expr_p, gimple_seq *pre_p,
return GS_ALL_DONE;
}
+ return GS_UNHANDLED;
+
+ case DECL_EXPR:
+ op = DECL_EXPR_DECL (expr);
+
+ /* The expressions for the RM bounds must be gimplified to ensure that
+ they are properly elaborated. See gimplify_decl_expr. */
+ if ((TREE_CODE (op) == TYPE_DECL || TREE_CODE (op) == VAR_DECL)
+ && !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (op)))
+ switch (TREE_CODE (TREE_TYPE (op)))
+ {
+ case INTEGER_TYPE:
+ case ENUMERAL_TYPE:
+ case BOOLEAN_TYPE:
+ case REAL_TYPE:
+ {
+ tree type = TYPE_MAIN_VARIANT (TREE_TYPE (op)), t, val;
+
+ val = TYPE_RM_MIN_VALUE (type);
+ if (val)
+ {
+ gimplify_one_sizepos (&val, pre_p);
+ for (t = type; t; t = TYPE_NEXT_VARIANT (t))
+ SET_TYPE_RM_MIN_VALUE (t, val);
+ }
+
+ val = TYPE_RM_MAX_VALUE (type);
+ if (val)
+ {
+ gimplify_one_sizepos (&val, pre_p);
+ for (t = type; t; t = TYPE_NEXT_VARIANT (t))
+ SET_TYPE_RM_MAX_VALUE (t, val);
+ }
+
+ }
+ break;
+
+ default:
+ break;
+ }
+
/* ... fall through ... */
default: