From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30351 invoked by alias); 21 Mar 2017 19:33:48 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 28992 invoked by uid 89); 21 Mar 2017 19:33:48 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM autolearn=no version=3.3.2 spammy=Hx-languages-length:2329, risk X-HELO: mail-oi0-f45.google.com Received: from mail-oi0-f45.google.com (HELO mail-oi0-f45.google.com) (209.85.218.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 21 Mar 2017 19:33:46 +0000 Received: by mail-oi0-f45.google.com with SMTP id l203so8100104oia.0 for ; Tue, 21 Mar 2017 12:33:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=GQ5a/h/2mEF6UtIazwOyUGG/mooWhW3yx+9xtEZdQu8=; b=PURrA8+NyAw2sGonjA7qkRDAkLuwvA96w7FqhVEknCw/a38PF2gnUAkNqgZh4wbF7W 7kTBUZ6LhRuhaUvl0B2PCcBI4t4SonyZF08yAII351LdH1rE2uS/6jQWpT8aOtf8VQKI b+Sy568yb4FqRD8z0fMqnglkGEVMCna4YSdV8Ur8EE6duBojsSRX1pgU8HqlIhm6BMXQ bXYtf3OSaoItQ9H9YczZz5UEaWMG2KHhI6KJcxz4EKEsQtECPkxxigtZoq45fQtejL0z nYvVm/y2MU2mUTObn8NVePGSEsgLTQXsvxiY6RSE+xihPJvCmCGmtInNIaXQ/Pg2TN2D DMQw== X-Gm-Message-State: AFeK/H0nt5aIX/yEnXRWG0+vEE0V9rPSs4u4GrYPRr8Vz4LtCLcteoDRZzPs1CHLsJhyzyqthyQDWc2yt9w7e6Ve X-Received: by 10.202.237.210 with SMTP id l201mr21078355oih.81.1490124826010; Tue, 21 Mar 2017 12:33:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.182.187.8 with HTTP; Tue, 21 Mar 2017 12:33:25 -0700 (PDT) In-Reply-To: References: <4c6d8cdd-46f8-216d-56cb-07a74284f69a@gmail.com> <6320faa1-1958-5033-8352-665d0acfd5db@gmail.com> From: Jason Merrill Date: Tue, 21 Mar 2017 19:33:00 -0000 Message-ID: Subject: Re: [PATCH] have chkp skip flexible member arrays (PR #79986) To: Martin Sebor Cc: Gcc Patch List Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg01134.txt.bz2 On Tue, Mar 21, 2017 at 11:08 AM, Martin Sebor wrote: > On 03/20/2017 10:27 PM, Jason Merrill wrote: >> >> On Mon, Mar 20, 2017 at 7:58 PM, Martin Sebor wrote: >>> >>> On 03/20/2017 05:51 PM, Jason Merrill wrote: >>>> >>>> On Mon, Mar 20, 2017 at 7:04 PM, Martin Sebor wrote: >>>>> >>>>> >>>>> Attached is a minimal patch to avoid an ICE in CHKP upon >>>>> encountering one form of an initializer for a flexible array >>>>> member, specifically the empty string: >>>>> >>>>> int f () >>>>> { >>>>> struct B { int n; char a[]; }; >>>>> >>>>> return ((struct B){ 1, "" }).a[0]; >>>>> } >>>>> >>>>> Although GCC accepts (and doesn't ICE on) non-empty initializers >>>>> for flexible array members, such as >>>>> >>>>> (struct B){ 1, "123" } >>>> >>>> How do you mean? When I compile this with the C front end, I get >>>> >>>> error: non-static initialization of a flexible array member >>> >>> I meant that G++ accepts it, doesn't ICE, but emits wrong code. >>> (it's consistently rejected by the C front end). Sorry for not >>> being clear about it. >> >> Ah, OK. It seems to me that the wrong code bug is worth addressing; >> why does rejecting the code seem risky to you? > > I have a few reasons: First, it's not a regression (I raised > bug 69696 for it in early 2016) so strictly it's out of scope > for this stage. Second, there are a number of bugs related > to the initialization of flexible array members so the fixes > are probably not going to be contained to a single function > or file. Third, the flexible member array changes I made in > the past were not trivial, took time to develop, and the two > of us iterated over some of them for weeks. Despite your > careful review and my extensive testing some of them > introduced regressions that are still being patched up. > Fourth, making a change to reject code this close to a release > runs the risk of breaking code that has successfully compiled > in mass rebuilds and others' tests with the new compiler. > While that could be viewed as a good change for invalid code > that's exercised at run time, it could also break programs > where the bad code is never exercised. Fair enough. But I think the ICE is preferable to wrong code. Jason