public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-6472] [Ada] Relax assertion on designated types for equality operators Date: Tue, 11 Jan 2022 13:28:46 +0000 (GMT) [thread overview] Message-ID: <20220111132846.B39BF38A9402@sourceware.org> (raw) https://gcc.gnu.org/g:7317a46128a3572f39d1d8f96155111d00d9d229 commit r12-6472-g7317a46128a3572f39d1d8f96155111d00d9d229 Author: Eric Botcazou <ebotcazou@adacore.com> Date: Mon Jan 3 16:15:20 2022 +0100 [Ada] Relax assertion on designated types for equality operators gcc/ada/ * gcc-interface/utils2.c (build_binary_op) <EQ_EXPR>: Relax a little the assertion on designated types of pointer types. Diff: --- gcc/ada/gcc-interface/utils2.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.c b/gcc/ada/gcc-interface/utils2.c index 06d82035c67..b651d486afb 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-2021, Free Software Foundation, Inc. * + * Copyright (C) 1992-2022, 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- * @@ -1118,7 +1118,7 @@ build_binary_op (enum tree_code op_code, tree result_type, return result; } - /* Otherwise, the base types must be the same, unless they are both fat + /* Otherwise, the base types must be the same, unless they are both (fat) pointer types or record types. In the latter case, use the best type and convert both operands to that type. */ if (left_base_type != right_base_type) @@ -1131,6 +1131,18 @@ build_binary_op (enum tree_code op_code, tree result_type, best_type = left_base_type; } + else if (POINTER_TYPE_P (left_base_type) + && POINTER_TYPE_P (right_base_type)) + { + /* Anonymous access types in Ada 2005 can point to different + members of a tagged type hierarchy. */ + gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (left_base_type)) + == TYPE_MAIN_VARIANT (TREE_TYPE (right_base_type)) + || (TYPE_ALIGN_OK (TREE_TYPE (left_base_type)) + && TYPE_ALIGN_OK (TREE_TYPE (right_base_type)))); + best_type = left_base_type; + } + else if (TREE_CODE (left_base_type) == RECORD_TYPE && TREE_CODE (right_base_type) == RECORD_TYPE) { @@ -1153,13 +1165,6 @@ build_binary_op (enum tree_code op_code, tree result_type, gcc_unreachable (); } - else if (POINTER_TYPE_P (left_base_type) - && POINTER_TYPE_P (right_base_type)) - { - gcc_assert (TREE_TYPE (left_base_type) - == TREE_TYPE (right_base_type)); - best_type = left_base_type; - } else gcc_unreachable ();
reply other threads:[~2022-01-11 13:28 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220111132846.B39BF38A9402@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).