{"id":810528,"url":"http://patchwork.ozlabs.org/api/patches/810528/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20170906115238.GA129382@adacore.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/projects/17/?format=json","name":"GNU Compiler Collection","link_name":"gcc","list_id":"gcc-patches.gcc.gnu.org","list_email":"gcc-patches@gcc.gnu.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20170906115238.GA129382@adacore.com>","list_archive_url":null,"date":"2017-09-06T11:52:38","name":"[Ada] Crash when issuing warning on uninitialized value","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"1e7f65c6a8913591de7f9096e6b8034c25e7fbd8","submitter":{"id":4418,"url":"http://patchwork.ozlabs.org/api/people/4418/?format=json","name":"Arnaud Charlet","email":"charlet@adacore.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20170906115238.GA129382@adacore.com/mbox/","series":[{"id":1774,"url":"http://patchwork.ozlabs.org/api/series/1774/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=1774","date":"2017-09-06T11:52:38","name":"[Ada] Crash when issuing warning on uninitialized value","version":1,"mbox":"http://patchwork.ozlabs.org/series/1774/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/810528/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/810528/checks/","tags":{},"related":[],"headers":{"Return-Path":"<gcc-patches-return-461588-incoming=patchwork.ozlabs.org@gcc.gnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","mailing list gcc-patches@gcc.gnu.org"],"Authentication-Results":["ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org\n\t(client-ip=209.132.180.131; helo=sourceware.org;\n\tenvelope-from=gcc-patches-return-461588-incoming=patchwork.ozlabs.org@gcc.gnu.org;\n\treceiver=<UNKNOWN>)","ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org\n\theader.b=\"mr6hDgl0\"; dkim-atps=neutral","sourceware.org; auth=none"],"Received":["from sourceware.org (server1.sourceware.org [209.132.180.131])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256\n\tbits)) (No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3xnMQq5Y8Hz9sBW\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed,  6 Sep 2017 21:52:51 +1000 (AEST)","(qmail 93408 invoked by alias); 6 Sep 2017 11:52:45 -0000","(qmail 93189 invoked by uid 89); 6 Sep 2017 11:52:44 -0000","from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by\n\tsourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP;\n\tWed, 06 Sep 2017 11:52:39 +0000","from localhost (localhost.localdomain [127.0.0.1])\tby\n\tfiltered-rock.gnat.com (Postfix) with ESMTP id 55BD05614B;\n\tWed,  6 Sep 2017 07:52:38 -0400 (EDT)","from rock.gnat.com ([127.0.0.1])\tby localhost (rock.gnat.com\n\t[127.0.0.1]) (amavisd-new, port 10024)\twith LMTP id\n\tTHvNSi+orVpT; Wed,  6 Sep 2017 07:52:38 -0400 (EDT)","from tron.gnat.com (tron.gnat.com\n\t[IPv6:2620:20:4000:0:46a8:42ff:fe0e:e294])\tby rock.gnat.com\n\t(Postfix) with ESMTP id 455A156142;\n\tWed,  6 Sep 2017 07:52:38 -0400 (EDT)","by tron.gnat.com (Postfix, from userid 4192)\tid 41A6D4AC;\n\tWed,  6 Sep 2017 07:52:38 -0400 (EDT)"],"DomainKey-Signature":"a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; q=dns;\n\ts=default; b=L1pOr1J5lFwVxq9hsC2rliQQVpxksOgKHWRqOjODgCIjjfbDZT\n\tmPqJB8Xpc68PLUQQkRBMmcYlNpvyb45wTqgb2gyYrHi7g+kJV9EHsNmJnAXongm4\n\t6u7OKIvXtTPegicga+sYjbVFL0IMjuGMAiR28sV1lIDG8F9lCGTM92xSU=","DKIM-Signature":"v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id\n\t:list-unsubscribe:list-archive:list-post:list-help:sender:date\n\t:from:to:cc:subject:message-id:mime-version:content-type; s=\n\tdefault; bh=QoMC9xcgskajtG1ep/ZGtp7r+hM=; b=mr6hDgl0uizb/VS/aBEp\n\tdyaJVJdHSnsEcjpKh9UchOvUkEl/N0tbmdr5fdeFzxUIeRPeh59aTzdyaHCEF2eE\n\tidrStG4szSkdshb/U8w4zITyBzKTqAGnJFuWx6kH8xwGD/Ezv3TMnFZbC10BjvhB\n\tl/pZGm3Yh3dSH5/GdI8V61U=","Mailing-List":"contact gcc-patches-help@gcc.gnu.org; run by ezmlm","Precedence":"bulk","List-Id":"<gcc-patches.gcc.gnu.org>","List-Unsubscribe":"<mailto:gcc-patches-unsubscribe-incoming=patchwork.ozlabs.org@gcc.gnu.org>","List-Archive":"<http://gcc.gnu.org/ml/gcc-patches/>","List-Post":"<mailto:gcc-patches@gcc.gnu.org>","List-Help":"<mailto:gcc-patches-help@gcc.gnu.org>","Sender":"gcc-patches-owner@gcc.gnu.org","X-Virus-Found":"No","X-Spam-SWARE-Status":"No, score=-11.9 required=5.0 tests=BAYES_00, GIT_PATCH_2,\n\tGIT_PATCH_3, RCVD_IN_DNSWL_NONE,\n\tSPF_PASS autolearn=ham version=3.3.2 spammy=","X-HELO":"rock.gnat.com","Date":"Wed, 6 Sep 2017 07:52:38 -0400","From":"Arnaud Charlet <charlet@adacore.com>","To":"gcc-patches@gcc.gnu.org","Cc":"Yannick Moy <moy@adacore.com>","Subject":"[Ada] Crash when issuing warning on uninitialized value","Message-ID":"<20170906115238.GA129382@adacore.com>","MIME-Version":"1.0","Content-Type":"multipart/mixed; boundary=\"k1lZvvs/B4yU6o8G\"","Content-Disposition":"inline","User-Agent":"Mutt/1.5.23 (2014-03-12)"},"content":"When issuing a warning on a read of an uninitialized variable through\nreading an attribute such as Loop_Entry, GNAT could crash. Now fixed.\n\nGNAT issues a warning as expected on the following code:\n\n     $ gcc -c s.adb\n\n     1. package S is\n     2.\n     3.    type Array_Range is range 1 .. 10;\n     4.\n     5.    type IntArray is array (Array_Range) of Integer;\n     6.\n     7.    procedure Move (Dest, Src : aliased out IntArray);\n     8.\n     9. end S;\n\n     1. package body S is\n     2.\n     3.    procedure Move (Dest, Src : aliased out IntArray) is\n     4.    begin\n     5.       for Index in Dest'Range loop\n     6.          pragma Assert (for all J in Dest'First .. Index - 1 =>\n     7.                           Dest (J) = Src'Loop_Entry (J));\n                                  1          2\n        >>> warning: \"Dest\" may be referenced before it has a value\n        >>> warning: \"Src\" may be referenced before it has a value\n\n     8.\n     9.          Dest (Index) := Src (Index);\n    10.          Src (Index) := 0;\n    11.       end loop;\n    12.    end Move;\n    13.\n    14. end S;\n\nTested on x86_64-pc-linux-gnu, committed on trunk\n\n2017-09-06  Yannick Moy  <moy@adacore.com>\n\n\t* sem_warn.adb (Check_References): Take into\n\taccount possibility of attribute reference as original node.","diff":"Index: sem_warn.adb\n===================================================================\n--- sem_warn.adb\t(revision 251773)\n+++ sem_warn.adb\t(working copy)\n@@ -1382,16 +1382,22 @@\n                   --  deal with case where original unset reference has been\n                   --  rewritten during expansion.\n \n-                  --  In some cases, the original node may be a type conversion\n-                  --  or qualification, and in this case we want the object\n-                  --  entity inside.\n+                  --  In some cases, the original node may be a type\n+                  --  conversion, a qualification or an attribute reference and\n+                  --  in this case we want the object entity inside. Same for\n+                  --  an expression with actions.\n \n                   UR := Original_Node (UR);\n                   while Nkind (UR) = N_Type_Conversion\n                     or else Nkind (UR) = N_Qualified_Expression\n                     or else Nkind (UR) = N_Expression_With_Actions\n+                    or else Nkind (UR) = N_Attribute_Reference\n                   loop\n-                     UR := Expression (UR);\n+                     if Nkind (UR) = N_Attribute_Reference then\n+                        UR := Prefix (UR);\n+                     else\n+                        UR := Expression (UR);\n+                     end if;\n                   end loop;\n \n                   --  Don't issue warning if appearing inside Initial_Condition\n","prefixes":["Ada"]}