[jira] [Commented] (STDCXX-1071) numpunct facet cache initialization is not thread -safe

2012-09-26 Thread Liviu Nicoara (JIRA)

[ 
https://issues.apache.org/jira/browse/STDCXX-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13464295#comment-13464295
 ] 

Liviu Nicoara commented on STDCXX-1071:
---

The file library-reduction.cpp is a reduction of the numpunct library code down 
to the essentials that still have the defect. The test case is intentionally 
verbose (180LOC) so that it still shows the organization of the library code. 
It exhibits the same failures as the original library code it has been 
extracted from. It takes two defines on the command line: 

1. NO_USE_STDCXX_LOCALES -- if defined it mimics the setting of the facet data 
from the system locales
2. NO_USE_NUMPUNCT_CACHE -- if set, it does perfect forwarding, i.e., it does 
not cache locale data in the facet

The runs, with SUNPro 5.12 on Linux, exhibit failures (renamed to t.cpp):

{noformat}
$ CC -O -mt t.cpp  ./a.out 
t.cpp, line 113: Warning: String literal converted to char* in assignment.
1 Warning(s) detected.
CC: Warning: failed to detect system linker version, falling back to custom 
linker usage
16, 1000
*** glibc detected *** ./a.out: double free or corruption (fasttop): 
0x00622b40 ***
*** glibc detected *** ./a.out: double free or corruption (fasttop): 
0x7f6654000920 ***
=== Backtrace: =
/lib64/libc.so.6(+0x78f85)[0x7f666c031f85]
/lib64/libc.so.6(cfree+0x73)[0x7f666c035d93]
...
{noformat}

{noformat}
$ CC -DNO_USE_STDCXX_LOCALES -O -mt t.cpp  ./a.out 
t.cpp, line 113: Warning: String literal converted to char* in assignment.
1 Warning(s) detected.
CC: Warning: failed to detect system linker version, falling back to custom 
linker usage
16, 1000
*** glibc detected *** ./a.out: double free or corruption (fasttop): 
0x00622b40 ***
*** glibc detected *** ./a.out: double free or corruption (fasttop): 
0x7fda68b0 ***
=== Backtrace: =
/lib64/libc.so.6=== Backtrace: =
/lib64/libc.so.6(cfree+0x73)[0x7fda6c8f2d93]
/lib64/libc.so.6(+0x78f85)[0x7fda6c8eef85]
noformat

The reduced program did not fail in my runs with NO_USE_NUMPUNCT_CACHE defined.

 numpunct facet cache initialization is not thread -safe
 ---

 Key: STDCXX-1071
 URL: https://issues.apache.org/jira/browse/STDCXX-1071
 Project: C++ Standard Library
  Issue Type: Bug
  Components: 22. Localization, Thread Safety
Affects Versions: 4.2.1, 4.2.x, 4.3.x, 5.0.0
 Environment: $ uname -a; CC -V
 Linux behemoth 2.6.37.6 #3 SMP Sat Apr 9 22:49:32 CDT 2011 x86_64 AMD 
 Opteron(tm) Processor 6134 AuthenticAMD GNU/Linux
 CC: Sun C++ 5.12 Linux_i386 2011/11/16
Reporter: Liviu Nicoara
Priority: Critical
  Labels: DCII, localization, numpunct, thread-safety
 Fix For: 4.2.1, 4.2.x, 4.3.x, 5.0.0

 Attachments: library-reduction.cpp

   Original Estimate: 8h
  Remaining Estimate: 8h

 The bug affects the initialization of the cached data in numpunct facet. The 
 failing test is 22.locale.numpunct.cpp in certain builds: Linux with SUNPro 
 5.12, optimized, most likely to fail. It has been reported (see linked 
 incidents) to fail on SPARC as well. It manifests in variate ways: sometimes 
 as heap corruption, sometimes as access violations, etc. Test cases and 
 library reduction programs to follow. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (STDCXX-1071) numpunct facet cache initialization is not thread -safe

2012-09-26 Thread Liviu Nicoara (JIRA)

[ 
https://issues.apache.org/jira/browse/STDCXX-1071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13464298#comment-13464298
 ] 

Liviu Nicoara commented on STDCXX-1071:
---

The file punct-mt.cpp is a multi-threaded program that tests either the 
numpunct or the moneypunct facet accessor interface. If TEST_MONEYPUNCT is 
defined, the test tests moneypunct. The test fails with 4.2.x and presumably 
with all others. The moneypunct version does not fail in my local runs. I have 
used SUNPro 5.12 on Linux, but I noticed failures with gcc 4.7.1 as well. The 
test case is pointing at the numpunct facet caching code.

 numpunct facet cache initialization is not thread -safe
 ---

 Key: STDCXX-1071
 URL: https://issues.apache.org/jira/browse/STDCXX-1071
 Project: C++ Standard Library
  Issue Type: Bug
  Components: 22. Localization, Thread Safety
Affects Versions: 4.2.1, 4.2.x, 4.3.x, 5.0.0
 Environment: $ uname -a; CC -V
 Linux behemoth 2.6.37.6 #3 SMP Sat Apr 9 22:49:32 CDT 2011 x86_64 AMD 
 Opteron(tm) Processor 6134 AuthenticAMD GNU/Linux
 CC: Sun C++ 5.12 Linux_i386 2011/11/16
Reporter: Liviu Nicoara
Priority: Critical
  Labels: DCII, localization, numpunct, thread-safety
 Fix For: 4.2.1, 4.2.x, 4.3.x, 5.0.0

 Attachments: library-reduction.cpp, punct-mt.cpp

   Original Estimate: 8h
  Remaining Estimate: 8h

 The bug affects the initialization of the cached data in numpunct facet. The 
 failing test is 22.locale.numpunct.cpp in certain builds: Linux with SUNPro 
 5.12, optimized, most likely to fail. It has been reported (see linked 
 incidents) to fail on SPARC as well. It manifests in variate ways: sometimes 
 as heap corruption, sometimes as access violations, etc. Test cases and 
 library reduction programs to follow. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira