public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "raj.khem at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/99420] New: New warning -Warray-parameter
Date: Fri, 05 Mar 2021 20:06:35 +0000	[thread overview]
Message-ID: <bug-99420-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 99420
           Summary: New warning -Warray-parameter
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: raj.khem at gmail dot com
  Target Milestone: ---

Following code (reduced from nss ) exhibits new warning with gcc11 on x86_64,
this doe s not happen when both these externs are in one function e.g. foo(),
its an expansion of PR_STATIC_ASSERT from nspr headers 

#define PR_STATIC_ASSERT(condition) \
    extern void pr_static_assert(int arg[(condition) ? 1 : -1])

my gcc version is

gcc version 11.0.1 20210303 (experimental) (GCC) 

a.c
==========================
void foo()
{
    unsigned char bytes[(440 / 8) * 2];
    extern void pr_static_assert(int arg[(sizeof(bytes) >= 32) ? 1 : -1]);
}
void bar()
{
    extern void pr_static_assert(int arg[(((long unsigned int)-1) > (long
unsigned int)1) ? 1 : -1]);
}

===========================

$ x86_64-yoe-linux-musl-gcc -c a.c -Werror=array-parameter=2

a.c: In function 'bar':
a.c:8:38: error: argument 1 of type 'int[1]' with mismatched bound
[-Werror=array-parameter=]
    8 |     extern void pr_static_assert(int arg[(((long unsigned int)-1) >
(long unsigned int)1) ? 1 : -1]);
      |                                 
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.c:4:38: note: previously declared as 'int *'
    4 |     extern void pr_static_assert(int arg[(sizeof(bytes) >= 32) ? 1 :
-1]);
      |                                 
~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors

             reply	other threads:[~2021-03-05 20:06 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-05 20:06 raj.khem at gmail dot com [this message]
2021-03-07  0:19 ` [Bug c/99420] " egallager at gcc dot gnu.org
2021-03-08  9:25 ` marxin at gcc dot gnu.org
2021-03-08 17:34 ` msebor at gcc dot gnu.org
2021-03-16 11:52 ` [Bug c/99420] [11 Regression] bogus -Warray-parameter on a function redeclaration in function scope rguenth at gcc dot gnu.org
2021-04-08 12:56 ` rguenth at gcc dot gnu.org
2021-04-08 16:32 ` jakub at gcc dot gnu.org
2021-04-08 16:48 ` msebor at gcc dot gnu.org
2021-04-08 22:17 ` msebor at gcc dot gnu.org
2021-04-15 21:51 ` cvs-commit at gcc dot gnu.org
2021-04-15 21:52 ` msebor 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-99420-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).