Hi Morimoto-san,
On Wed, May 17, 2017 at 9:38 AM, Kuninori Morimoto kuninori.morimoto.gx@renesas.com wrote:
Hmm.... I tried random code/compile, but gcc behavior seems strange. Fore example if I removed next line, this warning disappeard
data = path[rsnd_mod_id(src)] |
cmd_case[rsnd_mod_id(src)] << 16;
data = path[rsnd_mod_id(src)];
Is this related to this ? https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59124
Perhaps.
I guess the main question is: can src be NULL here? If yes, rsnd_mod_id(src) will be -1.
No. cmd itself will not be used if src was NULL on this HW.
But gcc cannot know that, as the function is called through a function pointer from another source file.
But, yes, it seems gcc is checking -1 value here. It is OK, but why it warns only here ??
Yes, I'm also wondering why we see the warning only here. I guess we should be lucky that we get it at least in one place ;-)
Gr{oetje,eeting}s,
Geert
-- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds