Caldarale, Charles R
2012-Nov-08 12:33 UTC
[LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] > On Behalf Of Tom Bergan > Subject: [LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables> my current workaround is to declare Ptr volatile: > int * volatile Ptr;> Note that if the volatile is moved under the pointer, as in the following: > volatile int * Ptr;> then the bug reappears, as the load "*Ptr" in main() will be incorrectly optimized to: > %5 = load volatile i32* @Foo, align 4Discounting the TLS problem, the above observed behavior is correct. Setting volatile between the * and Ptr informs the compiler that Ptr may vary; setting volatile before int indicates what Ptr points to may vary. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
Seemingly Similar Threads
- [LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables
- [LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables
- [LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables
- [LLVMdev] Bug Report -- Possible optimizer bug with thread_local variables
- [LLVMdev] Handling of thread_local globals by llc -march=cpp