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

Arnd Bergmann <arnd at linaro dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |arnd at linaro dot org

--- Comment #4 from Arnd Bergmann <arnd at linaro dot org> ---
(In reply to Michal Hocko from comment #1)
> Btw. the compiler doesn't complain if I rewrite the macro to do an explicit
> NULL check
> (maskp != NULL) ? MAX_NUMNODES : 0, (maskp != NULL) ? (maskp)->bits : NULL

As it turned out, that workaround only worked for gcc-7 and higher, as well as
gcc-4.5 and lower. Anything in-between now prints a variation of "warning: the
comparison will always evaluate as ‘true’ for the address of ‘nodes’ will never
be NULL". I just sent another workaround to move the comparison into an inline
function, which should always work.

It appears that at some point during the gcc-7 development, the "comparison
will always evaluate as 'true'" logic was turned off for comparisons inside of
macros, while the "the address of 'nodes' will always evaluate as 'true'" check
did not get changed the same way.

Reply via email to