7

In our codebase we expect that strings only exist once in the compiled binary. I observe that

-fsanitize=address

can generate duplicated strings in the executable. This breaks our code.

The following godbolt example demonstrates the issue https://godbolt.org/z/G5edcnr5e.

My question is if this an intended behavior or a compiler issue?

Thomas m
  • 133
  • 4
  • 1
    It doesn't seem like it's `-fsanitize=address` that does this. Here is a different example: https://godbolt.org/z/PeG6sxYff – Artyer Apr 01 '22 at 10:31
  • 1
    On further experimentation, this seems like a GCC bug. Here: the pointers-to-string-literals have the same address, but when read produce a different address – Artyer Apr 01 '22 at 10:42

0 Answers0