mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Re-enable MSVC warning 4307.
This commit is contained in:
parent
dc79a79c06
commit
28d103e054
@ -28,10 +28,6 @@
|
|||||||
#include <libdevcrypto/SHA3.h>
|
#include <libdevcrypto/SHA3.h>
|
||||||
#include <test/solidityExecutionFramework.h>
|
#include <test/solidityExecutionFramework.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
#pragma warning(disable: 4307) //integral constant overflow for high_bits_cleaning
|
|
||||||
#endif
|
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
namespace dev
|
namespace dev
|
||||||
@ -386,7 +382,8 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
" function run() returns(uint256 y) {\n"
|
" function run() returns(uint256 y) {\n"
|
||||||
" uint32 x = uint32(0xffffffff) + 10;\n"
|
" uint32 t = uint32(0xffffffff);\n"
|
||||||
|
" uint32 x = t + 10;\n"
|
||||||
" if (x >= 0xffffffff) return 0;\n"
|
" if (x >= 0xffffffff) return 0;\n"
|
||||||
" return x;"
|
" return x;"
|
||||||
" }\n"
|
" }\n"
|
||||||
@ -394,7 +391,8 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning)
|
|||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto high_bits_cleaning_cpp = []() -> u256
|
auto high_bits_cleaning_cpp = []() -> u256
|
||||||
{
|
{
|
||||||
uint32_t x = uint32_t(0xffffffff) + 10;
|
uint32_t t = uint32_t(0xffffffff);
|
||||||
|
uint32_t x = t + 10;
|
||||||
if (x >= 0xffffffff)
|
if (x >= 0xffffffff)
|
||||||
return 0;
|
return 0;
|
||||||
return x;
|
return x;
|
||||||
@ -426,14 +424,16 @@ BOOST_AUTO_TEST_CASE(small_unsigned_types)
|
|||||||
{
|
{
|
||||||
char const* sourceCode = "contract test {\n"
|
char const* sourceCode = "contract test {\n"
|
||||||
" function run() returns(uint256 y) {\n"
|
" function run() returns(uint256 y) {\n"
|
||||||
" uint32 x = uint32(0xffffff) * 0xffffff;\n"
|
" uint32 t = uint32(0xffffff);\n"
|
||||||
|
" uint32 x = t * 0xffffff;\n"
|
||||||
" return x / 0x100;"
|
" return x / 0x100;"
|
||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto small_unsigned_types_cpp = []() -> u256
|
auto small_unsigned_types_cpp = []() -> u256
|
||||||
{
|
{
|
||||||
uint32_t x = uint32_t(0xffffff) * 0xffffff;
|
uint32_t t = uint32_t(0xffffff);
|
||||||
|
uint32_t x = t * 0xffffff;
|
||||||
return x / 0x100;
|
return x / 0x100;
|
||||||
};
|
};
|
||||||
testSolidityAgainstCpp("run()", small_unsigned_types_cpp);
|
testSolidityAgainstCpp("run()", small_unsigned_types_cpp);
|
||||||
|
Loading…
Reference in New Issue
Block a user