From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 64331 invoked by alias); 27 Oct 2015 11:13:06 -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 64321 invoked by uid 89); 27 Oct 2015 11:13:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 27 Oct 2015 11:13:05 +0000 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id B75DDC0B5902; Tue, 27 Oct 2015 11:13:03 +0000 (UTC) Received: from localhost.localdomain (vpn1-4-97.ams2.redhat.com [10.36.4.97]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t9RBD1xK031024; Tue, 27 Oct 2015 07:13:02 -0400 Subject: Re: [PATCH] c/67882 - improve -Warray-bounds for invalid offsetof To: Richard Biener , Jakub Jelinek References: <5626A5A0.7040003@redhat.com> <562A164A.2030002@redhat.com> <562A4EF2.8080901@gmail.com> <562A7230.6060103@redhat.com> <562A9B49.7090600@gmail.com> <562E1122.9090503@redhat.com> <20151026114738.GQ478@tucnak.redhat.com> <562E1541.4030508@redhat.com> <20151026120101.GR478@tucnak.redhat.com> Cc: Martin Sebor , Joseph Myers , Gcc Patch List From: Bernd Schmidt Message-ID: <562F5C3D.7000900@redhat.com> Date: Tue, 27 Oct 2015 11:18:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-10/txt/msg02859.txt.bz2 On 10/26/2015 01:27 PM, Richard Biener wrote: > On Mon, Oct 26, 2015 at 1:01 PM, Jakub Jelinek wrote: >> On Mon, Oct 26, 2015 at 12:57:53PM +0100, Bernd Schmidt wrote: >>> On 10/26/2015 12:47 PM, Jakub Jelinek wrote: >>> >>>> Because the amount of code that uses this (including GCC itself) is just too >>>> huge, so everywhere in the middle-end we also special case last array members of >>>> structs. While C99+ has flexible array members, e.g. C++ does not, so users >>>> are left with using struct { ... type fld[1]; }; >>> >>> Yes, and that case is documented. However, the issue is arrays declared with >>> a larger size than 1 or 0 - is there really code using them as flexible >>> array members? >> >> I believe so, though don't have pointers to that right now. But vaguely >> remember we saw various cases of using 2 or other values too. > > Yes, char[4] is quite common (basically making sure there is no appearant > padding behind the array due to alignment - just in case compilers might > be clever because of that). Ugh, how ugly. Can we at least agree not to allow multi-dimensional arrays with a size larger than one to be considered flexible? Bernd