public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/109775] New: gcc misidentifies a VLA
@ 2023-05-08 16:07 janezz55 at gmail dot com
  2023-05-08 16:13 ` [Bug c++/109775] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: janezz55 at gmail dot com @ 2023-05-08 16:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109775
           Summary: gcc misidentifies a VLA
           Product: gcc
           Version: 13.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: janezz55 at gmail dot com
  Target Milestone: ---

If I compile the example .cpp file:

gcc -std=c++20 -Wextra -Wall -Wpedantic add_sub_tests.cpp -o a

gcc produces the warning:

../intt.hpp: In member function 'constexpr auto intt::intt<
<template-parameter-1-1>, N, <anonymous> >::naimul(const intt::intt<
<template-parameter-1-1>, N, <anonymous> >&) const':
../intt.hpp:675:24: warning: ISO C++ forbids variable length array 'v_' [-Wvla]
  675 |           D const pp(D(v_[i]) * o.v_[S - i]);
      |                        ^~

But no VLA is involved and clang++ 15 manages to avoid this issue.

The example file is here:

https://github.com/user1095108/intt/blob/master/tests/add_sub_tests.cpp

I believe the bug was present in prior versions of gcc as well.

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

end of thread, other threads:[~2023-05-08 16:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-08 16:07 [Bug c++/109775] New: gcc misidentifies a VLA janezz55 at gmail dot com
2023-05-08 16:13 ` [Bug c++/109775] " pinskia at gcc dot gnu.org
2023-05-08 16:17 ` pinskia at gcc dot gnu.org
2023-05-08 16:46 ` pinskia at gcc dot gnu.org
2023-05-08 16:48 ` pinskia at gcc dot gnu.org
2023-05-08 16:49 ` pinskia 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).