public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99736] New: Statement expression (gcc extension) cannot return struct with variable length array
@ 2021-03-23 19:26 tunagul29 at icloud dot com
2021-03-23 19:32 ` [Bug c/99736] Statement expression (gcc extension) cannot return struct (with variable length array) object tunagul29 at icloud dot com
2021-03-23 19:33 ` [Bug middle-end/99736] Statement expression (gcc extension) cannot return struct with variable length array pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: tunagul29 at icloud dot com @ 2021-03-23 19:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99736
Bug ID: 99736
Summary: Statement expression (gcc extension) cannot return
struct with variable length array
Product: gcc
Version: 9.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: tunagul29 at icloud dot com
Target Milestone: ---
Created attachment 50463
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=50463&action=edit
C file which contains the bug
Statement Expressions cannot return an anonymous struct with variable length
array object. I attached the file but here is the bug:
"""
int main() {
({
unsigned int length = 10;
struct {
int array[length];
} new_object;
new_object;
});
}
"""
I conpiled it with mingcw and gcc 9.3 on wsl, both failed.
I am using gcc 9.3.0 wich gives the output:
"""
test2.c: In function ‘main’:
test2.c:7:3: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.c:2755
7 | ({
| ~^
8 | unsigned int length = foo();
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 | struct {
| ~~~~~~~~
10 | int array[length];
| ~~~~~~~~~~~~~~~~~~
11 | } new_object;
| ~~~~~~~~~~~~~
12 | new_object;
| ~~~~~~~~~~~
13 | });
| ~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
"""
with -Wall and -Wextra flags.
gcc -v output:
"""
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:hsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu
9.3.0-17ubuntu1~20.04' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs
--enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr
--with-gcc-major-version-only --program-suffix=-9
--program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new
--enable-gnu-unique-object --disable-vtable-verify --enable-plugin
--enable-default-pie --with-system-zlib --with-target-system-zlib=auto
--enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib
--with-tune=generic
--enable-offload-targets=nvptx-none=/build/gcc-9-HskZEa/gcc-9-9.3.0/debian/tmp-nvptx/usr,hsa
--without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 9.3.0 (Ubuntu 9.3.0-17ubuntu1~20.04)
"""
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c/99736] Statement expression (gcc extension) cannot return struct (with variable length array) object
2021-03-23 19:26 [Bug c/99736] New: Statement expression (gcc extension) cannot return struct with variable length array tunagul29 at icloud dot com
@ 2021-03-23 19:32 ` tunagul29 at icloud dot com
2021-03-23 19:33 ` [Bug middle-end/99736] Statement expression (gcc extension) cannot return struct with variable length array pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: tunagul29 at icloud dot com @ 2021-03-23 19:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99736
--- Comment #1 from Tuna Gül <tunagul29 at icloud dot com> ---
Sorry for wrong compiler output
This should be the compiler output
(I dont know how to edit the original description)
"""
test.c: In function ‘main’:
test.c:2:3: internal compiler error: in gimplify_var_or_parm_decl, at
gimplify.c:2755
2 | ({
| ~^
3 | unsigned int length = 10;
| ~~~~~~~~~~~~~~~~~~~~~~~~~
4 | struct {
| ~~~~~~~~
5 | int array[length];
| ~~~~~~~~~~~~~~~~~~
6 | } new_object;
| ~~~~~~~~~~~~~
7 | new_object;
| ~~~~~~~~~~~
8 | });
| ~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-9/README.Bugs> for instructions.
"""
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug middle-end/99736] Statement expression (gcc extension) cannot return struct with variable length array
2021-03-23 19:26 [Bug c/99736] New: Statement expression (gcc extension) cannot return struct with variable length array tunagul29 at icloud dot com
2021-03-23 19:32 ` [Bug c/99736] Statement expression (gcc extension) cannot return struct (with variable length array) object tunagul29 at icloud dot com
@ 2021-03-23 19:33 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-03-23 19:33 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99736
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |DUPLICATE
Summary|Statement expression (gcc |Statement expression (gcc
|extension) cannot return |extension) cannot return
|struct (with variable |struct with variable length
|length array) object |array
Keywords| |ice-on-valid-code
Component|c |middle-end
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 29970.
*** This bug has been marked as a duplicate of bug 29970 ***
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-03-23 19:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-23 19:26 [Bug c/99736] New: Statement expression (gcc extension) cannot return struct with variable length array tunagul29 at icloud dot com
2021-03-23 19:32 ` [Bug c/99736] Statement expression (gcc extension) cannot return struct (with variable length array) object tunagul29 at icloud dot com
2021-03-23 19:33 ` [Bug middle-end/99736] Statement expression (gcc extension) cannot return struct with variable length array 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).