public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [Ada] Illegal renaming of conditional expression
@ 2017-04-25  8:12 Arnaud Charlet
  0 siblings, 0 replies; only message in thread
From: Arnaud Charlet @ 2017-04-25  8:12 UTC (permalink / raw)
  To: gcc-patches; +Cc: Bob Duff

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

This patch corrects a compiler bug that caused an illegal renaming to
not be detected. In particular, it wasn't detected if the name in the
renaming is a qualified expression whose operand is a conditional
expression, and the type is a by-reference type.

Tested on x86_64-pc-linux-gnu, committed on trunk

2017-04-25  Bob Duff  <duff@adacore.com>

	* sem_util.adb (Is_Object_Reference): In the
	case of N_Explicit_Dereference, return False if it came from a
	conditional expression.


[-- Attachment #2: difs --]
[-- Type: text/plain, Size: 829 bytes --]

Index: sem_util.adb
===================================================================
--- sem_util.adb	(revision 247137)
+++ sem_util.adb	(working copy)
@@ -13548,8 +13548,14 @@
                      (Is_Object_Reference (Prefix (N))
                        or else Is_Access_Type (Etype (Prefix (N))));
 
+            --  An explicit dereference denotes an object, except that a
+            --  conditional expression gets turned into an explicit dereference
+            --  in some cases, and conditional expressions are not object
+            --  names.
+
             when N_Explicit_Dereference =>
-               return True;
+               return not Nkind_In
+                 (Original_Node (N), N_If_Expression, N_Case_Expression);
 
             --  A view conversion of a tagged object is an object reference
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-04-25  8:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-04-25  8:12 [Ada] Illegal renaming of conditional expression Arnaud Charlet

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).