This is the mail archive of the gcc-patches@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: [C/C++ PATCH] Implement -Wsizeof-array-argument (PR c/6940)


On Fri, 27 Jun 2014, Marek Polacek wrote:

> The following is a revamped patch for -Wsizeof-array-argument.  Almost two
> months back there was an initial attempt by Prathamesh:
> <https://gcc.gnu.org/ml/gcc-patches/2014-05/msg00142.html>, but that patch
> never made it in.  This version implements the warning for both C and C++
> FEs, adds more testing, enables the warning by default (I can move it to
> -Wall, of course), makes the warning work properly even for multidimensional
> arrays, etc.
> Its purpose is to detect suspicious usage of the sizeof operator on an array
> function parameter.  A few years back I fixed exactly this kind of bug in
> elfutils - so -Wsizeof-array-argument might be indeed useful.  (The warning didn't
> trigger during GCC bootstrap though.)
> 
> Jason/Joseph, could you please look at the C++, resp. C FE parts?

The C changes are OK.

-- 
Joseph S. Myers
joseph@codesourcery.com


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