-fsanitize=address duplicates inline strings. Is this intended behavior or a compiler issue?
Asked Answered
H

0

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?

Headlight answered 1/4, 2022 at 10:3 Comment(2)
It doesn't seem like it's -fsanitize=address that does this. Here is a different example: godbolt.org/z/PeG6sxYffSaurian
On further experimentation, this seems like a GCC bug. Here: <godbolt.org/z/cE16ev71c> the pointers-to-string-literals have the same address, but when read produce a different addressSaurian

© 2022 - 2024 — McMap. All rights reserved.