* [Bug c/65673] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
@ 2015-04-17 7:09 ` mpolacek at gcc dot gnu.org
2015-04-17 13:03 ` mpolacek at gcc dot gnu.org
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-17 7:09 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2015-04-17
CC| |mpolacek at gcc dot gnu.org
Ever confirmed|0 |1
--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Confirmed. It seems weird to drop the initializer.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
2015-04-17 7:09 ` [Bug c/65673] " mpolacek at gcc dot gnu.org
@ 2015-04-17 13:03 ` mpolacek at gcc dot gnu.org
2022-01-03 20:34 ` [Bug c/65673] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-04-17 13:03 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
--- Comment #2 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
What happens here is that pop_init_level returns error_mark_node because
initializing a zero-length array member with {} is discarded:
7565 /* Silently discard empty initializations. The parser will
7566 already have pedwarned for empty brackets. */
7567 if (integer_zerop (constructor_unfilled_index))
7568 constructor_type = NULL_TREE;
thus ret.value is NULL:
7718 if (ret.value == 0 && constructor_stack == 0)
7719 ret.value = error_mark_node;
7720 return ret;
output_init_element then sees that value == error_mark_node, so it marks the
ctor as erroneous:
8388 if (type == error_mark_node || value == error_mark_node)
8389 {
8390 constructor_erroneous = 1;
8391 return;
8392 }
And because the ctor is erroneous, we don't build a CONSTRUCTOR for it:
7668 if (constructor_erroneous)
7669 ret.value = error_mark_node;
7670 else
7671 {
7672 ret.value = build_constructor (constructor_type,
7673 constructor_elements);
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [9/10/11/12 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
2015-04-17 7:09 ` [Bug c/65673] " mpolacek at gcc dot gnu.org
2015-04-17 13:03 ` mpolacek at gcc dot gnu.org
@ 2022-01-03 20:34 ` pinskia at gcc dot gnu.org
2022-01-17 15:19 ` rguenth at gcc dot gnu.org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-01-03 20:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Compound literal with |[9/10/11/12 Regression]
|initializer for zero-sized |Compound literal with
|array drops other |initializer for zero-sized
|initializers |array drops other
| |initializers
Known to work| |4.1.2
Known to fail| |4.4.7
Target Milestone|--- |9.5
Keywords| |wrong-code
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
GCC 4.1.2 produces:
foo:
.long 25
.zero 4
.quad __compound_literal.0
.local __compound_literal.0
.comm __compound_literal.0,0,8
While 4.4.7 (and above) produces:
foo:
.zero 16
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [9/10/11/12 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (2 preceding siblings ...)
2022-01-03 20:34 ` [Bug c/65673] [9/10/11/12 Regression] " pinskia at gcc dot gnu.org
@ 2022-01-17 15:19 ` rguenth at gcc dot gnu.org
2022-05-27 9:35 ` [Bug c/65673] [10/11/12/13 " rguenth at gcc dot gnu.org
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-01-17 15:19 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Priority|P3 |P2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [10/11/12/13 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (3 preceding siblings ...)
2022-01-17 15:19 ` rguenth at gcc dot gnu.org
@ 2022-05-27 9:35 ` rguenth at gcc dot gnu.org
2022-06-28 10:31 ` jakub at gcc dot gnu.org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27 9:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|9.5 |10.4
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [10/11/12/13 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (4 preceding siblings ...)
2022-05-27 9:35 ` [Bug c/65673] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:31 ` jakub at gcc dot gnu.org
2022-12-20 13:00 ` rguenth at gcc dot gnu.org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.4 |10.5
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [10/11/12/13 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (5 preceding siblings ...)
2022-06-28 10:31 ` jakub at gcc dot gnu.org
@ 2022-12-20 13:00 ` rguenth at gcc dot gnu.org
2023-01-31 1:29 ` luangruo at yahoo dot com
2023-07-07 10:30 ` [Bug c/65673] [11/12/13/14 " rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-20 13:00 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2015-04-17 00:00:00 |2022-12-20
CC| |mpolacek at gcc dot gnu.org
Known to fail| |13.0
--- Comment #8 from Richard Biener <rguenth at gcc dot gnu.org> ---
Another option would be to report an error for this? Anyway, re-confirmed.
Marek - you had a patch, any updates here?
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [10/11/12/13 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (6 preceding siblings ...)
2022-12-20 13:00 ` rguenth at gcc dot gnu.org
@ 2023-01-31 1:29 ` luangruo at yahoo dot com
2023-07-07 10:30 ` [Bug c/65673] [11/12/13/14 " rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: luangruo at yahoo dot com @ 2023-01-31 1:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Po Lu <luangruo at yahoo dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |luangruo at yahoo dot com
--- Comment #9 from Po Lu <luangruo at yahoo dot com> ---
This bug still exists, both in GCC 12.2 and trunk:
struct sfnt_generic_test_args
{
unsigned int *expected_stack;
int expected_stack_elements;
int expected_trap : 1;
int expected_IP;
};
struct sfnt_generic_test_args stack_underflow_test_args =
{
(unsigned int [0]) { },
0,
1,
4,
};
on:
Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-redhat-linux/12/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-redhat-linux
Configured with: ../configure --enable-bootstrap
--enable-languages=c,c++,fortran,objc,obj-c++,ada,go,d,lto --prefix=/usr
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared
--enable-threads=posix --enable-checking=release --enable-multilib
--with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions
--enable-gnu-unique-object --enable-linker-build-id
--with-gcc-major-version-only --enable-libstdcxx-backtrace
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array
--with-isl=/builddir/build/BUILD/gcc-12.2.1-20220819/obj-x86_64-redhat-linux/isl-install
--enable-offload-targets=nvptx-none --without-cuda-driver
--enable-offload-defaulted --enable-gnu-indirect-function --enable-cet
--with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
--with-build-config=bootstrap-lto --enable-link-serialization=1
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.2.1 20220819 (Red Hat 12.2.1-2) (GCC)
and
Using built-in specs.
COLLECT_GCC=/opt/compiler-explorer/gcc-snapshot/bin/gcc
Target: x86_64-linux-gnu
Configured with: ../gcc-trunk-20230129/configure
--prefix=/opt/compiler-explorer/gcc-build/staging --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=x86_64-linux-gnu --disable-bootstrap
--enable-multiarch --with-abi=m64 --with-multilib-list=m32,m64,mx32
--enable-multilib --enable-clocale=gnu
--enable-languages=c,c++,fortran,ada,objc,obj-c++,go,d,rust --enable-ld=yes
--enable-gold=yes --enable-libstdcxx-debug --enable-libstdcxx-time=yes
--enable-linker-build-id --enable-lto --enable-plugins --enable-threads=posix
--with-pkgversion=Compiler-Explorer-Build-gcc-ee2c965ee205ae12bc78d8641337380df3b1d3f3-binutils-2.38
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 13.0.1 20230129 (experimental)
(Compiler-Explorer-Build-gcc-ee2c965ee205ae12bc78d8641337380df3b1d3f3-binutils-2.38)
COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-S'
'-v' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/'
/opt/compiler-explorer/gcc-trunk-20230129/bin/../libexec/gcc/x86_64-linux-gnu/13.0.1/cc1
-quiet -v -imultiarch x86_64-linux-gnu -iprefix
/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/
<source> -quiet -dumpdir /app/ -dumpbase output.c -dumpbase-ext .c
-mtune=generic -march=x86-64 -g -version -fdiagnostics-color=always -o
/app/output.s
GNU C17
(Compiler-Explorer-Build-gcc-ee2c965ee205ae12bc78d8641337380df3b1d3f3-binutils-2.38)
version 13.0.1 20230129 (experimental) (x86_64-linux-gnu)
compiled by GNU C version 9.4.0, GMP version 6.2.1, MPFR version 4.1.0,
MPC version 1.2.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/../../../../x86_64-linux-gnu/include"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/13.0.1/include"
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/13.0.1/include-fixed/x86_64-linux-gnu"
ignoring duplicate directory
"/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/13.0.1/include-fixed"
ignoring nonexistent directory
"/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/../../lib/gcc/x86_64-linux-gnu/13.0.1/../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/include
/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/include-fixed/x86_64-linux-gnu
/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/include-fixed
/usr/local/include
/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/../../include
/usr/include/x86_64-linux-gnu
/usr/include
End of search list.
GNU C17
(Compiler-Explorer-Build-gcc-ee2c965ee205ae12bc78d8641337380df3b1d3f3-binutils-2.38)
version 13.0.1 20230129 (experimental) (x86_64-linux-gnu)
compiled by GNU C version 9.4.0, GMP version 6.2.1, MPFR version 4.1.0,
MPC version 1.2.1, isl version isl-0.24-GMP
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: ad17c4694b07a4272f6162e91fa92744
COMPILER_PATH=/opt/compiler-explorer/gcc-trunk-20230129/bin/../libexec/gcc/x86_64-linux-gnu/13.0.1/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../libexec/gcc/x86_64-linux-gnu/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../libexec/gcc/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/../../../../x86_64-linux-gnu/bin/
LIBRARY_PATH=/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/../../../../lib64/:/lib/x86_64-linux-gnu/:/lib/../lib64/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib64/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/../../../../x86_64-linux-gnu/lib/:/opt/compiler-explorer/gcc-trunk-20230129/bin/../lib/gcc/x86_64-linux-gnu/13.0.1/../../../:/lib/:/usr/lib/
COLLECT_GCC_OPTIONS='-fdiagnostics-color=always' '-g' '-o' '/app/output.s' '-S'
'-v' '-mtune=generic' '-march=x86-64' '-dumpdir' '/app/output.'
Compiler returned: 0
results in the structure being generated as a .zero section of size 24,
while it should really be:
.quad <address of compound literal array of size 0>
.long 0
.byte 1
.zero 3
.long 4
.zero 4
I hope it can be fixed, because this is causing real problems for Emacs.
Thanks in advance.
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug c/65673] [11/12/13/14 Regression] Compound literal with initializer for zero-sized array drops other initializers
2015-04-05 6:42 [Bug c/65673] New: Compound literal with initializer for zero-sized array drops other initializers stilor at att dot net
` (7 preceding siblings ...)
2023-01-31 1:29 ` luangruo at yahoo dot com
@ 2023-07-07 10:30 ` rguenth at gcc dot gnu.org
8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:30 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65673
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|10.5 |11.5
--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.
^ permalink raw reply [flat|nested] 10+ messages in thread