[PATCH] Fix sporadic failure in g++.dg/tsan/aligned_vs_unaligned_race.C

Bernd Edlinger bernd.edlinger@hotmail.de
Sat Jan 3 11:20:00 GMT 2015



On Sat, 3 Jan 2015 01:51:34, Mike Strump wrote:
>
> On Jan 3, 2015, at 1:01 AM, Bernd Edlinger <bernd.edlinger@hotmail.de> wrote:
>> the test case g++.dg/tsan/aligned_vs_unaligned_race.C
>> still fails sporadically (around 1 out of 100 times).
>> That is apparently a race condition in the tsan runtime itself.
>> To make the test reproducible pass, I need to add a sleep(1)
>> in one of the two threads.
>>
>>
>> Tested really often with:
>> make check-gcc-c++ RUNTESTFLAGS="tsan.exp=*"
>>
>> OK for trunk?
>
> No. sleep can never fix race conditions. The only time sleep can fix a race condition would be in a hard real time system, and, that in general doesn’t apply to anything in the gcc test suite.

Yes, but all other tsan test cases call sleep(1) too.
The sleep does not really "fix" the race condition but it changes
the likelihood from 1 / 100 to 1 / 10^20.

That is just to avoid noise from sporadic test failures.


Bernd.
 		 	   		  


More information about the Gcc-patches mailing list