public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/95993] New: the error of multi-array init in gcc 10.1
@ 2020-06-30 20:26 webrown.cpp at gmail dot com
2020-07-01 0:11 ` [Bug c++/95993] the error of VLA " pinskia at gcc dot gnu.org
2020-07-01 0:23 ` msebor at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: webrown.cpp at gmail dot com @ 2020-06-30 20:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95993
Bug ID: 95993
Summary: the error of multi-array init in gcc 10.1
Product: gcc
Version: 10.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: chengcongxiu at huawei dot com
CC: webrown.cpp at gmail dot com
Target Milestone: ---
CC: webrown.cpp at gmail dot com
the main2.cpp as follow:
#include <iostream>
using namespace std;
void FuncA(int arg1, int arg2)
{
int i = 0, j = 0;
unsigned char noConst = 2;
const unsigned char index1 = 16;
const unsigned char index2 = noConst;
unsigned char temp3[index1][index2] = { 0 };
for(i = 0; i < index1; i++) {
for(j = 0; j < index2; j++) {
printf("%d\t", temp3[i][j]);
}
printf("\n");
}
}
int main()
{
FuncA(0, 0);
return 0;
}
./arm64be/bin/aarch64_be-linux-gnu-g++ main2.cpp -static -o app
./app0
the result is:
0 0
0 83
65 24
0 0
0 0
0 1
28 0
0 0
0 64
0 128
3 232
0 0
0 64
0 128
3 248
everyone know what's wrong? is the internal error of gcc?
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95993] the error of VLA multi-array init in gcc 10.1
2020-06-30 20:26 [Bug c++/95993] New: the error of multi-array init in gcc 10.1 webrown.cpp at gmail dot com
@ 2020-07-01 0:11 ` pinskia at gcc dot gnu.org
2020-07-01 0:23 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-07-01 0:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95993
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
This is using an GNU extension because VLAs are not part of C++ standard.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/95993] the error of VLA multi-array init in gcc 10.1
2020-06-30 20:26 [Bug c++/95993] New: the error of multi-array init in gcc 10.1 webrown.cpp at gmail dot com
2020-07-01 0:11 ` [Bug c++/95993] the error of VLA " pinskia at gcc dot gnu.org
@ 2020-07-01 0:23 ` msebor at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-01 0:23 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95993
Martin Sebor <msebor at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |DUPLICATE
Status|UNCONFIRMED |RESOLVED
CC| |msebor at gcc dot gnu.org
Keywords| |wrong-code
--- Comment #2 from Martin Sebor <msebor at gcc dot gnu.org> ---
This is due to a bug in the initialization of multidimensional VLAs. Either
such initialization should be corrected or rejected with an error. The bug is
being tracked in pr70075.
*** This bug has been marked as a duplicate of bug 70075 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-07-01 0:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-30 20:26 [Bug c++/95993] New: the error of multi-array init in gcc 10.1 webrown.cpp at gmail dot com
2020-07-01 0:11 ` [Bug c++/95993] the error of VLA " pinskia at gcc dot gnu.org
2020-07-01 0:23 ` 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).