From patchwork Sat Mar 10 10:15:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 884132 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-474536-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=adacore.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="I0ftOqbA"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zz0Ws6LKZz9tMD for ; Sat, 10 Mar 2018 21:16:06 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; q=dns; s=default; b=g/VJl6XQzJt+bjoy eaLM9eoPwzVdhhYNaZqCXr+EKPo8SZaq7tPGqpcbQNKQwkHrc5p+OwTjvNZ+kO22 ZgNp5VHtoUfiq29dAYZn9H32omn4/USjZtU7qlDsC7wPoCN8g+GE5Pm7z7BO7sDX e/gek1zQR412ZsXJUZEGiQsD7nI= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; s=default; bh=eljL9ZuxbHh/tO/+lI07zb OEMbM=; b=I0ftOqbAR3YLwObvoUAEgDcvWT/v3NpV4Vj0qxJKvExHLpAvbx4yNU Fe3eM4N4/RpRm0K0bHLcK+AlW4US7JKnBcJniqnZFw2BPeMq+NGjsIDDl5nhHKFR 5aVPfqbGPM8CYUqMTIt1A8OkLL8x9OEGnCNfmcXOTNxGmNpnU8zuE= Received: (qmail 49154 invoked by alias); 10 Mar 2018 10:16:00 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 49023 invoked by uid 89); 10 Mar 2018 10:15:35 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: smtp.eu.adacore.com Received: from mel.act-europe.fr (HELO smtp.eu.adacore.com) (194.98.77.210) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 10 Mar 2018 10:15:34 +0000 Received: from localhost (localhost [127.0.0.1]) by filtered-smtp.eu.adacore.com (Postfix) with ESMTP id 147EE8138E for ; Sat, 10 Mar 2018 11:15:19 +0100 (CET) Received: from smtp.eu.adacore.com ([127.0.0.1]) by localhost (smtp.eu.adacore.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IwZOshk1DIKQ for ; Sat, 10 Mar 2018 11:15:18 +0100 (CET) Received: from polaris.localnet (bon31-6-88-161-99-133.fbx.proxad.net [88.161.99.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.eu.adacore.com (Postfix) with ESMTPSA id DCD8C8138A for ; Sat, 10 Mar 2018 11:15:18 +0100 (CET) From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix wrong call to protected function returning VFA type Date: Sat, 10 Mar 2018 11:15:16 +0100 Message-ID: <1648428.fOq3io5smV@polaris> MIME-Version: 1.0 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 * gcc-interface/trans.c (node_has_volatile_full_access) : Consider only entities for objects. 2018-03-10 Eric Botcazou * gnat.dg/prot3.adb: New test. * gnat.dg/prot3_pkg.ad[sb]: New helper. 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));