aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2024-01-09 10:21:51 +0100
committerEric Botcazou <ebotcazou@adacore.com>2024-01-09 10:24:57 +0100
commit4d3fd59953bcf423dd0859a2c6b95b5260aed71d (patch)
treebae8c75cbb523bf5a099bd90a394168c8e379a88 /gcc/ada/gcc-interface
parentf34141730266600b615b91d563a85a0b60223b3e (diff)
downloadgcc-4d3fd59953bcf423dd0859a2c6b95b5260aed71d.zip
gcc-4d3fd59953bcf423dd0859a2c6b95b5260aed71d.tar.gz
gcc-4d3fd59953bcf423dd0859a2c6b95b5260aed71d.tar.bz2
Fix internal error on anonymous access type equality
This is a small regression present on the mainline and 13 branch, in the form of an internal error in gigi on anonymous access type equality. We now need to also accept them for anonymous access types that point to compatible object subtypes in the language sense. gcc/ada/ * gcc-interface/utils2.cc (build_binary_op) <EQ_EXPR>: Relax assertion for regular pointer types. gcc/testsuite/ * gnat.dg/specs/anon4.ads: New test.
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/utils2.cc12
1 files changed, 4 insertions, 8 deletions
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index 6a95109..df11eef 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -1142,14 +1142,10 @@ build_binary_op (enum tree_code op_code, tree result_type,
tree left_ref_type = TREE_TYPE (left_base_type);
tree right_ref_type = TREE_TYPE (right_base_type);
- /* Anonymous access types in Ada 2005 can point to different
- members of a tagged hierarchy or different function types. */
- gcc_assert (TYPE_MAIN_VARIANT (left_ref_type)
- == TYPE_MAIN_VARIANT (right_ref_type)
- || (TYPE_ALIGN_OK (left_ref_type)
- && TYPE_ALIGN_OK (right_ref_type))
- || (TREE_CODE (left_ref_type) == FUNCTION_TYPE
- && TREE_CODE (right_ref_type) == FUNCTION_TYPE));
+ /* Anonymous access types in Ada 2005 may point to compatible
+ object subtypes or function types in the language sense. */
+ gcc_assert (FUNCTION_POINTER_TYPE_P (left_ref_type)
+ == FUNCTION_POINTER_TYPE_P (right_ref_type));
best_type = left_base_type;
}