[v3] libstdc++/54612

Message ID 505883D2.5070009@oracle.com
State New
Headers show

Commit Message

Paolo Carlini Sept. 18, 2012, 2:23 p.m.

tested x86_64-linux (with and without #include "opt_random.h" at the end 
of ext/random), committed to mainline. Should be fixed now.


PS: I just noticed that in ext/random, inside namespace __gnu_cxx, we 
are using, unqualified, size_t and other types. We shouldn't: it's only 
because of an accident of our implementation that those types are also 
available in the global namespace. We should qualify with std::, or use 
equivalent solutions.

PS2: I think we should add <ext/random> to include/precompiled/extc++.h, 
to speed up the testsuite and early catch trivial issues.

2012-09-18  Paolo Carlini  <paolo.carlini@oracle.com>

	PR libstdc++/54612
	* include/ext/random.tcc (operator==
	(const __gnu_cxx::simd_fast_mersenne_twister_engine<>&,
	const __gnu_cxx::simd_fast_mersenne_twister_engine<>&)): Fix
	state_size use.
	* config/cpu/i486/opt/ext/opt_random.h: Guard with __SSE2__.


Index: include/ext/random.tcc
--- include/ext/random.tcc	(revision 191415)
+++ include/ext/random.tcc	(working copy)
@@ -328,7 +328,12 @@ 
 	       __msk1, __msk2, __msk3, __msk4,
 	       __parity1, __parity2, __parity3, __parity4>& __rhs)
-      return (std::equal(__lhs._M_stateT, __lhs._M_stateT + state_size,
+      typedef __gnu_cxx::simd_fast_mersenne_twister_engine<_UIntType,
+	       __m, __pos1, __sl1, __sl2, __sr1, __sr2,
+	       __msk1, __msk2, __msk3, __msk4,
+	       __parity1, __parity2, __parity3, __parity4> __engine;
+      return (std::equal(__lhs._M_stateT,
+			 __lhs._M_stateT + __engine::state_size,
 	      && __lhs._M_pos == __rhs._M_pos);
Index: config/cpu/i486/opt/ext/opt_random.h
--- config/cpu/i486/opt/ext/opt_random.h	(revision 191415)
+++ config/cpu/i486/opt/ext/opt_random.h	(working copy)
@@ -32,6 +32,7 @@ 
 #pragma GCC system_header
+#ifdef __SSE2__
 namespace __gnu_cxx _GLIBCXX_VISIBILITY(default)
@@ -130,5 +131,6 @@ 
 } // namespace
+#endif // __SSE2__
 #endif // _EXT_OPT_RANDOM_H