public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109970] New: -Wstringop-overflow should work with parameter forward declarations
@ 2023-05-25 20:01 muecker at gwdg dot de
  2023-05-26 21:31 ` [Bug c/109970] " cvs-commit at gcc dot gnu.org
  2023-11-03 20:05 ` uecker at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: muecker at gwdg dot de @ 2023-05-25 20:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109970
           Summary: -Wstringop-overflow should work with parameter forward
                    declarations
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

For bar I get the expected warning but not for foo.

void bar(int x, char buf[x]);
void foo(int x; char buf[x], int x);

int main()
{
    char buf[10];
    bar(11, buf);
    foo(buf, 11);
}

https://godbolt.org/z/zhzr43c55

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

* [Bug c/109970] -Wstringop-overflow should work with parameter forward declarations
  2023-05-25 20:01 [Bug c/109970] New: -Wstringop-overflow should work with parameter forward declarations muecker at gwdg dot de
@ 2023-05-26 21:31 ` cvs-commit at gcc dot gnu.org
  2023-11-03 20:05 ` uecker at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-05-26 21:31 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:8d6bd830f5f9c939e8565c0341a0c6c588834484

commit r14-1304-g8d6bd830f5f9c939e8565c0341a0c6c588834484
Author: Martin Uecker <uecker@tugraz.at>
Date:   Fri May 26 11:19:01 2023 +0200

    c: -Wstringop-overflow for parameters with forward-declared sizes

    Warnings from -Wstringop-overflow do not appear for parameters declared
    as VLAs when the bound refers to a parameter forward declaration. This
    is fixed by splitting the loop that passes through parameters into two,
    first only recording the positions of all possible size expressions
    and then processing the parameters.

    PR c/109970

    gcc/c-family:

            * c-attribs.cc (build_attr_access_from_parms): Split loop to first
            record all parameters.

    gcc/testsuite:

            * gcc.dg/pr109970.c: New test.

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

* [Bug c/109970] -Wstringop-overflow should work with parameter forward declarations
  2023-05-25 20:01 [Bug c/109970] New: -Wstringop-overflow should work with parameter forward declarations muecker at gwdg dot de
  2023-05-26 21:31 ` [Bug c/109970] " cvs-commit at gcc dot gnu.org
@ 2023-11-03 20:05 ` uecker at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: uecker at gcc dot gnu.org @ 2023-11-03 20:05 UTC (permalink / raw)
  To: gcc-bugs

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

uecker at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.0
                 CC|                            |uecker at gcc dot gnu.org
         Resolution|---                         |FIXED
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #2 from uecker at gcc dot gnu.org ---
fixed on trunk.

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

end of thread, other threads:[~2023-11-03 20:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 20:01 [Bug c/109970] New: -Wstringop-overflow should work with parameter forward declarations muecker at gwdg dot de
2023-05-26 21:31 ` [Bug c/109970] " cvs-commit at gcc dot gnu.org
2023-11-03 20:05 ` uecker 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).