From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B7E343860C3D; Wed, 14 Jul 2021 09:46:38 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B7E343860C3D From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/101446] -Wpedantic causes an error with zero size array Date: Wed, 14 Jul 2021 09:46:38 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 11.1.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status cc resolution everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Jul 2021 09:46:38 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D101446 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2021-07-14 Status|RESOLVED |NEW CC| |jsm28 at gcc dot gnu.org Resolution|INVALID |--- Ever confirmed|0 |1 --- Comment #5 from Richard Biener --- OK, so the complaint is that > ./cc1 -quiet t.c -pedantic t.c:1:47: warning: ISO C forbids empty initializer braces [-Wpedantic] 1 | static const char __gbk_from_ucs4_tab9[][2] =3D {}; | ^ t.c:1:19: error: zero or negative size array '__gbk_from_ucs4_tab9' 1 | static const char __gbk_from_ucs4_tab9[][2] =3D {}; | ^~~~~~~~~~~~~~~~~~~~ errors and not only -pedantic-errors > ./cc1 -quiet t.c -pedantic-errors t.c:1:47: error: ISO C forbids empty initializer braces [-Wpedantic] 1 | static const char __gbk_from_ucs4_tab9[][2] =3D {}; | ^ t.c:1:19: error: zero or negative size array '__gbk_from_ucs4_tab9' 1 | static const char __gbk_from_ucs4_tab9[][2] =3D {}; | ^~~~~~~~~~~~~~~~~~~~ -Wpedantic is just an alias for -pedantic - but see the documentation which explicitely says some constructs are rejected (not only warned on). -pedantic-errors says @item -pedantic-errors @opindex pedantic-errors Give an error whenever the @dfn{base standard} (see @option{-Wpedantic}) requires a diagnostic, in some cases where there is undefined behavior at compile-time and in some other cases that do not prevent compilation of programs that are valid according to the standard. This is not equivalent to @option{-Werror=3Dpedantic}, since there are errors enabled by this option and not enabled by the latter and vice versa. so I still think it works as designed even if the new -Wpedantic alias suggests that -pedantic is a pure warning option.=