[Bug middle-end/78328] New: wrong value in -Walloca-larger-than note
msebor at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 11 23:50:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78328
Bug ID: 78328
Summary: wrong value in -Walloca-larger-than note
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: middle-end
Assignee: unassigned at gcc dot gnu.org
Reporter: msebor at gcc dot gnu.org
Target Milestone: ---
The -Walloca-larger-than warning prints the wrong maximum value of the
function's argument in its note. For example, in the following, the argument
can be as large as UINT_MAX but the note prints 13. This seems to be caused by
the code that tries to handle casts in alloca_call_type where VR_ANTI_RANGE
isn't being handled correctly for ranges resulting from expressions like the
one below (in this case, ~[13, 13]).
$ cat c.c && gcc -O2 -S -Wall -Wextra -Walloca-larger-than=128 c.c
void f (void*);
void g (unsigned n)
{
if (n == 7 || n == 13) n = 11;
f (__builtin_alloca (n));
}
c.c: In function ‘g’:
c.c:6:3: warning: argument to ‘alloca’ may be too large [-Walloca-larger-than=]
f (__builtin_alloca (n));
^~~~~~~~~~~~~~~~~~~~~~~~
c.c:6:3: note: limit is 128 bytes, but argument may be as large as 13
More information about the Gcc-bugs
mailing list