Fix gcc 10.1.0 bug in file picker
commitcc2bad539bb1d88eb5e13f137c09094383ac89a8
authorfundamental <mark.d.mccurry@gmail.com>
Thu, 23 Jul 2020 12:51:52 +0000 (23 08:51 -0400)
committerHans Petter Selasky <hps@selasky.org>
Sat, 1 Aug 2020 07:59:59 +0000 (1 09:59 +0200)
tree4b47555998afabfbe1302606aaf65085426d59bc
parent6f99b5a477577eacc369e2df7be7ec6e1df72528
Fix gcc 10.1.0 bug in file picker

gcc 10.1.0 appears to fail to maintain the semantics of
for(...)
   ((rtosc_arg_t*)out)[i].s = (std::string)(in[i]).c_str()

under -O3 (-O0 is fine as well as other compiler versions)
9.3.0 on slackware for instance is known not to have this bug,
while 10.1.0 on arch was the reported system.

From what I can tell gcc applies a vectorized move using xmm registers
It's unclear which optimization flag in particular triggers the
behavior, but the compiler bug likely relates to some bad assumption in
the calling context i.e. a lambda function instantiated in an
initializer list for a global object.

I'm not currently planning on sending this issue upstream as turning it
into a minimal test case looks like it would be... nontrivial...

Anyone else interested in doing so is welcome to do so and such efforts
would be appreciated.

Symptoms of the failed optimization include a partial copy of values
with some corrupted or turned into null pointers.
src/Misc/MiddleWare.cpp