This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Compiler warnings while compiling gcc with clangâ


Am Tue, 5 May 2015 21:37:10 -0700
Andrew Pinski <pinskia@gmail.com>:
> On Tue, May 5, 2015@9:00 PM, Aditya K <hiraditya@msn.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.

Martin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]