* [Ada] Wrong membership test computation for interface type
@ 2021-05-04 9:52 Pierre-Marie de Rodat
0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2021-05-04 9:52 UTC (permalink / raw)
To: gcc-patches; +Cc: Javier Miranda
[-- Attachment #1: Type: text/plain, Size: 559 bytes --]
When the left expression of a membership test is an object implementing
an interface type, and the right operand of such membership test is a
non-class wide interface type, the compiler generates code that, instead
of comparing the actual tag of the left expression to the tag of the
right operand, erroneously generates a runtime call to the function
IW_Membership test.
Tested on x86_64-pc-linux-gnu, committed on trunk
gcc/ada/
* exp_ch4.adb (Tagged_Membership): Remove wrong condition that
is not consistent with the documentation of this subprogram.
[-- Attachment #2: patch.diff --]
[-- Type: text/x-diff, Size: 541 bytes --]
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -15284,7 +15284,7 @@ package body Exp_Ch4 is
Selector_Name =>
New_Occurrence_Of (First_Tag_Component (Left_Type), Loc));
- if Is_Class_Wide_Type (Right_Type) or else Is_Interface (Left_Type) then
+ if Is_Class_Wide_Type (Right_Type) then
-- No need to issue a run-time check if we statically know that the
-- result of this membership test is always true. For example,
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-05-04 9:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 9:52 [Ada] Wrong membership test computation for interface type Pierre-Marie de Rodat
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).