https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78837

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2017-08-28
                 CC|                            |egallager at gcc dot gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Eric Gallager <egallager at gcc dot gnu.org> ---
I get even fewer warnings; I only get the -Walloca-larger-than one, but not the
-Walloc-size-larger-than one:

$ /usr/local/bin/gcc -c -O2 -S -Walloca-larger-than=10
-Walloc-size-larger-than=10 78837.c
78837.c: In function ‘f1’:
78837.c:11:5: warning: argument to ‘alloca’ may be too large
[-Walloca-larger-than=]
   p = __builtin_alloca (n);
   ~~^~~~~~~~~~~~~~~~~~~~~~
78837.c:11:5: note: limit is 10 bytes, but argument may be as large as 122
$

Turns out it's due to my compiler defaulting to 32-bit; forcing 64-bit gets
both of them:

$ /usr/local/bin/gcc -c -O2 -S -Walloca-larger-than=10
-Walloc-size-larger-than=10 -m64 78837.c
78837.c: In function ‘f1’:
78837.c:11:5: warning: argument to ‘alloca’ may be too large
[-Walloca-larger-than=]
   p = __builtin_alloca (n);
   ~~^~~~~~~~~~~~~~~~~~~~~~
78837.c:11:5: note: limit is 10 bytes, but argument may be as large as 122
78837.c:13:5: warning: argument 1 range [32, 4294967295] exceeds maximum object
size 10 [-Walloc-size-larger-than=]
   p = __builtin_malloc (n);
   ~~^~~~~~~~~~~~~~~~~~~~~~
78837.c:13:5: note: in a call to built-in allocation function
‘__builtin_malloc’
$

But still, confirmed that there's still warnings missing for the ternary
expression either way.

Reply via email to