[Bug c/105628] False positive with -Waddress

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 17 12:44:26 GMT 2022


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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The warning is correct but it should not be done.

Simpele testcase:
struct s{ int f; };
int g(struct s t){
  return (t.f?&t.f : 0)? 1 : 0;
}

The problem is gcc did some optimizations before the warning and pushed the
implicit != 0 into each arm of the ?; operator


More information about the Gcc-bugs mailing list