mirror of https://github.com/CGAL/cgal
Workaround for VC9/VC10 (in the testsuite only)
With /O2 and /fp:strict, MSVC produces a wrong assembler for the
following code:
int main(){
int i = 3;
float f = 3.f;
bool b = (f>= i);
return b ? 0 : 1;
}
The issue is with constant propagation and /fp:strict in the optimizer. The
workaround is to use volatile to prevent the constant propagation.
This commit is contained in:
parent
7e8cf96017
commit
942a071374
|
|
@ -46,8 +46,21 @@ void test_implicit_interoperable_for_real_embeddable (CGAL::Tag_false){}
|
|||
template <typename A, typename B>
|
||||
void test_implicit_interoperable_for_real_embeddable (CGAL::Tag_true){
|
||||
// two sided test for interoperability with int
|
||||
A a;
|
||||
B b;
|
||||
volatile A a;
|
||||
volatile B b;
|
||||
// These variables are volatile because the MSVC optimizer (at least VC9
|
||||
// and VC10) has problems with the following code with /O2 and /fp:strict
|
||||
// (it does constant propagation but produces erroneous assembler code).
|
||||
// Volatile prevents the constant propagation.
|
||||
/*
|
||||
int main(){
|
||||
int i = 3;
|
||||
float f = 3.f;
|
||||
bool b = (f>= i);
|
||||
return b ? 0 : 1;
|
||||
}
|
||||
*/
|
||||
|
||||
a = A(-5);
|
||||
b = B(-2);
|
||||
// a < b
|
||||
|
|
|
|||
Loading…
Reference in New Issue