This is the mail archive of the gcc-help@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: Re: Seeking advice on creating reduced testcase



On 25/09/15 17:55, Jeff Law wrote:
On 09/24/2015 03:40 PM, Johan Alfredsson wrote:
Hi,

I have come across something which I believe is a bug in g++. I've
seen this issue both in 4.9.1 and 5.2.0, but I'm struggling to create
a small testcase. (The output of g++ -v for 5.2.0 is below.)

The issue is a deadlock that seems to be due to there being (runtime)
the equivalent of _two_ different variables __gthread_active_ptr. It
just so happens that in the libstdc++ pool allocator template, the
allocate() function, for a certain instantiation, is compiled so that
the lock() method of the __scoped_lock (in ext/concurrence.h) is
getting 'true' as the result of its call to __gthread_active_p(),
while in the unlock() method it gets 'false'. The next allocation of
the same type will of course deadlock due to not releasing the mutex
after the previous allocation.
For a locking or race condition issue, you might consider using hellgrind to
gain an understanding of what's going wrong without having to further reduce
the source.    Once you have that understanding, it may be possible to show the
problem with simpler source or just explain what's going wrong (if indeed it is
a compiler issue).

Since I have seen several times questions about how to find out why some code gets miscompiled with optimization. I added a FAQ to the wiki.

https://gcc.gnu.org/wiki/FAQ#misoptimization

It is a bit rough, but it is a starting point. It can be expanded incrementally whenever someone has something else to add to the info there.

Cheers,

Manuel.


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