This is the mail archive of the
mailing list for the GCC project.
Re: Compiler warnings while compiling gcc with clangâ
- From: Martin Uecker <uecker at eecs dot berkeley dot edu>
- To: Andrew Pinski <pinskia at gmail dot com>
- Cc: Aditya K <hiraditya at msn dot com>, Jonathan Wakely <jwakely dot gcc at gmail dot com>, Renato Golin <renato dot golin at linaro dot org>, "gcc at gcc dot gnu dot org" <gcc at gcc dot gnu dot org>
- Date: Wed, 6 May 2015 19:52:50 -0700
- Subject: Re: Compiler warnings while compiling gcc with clangâ
- Authentication-results: sourceware.org; auth=none
- References: <BLU179-W15F1B75976EAA6915DFE1BB6D10 at phx dot gbl> <CA+=Sn1k+1NUE_o2mkWRad_-wgQuQCiyHPmNYc00zeH+N61qZXQ at mail dot gmail dot com> <CAMSE1kciuStXmVRor4Mc=qb78xZYarwdHAAz2xme7L00bajWuw at mail dot gmail dot com> <55EE0A4A-97FF-4A75-867F-B91B9EAD00D1 at gmail dot com> <BLU179-W821F0444DBDE3555C97781B6D10 at phx dot gbl> <CAH6eHdTk0wUs2rkwfk0LAUs=jzEQrQ0o67jimD5Zc6EN1g5pOQ at mail dot gmail dot com> <BLU179-W380C59FDDDAB25E897B6DB6D00 at phx dot gbl> <A46BBDC9-B18A-4542-8127-D08166BCE074 at gmail dot com> <BLU179-W36E22659AABD1E5974E199B6D00 at phx dot gbl> <CA+=Sn1=Xa4qoT0hO22dva_oCJ5Y_rT=v+CLhSF04gCOLE4YHbQ at mail dot gmail dot com>
Am Tue, 5 May 2015 21:37:10 -0700
Andrew Pinski <firstname.lastname@example.org>:
> On Tue, May 5, 2015@9:00 PM, Aditya K <email@example.com> wrote:
> >>> gcc/rtlanal.c:5573:23: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
> >>> ../../gcc/rtlanal.c:5573:23: warning: array index 1 is past the end of the array (which contains 1 element) [-Warray-bounds]
> >>> *second = GEN_INT (CONST_DOUBLE_HIGH (value));
> >>> ^~~~~~~~~~~~~~~~~~~~~~~~~
> >> These warnings are bogus due to the array being the last element of the structure.
> >> Please file that with clang.
> > IIRC, C++ does not allow flexible array members.
> But this has been a common extension for many years now (since C++ and
> C have been around). So warning is useless.
A flexible array member has no size or with the gcc extension has
size 0. Clang also does not warn about these. The array here seems
to have size 1 and I have seen similar cases in the gcc code base
with size 2.
The benefit of cleaning this up would be that you could get proper
warnings for arrays at the end of the struct which are not meant
to be flexible array members.