Summary: | -Wstrict-aliasing in tests | ||
---|---|---|---|
Product: | [Developer tools] valgrind | Reporter: | Sam James <sam> |
Component: | general | Assignee: | Paul Floyd <pjfloyd> |
Status: | REPORTED --- | ||
Severity: | normal | CC: | pjfloyd |
Priority: | NOR | ||
Version First Reported In: | 3.22 GIT | ||
Target Milestone: | --- | ||
Platform: | Other | ||
OS: | Other | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Sam James
2024-04-24 23:00:16 UTC
As a workaround, we're building tests with: ``` emake CFLAGS="${CFLAGS} -fno-strict-aliasing" LDFLAGS="${LDFLAGS} -Wl,-z,notext" check ``` for now. There is of course a load of intentional UB in the test cases. But this looks unintentional. The risk is that compilers start to exploit the UB for optimization and the code then breaks. Rather than using illegal type casts the code should use memcpy (or even better std::bit_cast but that requires C++20). |