public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca
@ 2021-05-10 19:37 msebor at gcc dot gnu.org
  2021-05-10 19:40 ` [Bug tree-optimization/100510] " msebor at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-10 19:37 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100510
           Summary: bogus -Wvla-large-than with -Walloca
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: msebor at gcc dot gnu.org
  Target Milestone: ---

The VLA below is at most 32 bytes large but with both -Walloca and
-Wvla-larger-than= GCC issues a -Wvla-larger-than false positive, both with and
without optimization.

$ cat a.c && gcc -Walloca  -S -Wvla-larger-than=1000 a.c
void f (void*);

void g (__SIZE_TYPE__ n)
{
  if (n > 32)
    return;

  char a[n];
  f (a);
}

a.c: In function ‘g’:
a.c:8:8: warning: unbounded use of variable-length array [-Wvla-larger-than=]
    8 |   char a[n];
      |        ^

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/100510] bogus -Wvla-large-than with -Walloca
  2021-05-10 19:37 [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca msebor at gcc dot gnu.org
@ 2021-05-10 19:40 ` msebor at gcc dot gnu.org
  2021-05-10 20:03 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-10 19:40 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |msebor at gcc dot gnu.org
     Ever confirmed|0                           |1
         Depends on|                            |100425
   Last reconfirmed|                            |2021-05-10
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The patch for pr100425 also fixes this.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100425
[Bug 100425] missing -Walloca-larger-than with -O0

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/100510] bogus -Wvla-large-than with -Walloca
  2021-05-10 19:37 [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca msebor at gcc dot gnu.org
  2021-05-10 19:40 ` [Bug tree-optimization/100510] " msebor at gcc dot gnu.org
@ 2021-05-10 20:03 ` cvs-commit at gcc dot gnu.org
  2021-05-10 20:05 ` msebor at gcc dot gnu.org
  2021-05-10 20:06 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-10 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Sebor <msebor@gcc.gnu.org>:

https://gcc.gnu.org/g:f974b54b8a0c330e9dd2b43ebc940100d601df0f

commit r12-690-gf974b54b8a0c330e9dd2b43ebc940100d601df0f
Author: Martin Sebor <msebor@redhat.com>
Date:   Mon May 10 14:00:04 2021 -0600

    Avoid -Walloca-larger-than and -Wvla-larger-than false postives and
negatives.

    Resolves:
    PR middle-end/100425 - missing -Walloca-larger-than with -O0
    PR middle-end/100510 - bogus -Wvla-large-than with -Walloca

    gcc/ChangeLog:

            PR middle-end/100425
            PR middle-end/100510
            * gimple-ssa-warn-alloca.c (pass_walloca::firast_time_p): Rename...
            (pass_walloca::xlimit_certain_p): ...to this.
            (pass_walloca::gate): Execute for any kind of handled warning.
            (pass_walloca::execute): Avoid issuing "maybe" and "unbounded"
            warnings when xlimit_certain_p is set.

    gcc/testsuite/ChangeLog:

            PR middle-end/100425
            PR middle-end/100510
            * c-c++-common/Walloca-larger-than.C: New test.
            * gcc.dg/Walloca-larger-than-4.c: New test.
            * gcc.dg/Wvla-larger-than-5.c: New test.
            * gcc.dg/pr79972.c: Remove unexpected warning directive.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/100510] bogus -Wvla-large-than with -Walloca
  2021-05-10 19:37 [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca msebor at gcc dot gnu.org
  2021-05-10 19:40 ` [Bug tree-optimization/100510] " msebor at gcc dot gnu.org
  2021-05-10 20:03 ` cvs-commit at gcc dot gnu.org
@ 2021-05-10 20:05 ` msebor at gcc dot gnu.org
  2021-05-10 20:06 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-10 20:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100510
Bug 100510 depends on bug 100425, which changed state.

Bug 100425 Summary: missing -Walloca-larger-than with -O0
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100425

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug tree-optimization/100510] bogus -Wvla-large-than with -Walloca
  2021-05-10 19:37 [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca msebor at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-05-10 20:05 ` msebor at gcc dot gnu.org
@ 2021-05-10 20:06 ` msebor at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-05-10 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
           Keywords|                            |diagnostic
         Resolution|---                         |FIXED

--- Comment #3 from Martin Sebor <msebor at gcc dot gnu.org> ---
Patch committed in r12-690.

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-10 20:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-10 19:37 [Bug tree-optimization/100510] New: bogus -Wvla-large-than with -Walloca msebor at gcc dot gnu.org
2021-05-10 19:40 ` [Bug tree-optimization/100510] " msebor at gcc dot gnu.org
2021-05-10 20:03 ` cvs-commit at gcc dot gnu.org
2021-05-10 20:05 ` msebor at gcc dot gnu.org
2021-05-10 20:06 ` 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).