[Ada] Fix wrong call to protected function returning VFA type

Message ID 1648428.fOq3io5smV@polaris
State New
Headers show
Series
  • [Ada] Fix wrong call to protected function returning VFA type
Related show

Commit Message

Eric Botcazou March 10, 2018, 10:15 a.m.
This is a small regression present on the mainline and 7 branch: the call to a 
protected function returning a composite type with Volatile_Full_Access aspect 
or pragma yields a segfault at run time.

Tested on x86-64/Linux, applied on the mainline and 7 branch.


2018-03-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gcc-interface/trans.c (node_has_volatile_full_access) <N_Identifier>:
	Consider only entities for objects.


2018-03-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gnat.dg/prot3.adb: New test.
	* gnat.dg/prot3_pkg.ad[sb]: New helper.

-- 
Eric Botcazou

Patch

Index: gcc-interface/trans.c
===================================================================
--- gcc-interface/trans.c	(revision 258411)
+++ gcc-interface/trans.c	(working copy)
@@ -4082,6 +4082,8 @@  node_has_volatile_full_access (Node_Id g
     case N_Identifier:
     case N_Expanded_Name:
       gnat_entity = Entity (gnat_node);
+      if (!Is_Object (gnat_entity))
+	break;
       return Is_Volatile_Full_Access (gnat_entity)
 	     || Is_Volatile_Full_Access (Etype (gnat_entity));