diff mbox

[Bug,libstdc++/62313] Data race in debug iterators

Message ID 542B1010.3030301@gmail.com
State New
Headers show

Commit Message

François Dumont Sept. 30, 2014, 8:18 p.m. UTC
Hi

     I prefer to submit this patch to you cause I am not very 
comfortable with Python stuff.

     I simply rely on Python cast feature. It doesn't really matter but 
is it going to simply consider the debug iterator as a normal one or is 
it going through the C++ explicit cast operator on debug iterators ?

François


On 30/09/2014 17:32, Jonathan Wakely wrote:
> On 26/09/14 11:05 +0100, Jonathan Wakely wrote:
>> On 26/09/14 00:00 +0200, François Dumont wrote:
>>>
>>>>> Apart from those minor adjustments I think this looks good, but I'd
>>>>> like to know that it has been tested with -fsanitize=thread, even if
>>>>> only lightly tested.
>>>>>
>>>>>
>>>
>>> Hi
>>>
>>>   Dmitry, who reported the bug, confirmed the fix. Can I go ahead 
>>> and commit ?
>>
>> Yes, OK.
>
> This caused some failures in the printer tests:
>
> Running
> /home/jwakely/src/gcc/gcc/libstdc++-v3/testsuite/libstdc++-prettyprinters/prettyprinters.exp 
> ...
> FAIL: libstdc++-prettyprinters/debug.cc print deqiter
> FAIL: libstdc++-prettyprinters/debug.cc print lstiter
> FAIL: libstdc++-prettyprinters/debug.cc print lstciter
> FAIL: libstdc++-prettyprinters/debug.cc print mpiter
> FAIL: libstdc++-prettyprinters/debug.cc print spciter
>
>

Comments

Jonathan Wakely Oct. 1, 2014, 12:13 p.m. UTC | #1
On 30/09/14 22:18 +0200, François Dumont wrote:
>Hi
>
>    I prefer to submit this patch to you cause I am not very 
>comfortable with Python stuff.
>
>    I simply rely on Python cast feature. It doesn't really matter but 
>is it going to simply consider the debug iterator as a normal one or 

Yes.

>is it going through the C++ explicit cast operator on debug iterators 
>?

No, it doesn't call any C++ function.

(N.B. I was searching in debug/safe_iterator.h for the 'explicit'
conversion operator you referred to and was confused because I
couldn't find it, which is because the operator for converting to base
is not 'explicit')

I'm not sure why the existing Python code does .cast(itype) when
_M_current is already that type, that seems unnecessary to me, but
I think your fix is correct and OK to commit, thanks.
diff mbox

Patch

Index: python/libstdcxx/v6/printers.py
===================================================================
--- python/libstdcxx/v6/printers.py	(revision 215741)
+++ python/libstdcxx/v6/printers.py	(working copy)
@@ -460,7 +460,7 @@ 
     # and return the wrapped iterator value.
     def to_string (self):
         itype = self.val.type.template_argument(0)
-        return self.val['_M_current'].cast(itype)
+        return self.val.cast(itype)
 
 class StdMapPrinter:
     "Print a std::map or std::multimap"