public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/99420] New: New warning -Warray-parameter
@ 2021-03-05 20:06 raj.khem at gmail dot com
  2021-03-07  0:19 ` [Bug c/99420] " egallager at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: raj.khem at gmail dot com @ 2021-03-05 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2021-04-15 21:52 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 20:06 [Bug c/99420] New: New warning -Warray-parameter raj.khem at gmail dot com
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

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).