Index: test/cctest/compiler/test-run-properties.cc |
diff --git a/test/cctest/compiler/test-run-properties.cc b/test/cctest/compiler/test-run-properties.cc |
index b1f04c51c2860d75927234b76e0896d04b9bd718..d4442f7a85d6ddfc6f295b3c9e8ba1e087bd350d 100644 |
--- a/test/cctest/compiler/test-run-properties.cc |
+++ b/test/cctest/compiler/test-run-properties.cc |
@@ -47,9 +47,10 @@ static void TypedArrayLoadHelper(const char* array_type) { |
CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); |
for (size_t i = 0; i < arraysize(kValues); ++i) { |
for (size_t j = 0; j < arraysize(kValues); ++j) { |
- double value_a = static_cast<U>(kValues[i]); |
- double value_b = static_cast<U>(kValues[j]); |
- double expected = value_a + value_b; |
+ volatile U value_a = static_cast<U>(kValues[i]); |
Michael Starzinger
2014/09/18 18:38:07
Man, do I love C++ intuitiveness. :)
|
+ volatile U value_b = static_cast<U>(kValues[j]); |
+ double expected = |
+ static_cast<double>(value_a) + static_cast<double>(value_b); |
Sven Panne
2014/09/19 06:07:26
Casting away volatile leads to undefined behavior:
|
T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), |
T.Val(static_cast<double>(j))); |
} |
@@ -65,8 +66,8 @@ TEST(TypedArrayLoad) { |
TypedArrayLoadHelper<uint16_t>("Uint16"); |
TypedArrayLoadHelper<int32_t>("Int32"); |
TypedArrayLoadHelper<uint32_t>("Uint32"); |
+ TypedArrayLoadHelper<float>("Float32"); |
TypedArrayLoadHelper<double>("Float64"); |
- // TODO(mstarzinger): Add tests for Float32. |
// TODO(mstarzinger): Add tests for ClampedUint8. |
} |
@@ -115,9 +116,10 @@ static void TypedArrayStoreHelper(const char* array_type) { |
CompilationInfo::kContextSpecializing | CompilationInfo::kTypingEnabled); |
for (size_t i = 0; i < arraysize(kValues); ++i) { |
for (size_t j = 0; j < arraysize(kValues); ++j) { |
- double value_a = static_cast<U>(kValues[i]); |
- double value_b = static_cast<U>(kValues[j]); |
- double expected = value_b + value_a; |
+ volatile U value_a = static_cast<U>(kValues[i]); |
+ volatile U value_b = static_cast<U>(kValues[j]); |
+ double expected = |
+ static_cast<double>(value_a) + static_cast<double>(value_b); |
T.CheckCall(T.Val(expected), T.Val(static_cast<double>(i)), |
T.Val(static_cast<double>(j))); |
} |
@@ -133,7 +135,7 @@ TEST(TypedArrayStore) { |
TypedArrayStoreHelper<uint16_t>("Uint16"); |
TypedArrayStoreHelper<int32_t>("Int32"); |
TypedArrayStoreHelper<uint32_t>("Uint32"); |
+ TypedArrayStoreHelper<float>("Float32"); |
TypedArrayStoreHelper<double>("Float64"); |
- // TODO(mstarzinger): Add tests for Float32. |
// TODO(mstarzinger): Add tests for ClampedUint8. |
} |