[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190712.175038.755685144649934618.davem@davemloft.net>
Date: Fri, 12 Jul 2019 17:50:38 -0700 (PDT)
From: David Miller <davem@...emloft.net>
To: cai@....pw
Cc: sathya.perla@...adcom.com, ajit.khaparde@...adcom.com,
sriharsha.basavapatna@...adcom.com, somnath.kotur@...adcom.com,
arnd@...db.de, dhowells@...hat.com, hpa@...or.com,
netdev@...r.kernel.org, linux-arch@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] be2net: fix adapter->big_page_size miscaculation
From: Qian Cai <cai@....pw>
Date: Fri, 12 Jul 2019 20:27:09 -0400
> Actually, GCC would consider it a const with -O2 optimized level because it found that it was never modified and it does not understand it is a module parameter. Considering the following code.
>
> # cat const.c
> #include <stdio.h>
>
> static int a = 1;
>
> int main(void)
> {
> if (__builtin_constant_p(a))
> printf("a is a const.\n");
>
> return 0;
> }
>
> # gcc -O2 const.c -o const
That's not a complete test case, and with a proper test case that
shows the externalization of the address of &a done by the module
parameter macros, gcc should not make this optimization or we should
define the module parameter macros in a way that makes this properly
clear to the compiler.
It makes no sense to hack around this locally in drivers and other
modules.
Thank you.
Powered by blists - more mailing lists