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: alloca (0) in include/libiberty.h


On Tue, Jun 11, 2019 at 03:58:27PM +0000, Michael Matz wrote:
> On Tue, 11 Jun 2019, Martin Liška wrote:
> 
> > I see 3 occurrences of the alloca (0) in libiberty/regex.c, but there are properly
> > guarded within:
> > 
> > # ifdef C_ALLOCA
> >       alloca (0);
> > # endif
> > 
> > and then I noticed 2 more occurrences in gdb that break build right now:
> > 
> > gdb/regcache.c:  alloca (0);
> > gdb/top.c:  alloca (0);
> > 
> > Is it the right approach to remove these 2 in gdb?
> 
> It's more an indication that the annotation requesting the warning for 
> unused results is simply overeager (aka wrong) for alloca.  (sure, the 
> uses in gdb probably could be cleaned up as well, but that doesn't affect 
> the wrongness of the warning).

Yeah.  Either we special-case alloca in the warn_unused_result code
- if the call flags include ECF_MAY_BE_ALLOCA and argument is 0, don't warn,
or don't add the attribute to alloca, or add yet another attribute that will
be used for alloca only.

	Jakub


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