serge-sans-paille/frozen

GCC 9.1.1 strict-overflow warnings

invexed opened this issue · 6 comments

GCC warns when enabling -Wstrict-overflow=n for n > 1. Some of the warnings can be suppressed with #pragmas, but others can't as they are triggered at the call site during constexpr expansion.

[build] .../frozen-master/include/frozen/bits/pmh.h:174:8: error: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]
[build]   174 |   auto buckets = step_one.get_sorted_buckets();
[build]       |        ^~~~~~~
[build] .../frozen-master/include/frozen/bits/pmh.h:228:1: error: assuming pointer wraparound does not occur when comparing P +- C1 with P +- C2 [-Werror=strict-overflow]
[build]   228 | }
[build]       | ^

Thanks for reporting! Can you share the full error log?

Sure, please see attached file. Thanks for the quick response.

compilation_log.txt

The call site is:

constexpr auto x = frozen::unordered_map<int, int, 1>{ {0, 0} };

Thanks! I can reproduce :-)

@invexed can you confirm the patch is good on your side?

Sorry, I didn't get notified about the PR. Yeah I can confirm that this patch fixes things on my end. Thanks again.