[PATCH] Set -fprofile-update=atomic when -pthread is present

Nathan Sidwell nathan@acm.org
Thu Aug 18 11:02:00 GMT 2016


On 08/17/16 23:15, Jeff Law wrote:
> On 08/12/2016 07:31 AM, Martin Liška wrote:
>> On 08/09/2016 09:03 PM, Andi Kleen wrote:
>>> It could potentially make things a lot slower. I don't think it's a good
>>> idea to do this by default.
>>>
>>> -Andi
>>
>> Ok, alternative can be a warning in the driver that would inform a user
>> that combining -pthread and -fprofile-update=single can lead to profile
>> corruption.
>> My first attempt with option handling gcc.c was not successful, I'll try it once.
>>
>> Is it reasonable approach?
> I'd prefer to make updates atomic in multi-threaded applications.  The best
> proxy we have for that is -pthread.
>
> Is it slower, most definitely, but odds are we're giving folks garbage data
> otherwise, which in many ways is even worse.

True, and if someone cares they can always override the new default behaviour.

nathan



More information about the Gcc-patches mailing list