public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/98539] New: incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array
@ 2021-01-05 16:06 muecker at gwdg dot de
2021-01-05 17:49 ` [Bug c/98539] " msebor at gcc dot gnu.org
2021-01-05 17:50 ` msebor at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: muecker at gwdg dot de @ 2021-01-05 16:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98539
Bug ID: 98539
Summary: incorrect warning with -Wvla-parameter for unspecified
bound in multi-dim array
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: muecker at gwdg dot de
Target Milestone: ---
For the following example:
void foo(int n, double x[3][*]);
void foo(int n, double x[3][n]) { }
I get the warning:
x.c:5:24: warning: argument 2 of type ‘double[3][n]’ declared as a variable
length array [-Wvla-parameter]
5 | void foo(int n, double x[3][n])
| ~~~~~~~^~~~~~~
x.c:3:24: note: previously declared as an ordinary array ‘double[3][0]’
3 | void foo(int n, double x[3][*]);
| ~~~~~~~^~~~~~~
This is incorrect, as the unspecified bound implies a variable length array and
not an ordinary array (6.7.6.2p4).
There is no warning for:
void foo(int n, double x[3][*]);
void foo(int n, double x[3][4]);
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/98539] incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array
2021-01-05 16:06 [Bug c/98539] New: incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array muecker at gwdg dot de
@ 2021-01-05 17:49 ` msebor at gcc dot gnu.org
2021-01-05 17:50 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-05 17:49 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98539
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |diagnostic
Last reconfirmed| |2021-01-05
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
CC| |msebor at gcc dot gnu.org
--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
The internal representation of [*] is the same as [0] so except in the most
significant bounds the warning can't distinguish between one and the other (see
pr98091). It has to pick one and it chooses to consider it a VLA. Let me
confirm this bug here and resolve pr98091 as a duplicate.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/98539] incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array
2021-01-05 16:06 [Bug c/98539] New: incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array muecker at gwdg dot de
2021-01-05 17:49 ` [Bug c/98539] " msebor at gcc dot gnu.org
@ 2021-01-05 17:50 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-01-05 17:50 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98539
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
*** Bug 98091 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-01-05 17:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-05 16:06 [Bug c/98539] New: incorrect warning with -Wvla-parameter for unspecified bound in multi-dim array muecker at gwdg dot de
2021-01-05 17:49 ` [Bug c/98539] " msebor at gcc dot gnu.org
2021-01-05 17:50 ` 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).