https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82963
Manuel López-Ibáñez <manu at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |manu at gcc dot gnu.org Resolution|--- |INVALID --- Comment #2 from Manuel López-Ibáñez <manu at gcc dot gnu.org> --- (In reply to Michal Hocko from comment #0) > While the warning is correct and the given mask will always resolve to the > success path of the ternary operator I really fail to see why we should warn > about this fact. I really do not see any potential problem which could be > caused by this fact. The source code says: c-common.c-3292- /* Common Ada/Pascal programmer's mistake. */ c-common.c-3293- warning_at (location, c-common.c-3294- OPT_Waddress, c-common.c:3295: "the address of %qD will always evaluate as %<true%>", The work-around you found is probably the intended work-around. It would be good to document this. Care to send a patch? https://gcc.gnu.org/contribute.html#docchanges > Moreover the warning itself is quite inconsistent. E.g. the following warns > about the explicit &m but not for n. So I believe this is more of a > suboptimal warning implementation than real intention. This is because the warning is given in the front-end, which does not know the value of n. Not that it matters much, this is really trying to catch a typo, not the actual value of a pointer.