public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/91235] Array size expression is implicitly casted to unsigned long type
[not found] <bug-91235-4@http.gcc.gnu.org/bugzilla/>
@ 2021-08-24 22:16 ` pinskia at gcc dot gnu.org
2021-08-25 16:05 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-24 22:16 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91235
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I think the warning is correct. there is no negative sizes; only size_t sizes
for array.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/91235] Array size expression is implicitly casted to unsigned long type
[not found] <bug-91235-4@http.gcc.gnu.org/bugzilla/>
2021-08-24 22:16 ` [Bug c++/91235] Array size expression is implicitly casted to unsigned long type pinskia at gcc dot gnu.org
@ 2021-08-25 16:05 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 2+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-08-25 16:05 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91235
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution|--- |INVALID
CC| |msebor at gcc dot gnu.org
--- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> ---
Both the warning and the analysis in comment #0 are correct. The code tries to
allocate an excessively large VLA (the -1 converts to SIZE_MAX):
;; Function baz (baz, funcdef_no=1, decl_uid=1948, cgraph_uid=2,
symbol_order=1)
In function ‘bar’,
inlined from ‘baz’ at pr91235.c:14:5:
pr91235.c:7:14: warning: argument to variable-length array is too large
[-Wvla-larger-than=]
7 | char a[(int)(n == 2 ? -1 : 0)];
| ^
pr91235.c:7:14: note: limit is 9223372036854775807 bytes, but argument is
18446744073709551615
void baz ()
{
char[0:D.1971] * a.2;
void * saved_stack.3_2;
<bb 2> [local count: 1073741824]:
saved_stack.3_2 = __builtin_stack_save ();
a.2_3 = __builtin_alloca_with_align (18446744073709551615, 8); <<<
-Wvla-larger-than
foo (a.2_3);
__builtin_stack_restore (saved_stack.3_2);
return;
}
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-08-25 16:05 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-91235-4@http.gcc.gnu.org/bugzilla/>
2021-08-24 22:16 ` [Bug c++/91235] Array size expression is implicitly casted to unsigned long type pinskia at gcc dot gnu.org
2021-08-25 16:05 ` msebor at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).