public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "luangruo at yahoo dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/65673] [10/11/12/13 Regression] Compound literal with initializer for zero-sized array drops other initializers
Date: Tue, 31 Jan 2023 01:29:20 +0000	[thread overview]
Message-ID: <bug-65673-4-FtHoYyHPNa@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-65673-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2023-01-31  1:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-05  6:42 [Bug c/65673] New: " 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
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
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 [this message]
2023-07-07 10:30 ` [Bug c/65673] [11/12/13/14 " rguenth at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-65673-4-FtHoYyHPNa@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).