public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/91235] Array size expression is implicitly casted to unsigned long type Date: Wed, 25 Aug 2021 16:05:24 +0000 [thread overview] Message-ID: <bug-91235-4-KFnO4tSznT@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-91235-4@http.gcc.gnu.org/bugzilla/> 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; }
prev parent reply other threads:[~2021-08-25 16:05 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top [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 [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-91235-4-KFnO4tSznT@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).