aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-05-21 11:25:53 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-05-21 11:27:28 +0200
commit49c2c7f6551f9a71a1bc6766d3b7482a8b39c4ac (patch)
tree2cd3100c10ad8eb60ece0684751dd82f5f95be71 /gcc/ada
parent3553d8c2fecbe8d831538c661c9e58e7ae50c385 (diff)
downloadgcc-49c2c7f6551f9a71a1bc6766d3b7482a8b39c4ac.zip
gcc-49c2c7f6551f9a71a1bc6766d3b7482a8b39c4ac.tar.gz
gcc-49c2c7f6551f9a71a1bc6766d3b7482a8b39c4ac.tar.bz2
Remove discriminant checks in gigi
gcc/ada/ * gcc-interface/utils.c (gnat_pushdecl): Fix typo in comment. * gcc-interface/utils2.c (build_simple_component_ref): Build NULL_EXPR if the offset of the field has overflowed. (build_component_ref): Add gigi checking assertion that the reference has been built and replace the discriminant check by a Program_Error.
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/gcc-interface/utils.c2
-rw-r--r--gcc/ada/gcc-interface/utils2.c15
2 files changed, 11 insertions, 6 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 8d1040b..1786fbf 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -784,7 +784,7 @@ gnat_pushdecl (tree decl, Node_Id gnat_node)
tree context = NULL_TREE;
struct deferred_decl_context_node *deferred_decl_context = NULL;
- /* If explicitely asked to make DECL global or if it's an imported nested
+ /* If explicitly asked to make DECL global or if it's an imported nested
object, short-circuit the regular Scope-based context computation. */
if (!((TREE_PUBLIC (decl) && DECL_EXTERNAL (decl)) || force_global == 1))
{
diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c
index acb308c..e8ed4b2 100644
--- a/gcc/ada/gcc-interface/utils2.c
+++ b/gcc/ada/gcc-interface/utils2.c
@@ -2071,7 +2071,9 @@ build_simple_component_ref (tree record, tree field, bool no_fold)
need to warn since this will be done on trying to declare the object. */
if (TREE_CODE (DECL_FIELD_OFFSET (field)) == INTEGER_CST
&& TREE_OVERFLOW (DECL_FIELD_OFFSET (field)))
- return NULL_TREE;
+ return build1 (NULL_EXPR, TREE_TYPE (field),
+ build_call_raise (SE_Object_Too_Large, Empty,
+ N_Raise_Storage_Error));
ref = build3 (COMPONENT_REF, TREE_TYPE (field), record, field, NULL_TREE);
@@ -2105,7 +2107,7 @@ build_simple_component_ref (tree record, tree field, bool no_fold)
return fold (ref);
}
-/* Likewise, but return NULL_EXPR and generate a Constraint_Error if the
+/* Likewise, but return NULL_EXPR and generate a Program_Error if the
field is not found in the record. */
tree
@@ -2115,10 +2117,13 @@ build_component_ref (tree record, tree field, bool no_fold)
if (ref)
return ref;
- /* Assume this is an invalid user field so raise Constraint_Error. */
+ /* The missing field should have been detected in the front-end. */
+ gigi_checking_assert (false);
+
+ /* Assume this is an invalid user field so raise Program_Error. */
return build1 (NULL_EXPR, TREE_TYPE (field),
- build_call_raise (CE_Discriminant_Check_Failed, Empty,
- N_Raise_Constraint_Error));
+ build_call_raise (PE_Explicit_Raise, Empty,
+ N_Raise_Program_Error));
}
/* Helper for build_call_alloc_dealloc, with arguments to be interpreted