[Bug c/69768] [6 Regression] Bogus -Waddress warning

jakub at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Feb 11 13:05:00 GMT 2016


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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Seems this happens during parsing when the arguments are still not folded.
So, the question is what we want to achieve. 
static int e;
extern void __assert_fail ();
int foo ()
{
  ("Should not call this function" != (char *) ((void *)0))
      ? (void) (0) : __assert_fail ();
  ("Should not call this function" != (char *) ((void *)(10 - 10)))
      ? (void) (0) : __assert_fail ();
  ("Should not call this function" != (char *) ((void *)(&e - &e)))
      ? (void) (0) : __assert_fail ();
  return 0;
}
GCC 5 warns only in the last case.  Either calling integer_zerop on
tree_strip_nop_conversions (arg?.value) instead of arg?.value itself can be
enough, or we need to c_fully_fold it first.
And the warning is even for C++, so for C++ FE we need similar changes.


More information about the Gcc-bugs mailing list