This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: bug wrt gcc 4.7 and the C++11 memory model


On 2012-08-31 05:48, Andrew MacLeod wrote:
> On 08/30/2012 07:04 PM, Richard Henderson wrote:
>> Actually, we already have a memory barrier feature in rtl:
>>
>>    ALIAS_SET_MEMORY_BARRIER
>>
>> but since we already set that in get_builtin_sync_mem, we'll need
>> to figure out why that's no longer working.
>>
>> As far as I can tell from reading alias.c, we should already be
>> indicating that such memories alias...
>>
>> What was the testcase again?  I seem to have lost the top of the thread...
>>
>>
> 
> #include <atomic>
> using namespace std;
> 
> atomic_uint a_8;
> int32_t g_70;
> int32_t g_141;
> 
> int main (int, char *[]) {
>    a_8.load () & a_8.load ();
>    g_141 = g_70 != 0;
> }
> 
> or equivalently
> 
> int a_8;
> int g_70;
> int g_141;
> 
> int main ()
> {
>    __atomic_load_n (&a_8, __ATOMIC_SEQ_CST) & __atomic_load_n (&a_8, __ATOMIC_SEQ_CST);
>    g_141 = g_70 != 0;
> }

Fixed as follows.  This seems to be the only entry point in alias.c that didn't take ALIAS_SET_MEMORY_BARRIER into account.  Getting the above into a test case is tricky, and I havn't figured out how to match it.

Full testing still underway, but I expect it to pass.


r~



Attachment: z
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]