lkml.org 
[lkml]   [2013]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: current_thread_info() not respecting program order with gcc 4.8.x
From
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


\
 
 \ /
  Last update: 2013-11-21 03:21    [W:0.022 / U:0.848 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site