https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92462
--- Comment #9 from Aleksei Voitylov <aleksei.voity...@bell-sw.com> --- (In reply to Alexander Monakov from comment #8) > The full preprocessed source is provided and it clearly says > > typedef unsigned char uint8_t; > > in line 10, so it is in fact a character type. > > It's suspicious that cmpxchg_using_helper does not return a value > (incorrectly reduced testcase?) and there's still an aliasing violation when > atomic_cmpxchg_func tries to cast 'dest' from uint8_t* to int*. I think the > report was closed prematurely. It is suspicious regarding atomic functionality - from that point the testcase is over-reduced, you are right. It doesn't invalidate the initial question about the hoisting, though. > Aleksei - always provide output of 'gcc -v' when reporting such bugs, > otherwise people may be unable to reproduce it when there's really a problem > (no way to tell how your compiler was configured or even its exact version). $ g++ -v Using built-in specs. COLLECT_GCC=/home/build/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/arm-linux-gnueabihf-g++ COLLECT_LTO_WRAPPER=/home/build/toolchain/gcc-linaro-7.3.1-2018.05-x86_64_arm-linux-gnueabihf/bin/../libexec/gcc/arm-linux-gnueabihf/7.3.1/lto-wrapper Target: arm-linux-gnueabihf Configured with: <skipped> Thread model: posix gcc version 7.3.1 20180425 [linaro-7.3-2018.05 revision d29120a424ecfbc167ef90065c0eeb7f91977701] (Linaro GCC 7.3-2018.05)