Messages in this thread | | | Date | Wed, 20 Nov 2013 17:52:52 -0800 | Subject | Re: current_thread_info() not respecting program order with gcc 4.8.x | From | Luis Lozano <> |
| |
I have been monitoring this thread and trying to understand how could this happen.
I noticed that the definition for ARM of current_thread_info looks like this:
/* * how to get the thread information struct from C */ static inline struct thread_info *current_thread_info(void) __attribute_const__;
static inline struct thread_info *current_thread_info(void) { register unsigned long sp asm ("sp"); return (struct thread_info *)(sp & ~(THREAD_SIZE - 1)); }
Notice this has the __attribute_const__ marking which corresponds to the __const__ gcc attribute described in:
http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
This attribute marking seems wrong to me. This function depends on global state (depends on SP). This seems to go against the definition of what a "const" function is (according to GCC) I noticed this attribute marking is not set for the x86 definition.
Could this be confusing the compiler and causing the problem? Can you try this?
It would be nice if you could point to the exact location in the code where one could see the reordering happening. I tried to reproduce with a small test case and I couldn't. Do you have a small test case?
Luis
| |