public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ismail at i10z dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101446] New: -Wpedantic causes an error with zero size array
Date: Wed, 14 Jul 2021 08:26:11 +0000	[thread overview]
Message-ID: <bug-101446-4@http.gcc.gnu.org/bugzilla/> (raw)

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101446

            Bug ID: 101446
           Summary: -Wpedantic causes an error with zero size array
           Product: gcc
           Version: 11.1.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ismail at i10z dot com
  Target Milestone: ---

The test-case minimized but originally from glibc:

; cat gbk.c                                                                     
static const char __gbk_from_ucs4_tab9[][2] =
{
};

; gcc -c gbk.c                                                                  
; gcc -c -Wpedantic gbk.c                                                       
gbk.c:2:1: warning: ISO C forbids empty initializer braces [-Wpedantic]
    2 | {
      | ^
gbk.c:1:19: error: zero or negative size array ‘__gbk_from_ucs4_tab9’
    1 | static const char __gbk_from_ucs4_tab9[][2] =
      |                   ^~~~~~~~~~~~~~~~~~~~
; gcc -v                                                                       
                                  (base) 
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib64/gcc/x86_64-suse-linux/11/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none:amdgcn-amdhsa
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-suse-linux
Configured with: ../configure --prefix=/usr --infodir=/usr/share/info
--mandir=/usr/share/man --libdir=/usr/lib64 --libexecdir=/usr/lib64
--enable-languages=c,c++,objc,fortran,obj-c++,ada,go,d,jit
--enable-offload-targets=nvptx-none,amdgcn-amdhsa, --without-cuda-driver
--enable-host-shared --enable-checking=release --disable-werror
--with-gxx-include-dir=/usr/include/c++/11 --enable-ssp --disable-libssp
--disable-libvtv --enable-cet=auto --disable-libcc1 --enable-plugin
--with-bugurl=https://bugs.opensuse.org/ --with-pkgversion='SUSE Linux'
--with-slibdir=/lib64 --with-system-zlib --enable-libstdcxx-allocator=new
--disable-libstdcxx-pch --enable-libphobos
--enable-version-specific-runtime-libs --with-gcc-major-version-only
--enable-linker-build-id --enable-linux-futex --enable-gnu-indirect-function
--program-suffix=-11 --without-system-libunwind --enable-multilib
--with-arch-32=x86-64 --with-tune=generic
--with-build-config=bootstrap-lto-lean --enable-link-mutex
--build=x86_64-suse-linux --host=x86_64-suse-linux
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.1.1 20210625 [revision 62bbb113ae68a7e724255e17143520735bcb9ec9]
(SUSE Linux)

I believe no warning flag should result in an error.

             reply	other threads:[~2021-07-14  8:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  8:26 ismail at i10z dot com [this message]
2021-07-14  9:35 ` [Bug c/101446] " redi at gcc dot gnu.org
2021-07-14  9:40 ` rguenth at gcc dot gnu.org
2021-07-14  9:42 ` ismail at i10z dot com
2021-07-14  9:42 ` rguenth at gcc dot gnu.org
2021-07-14  9:46 ` rguenth at gcc dot gnu.org
2021-07-14  9:47 ` ismail at i10z dot com
2021-07-14 10:25 ` ismail at i10z dot com
2021-07-14 15:21 ` joseph at codesourcery dot com

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-101446-4@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).