https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100483
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> --- As author of the flag I agree with Alexander. -fno-semantic-interposition basically means that variables or functions can be interposed only if the replacement is semantically equivalent. For variables it means that they have same constructor and for function that the effect of the function call is the same. So it allows inter-procedural optimization across interposable functions and constant folding of reads of constant interposable variables. % cat a.c int var; int foo() { return var; } (I implemented this for clang 11 x86) % clang -fpic -fno-semantic-interposition -O2 -S a.c % cat a.s ... foo: # @foo .Lfoo$local: # %bb.0: # %entry movl .Lvar$local(%rip), %eax retq ... this is wrong transformation since it will break when one writes var in one DSO and reads it from another. I think it is misinterpretation of semantic interposition flag at clang's side.