From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7AF9F385DC12; Wed, 1 Apr 2020 07:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7AF9F385DC12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1585725836; bh=FYikpu+R3ql5inrU2R1ytp2wHSV7EDRendrVVQ2YZdE=; h=From:To:Subject:Date:From; b=ckKndyoX9n/vLhzCc3eqLSoUEuK00GcDhLmz4GWX9qCK4mb2oyEQe87MmxC1STIw1 gWm7BOFVt0qoKJUprFcQyBZdFCAUIti21Qo1/swni53UrIVPbsxJUqczSPlXNNPHDN HFPohQLO9fsO0NiTROyWZWObWkmxgLOTK+AhQJ2g= From: "kees at outflux dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/94428] New: Reintroduce -Wzero-length-array Date: Wed, 01 Apr 2020 07:23:56 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: kees at outflux dot net X-Bugzilla-Status: UNCONFIRMED 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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, 01 Apr 2020 07:23:56 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D94428 Bug ID: 94428 Summary: Reintroduce -Wzero-length-array Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: kees at outflux dot net Target Milestone: --- It would be nice to gain "-Wzero-length-array" so we can enforce this stand= ard in the Linux kernel once all conversions have moved struct to flexible array members. Clang supports this as a distinct warning, but gcc currently only warns about this under "-pedantic -std=3Dc99", which is not a workable combination for Linux. ;) $ clang -Wzero-length-array -o bounds-clang bounds.c bounds.c:20:15: warning: zero size arrays are an extension [-Wzero-length-array] char data[0]; ^ $ gcc -Wzero-length-array -o bounds-gcc bounds.c gcc: error: unrecognized command line option =E2=80=98-Wzero-length-array= =E2=80=99 $ gcc -pedantic -std=3Dc99 -o bounds-gcc bounds.c bounds.c:20:10: warning: ISO C forbids zero-size array =E2=80=98data=E2=80= =99 [-Wpedantic] 20 | char data[0]; | ^~~~=