[Bug c/92286] Possible improvement for -Wduplicated-cond warning

marxin at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Oct 11 08:54:27 GMT 2022


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

--- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> ---
> trunk.git/libsanitizer/sanitizer_common/sanitizer_allocator_primary64.h:547:
> 27: style: Expression is always true because 'else if' condition is opposite
> to previous condition at line 538. [multiCondition]

This one is correct, but the code assumes there's no fallback edge:

...
    } else if (chunk_size > page_size) {
      // One chunk covers multiple pages, Some chunks are crossing page
      // boundaries. Some pages contain one chunk, some contain two.
      full_pages_chunk_count_max = 2;
      same_chunk_count_per_page = false;
    } else {
      UNREACHABLE("All chunk_size/page_size ratios must be handled.");
    }

Thus I'm going to leave it.


More information about the Gcc-bugs mailing list