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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The thing is that -fsanitize=null (and a couple of other sanitizers) imply
-fno-delete-null-pointer-checks, as it doesn't want all the checks it adds
removed and fold obviously doesn't fold &var != NULL with
-fno-delete-null-pointer-checks.
The testcase fails the same with -fno-delete-null-pointer-checks instead of
-fsanitize=undefined.

Not sure what can be done here though?  Either change all places that check
flag_delete_null_pointer_checks to use some complex predicate and not change
flag_delete_null_pointer_checks in
  if (opts->x_flag_sanitize & (SANITIZE_NULL | SANITIZE_NONNULL_ATTRIBUTE
                                | SANITIZE_RETURNS_NONNULL_ATTRIBUTE))
    opts->x_flag_delete_null_pointer_checks = 0;
and during constexpr evaluation temporarily clear flag_sanitize, or something
similar.

Reply via email to