Skip to content

Commit 4633f3d

Browse files
authored
Merge pull request #1308 from ethereum/develop
Merge for version 0.4.4
2 parents 2353da7 + 979d18f commit 4633f3d

File tree

13 files changed

+96
-39
lines changed

13 files changed

+96
-39
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ include(EthPolicy)
88
eth_policy()
99

1010
# project name and version should be set after cmake_policy CMP0048
11-
set(PROJECT_VERSION "0.4.3")
11+
set(PROJECT_VERSION "0.4.4")
1212
project(solidity VERSION ${PROJECT_VERSION})
1313

1414
# Let's find our dependencies

Changelog.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
### 0.4.4 (2016-10-31)
2+
3+
Bugfixes:
4+
* Type checker: forbid signed exponential that led to an incorrect use of EXP opcode.
5+
* Code generator: properly clean higher order bytes before storing in storage.
6+
17
### 0.4.3 (2016-10-25)
28

39
Features:

cmake/EthCompilerSettings.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,12 @@ elseif (DEFINED MSVC)
180180
# Always use Release variant of C++ runtime.
181181
# We don't want to provide Debug variants of all dependencies. Some default
182182
# flags set by CMake must be tweaked.
183-
string(REPLACE "/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
184-
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
185-
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
186-
string(REPLACE "/MDd" "/MD" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
187-
string(REPLACE "/D_DEBUG" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
188-
string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG})
183+
string(REPLACE "/MDd" "/MD" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
184+
string(REPLACE "/D_DEBUG" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
185+
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
186+
string(REPLACE "/MDd" "/MD" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
187+
string(REPLACE "/D_DEBUG" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
188+
string(REPLACE "/RTC1" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
189189
set_property(GLOBAL PROPERTY DEBUG_CONFIGURATIONS OFF)
190190

191191
# disable empty object file warning

cmake/EthDependencies.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ function(eth_use TARGET REQUIRED)
119119
endif()
120120

121121
foreach(MODULE ${ARGN})
122-
string(REPLACE "::" ";" MODULE_PARTS ${MODULE})
122+
string(REPLACE "::" ";" MODULE_PARTS "${MODULE}")
123123
list(GET MODULE_PARTS 0 MODULE_MAIN)
124124
list(LENGTH MODULE_PARTS MODULE_LENGTH)
125125
if (MODULE_LENGTH GREATER 1)

docs/conf.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,9 @@ def setup(sphinx):
5656
# built documents.
5757
#
5858
# The short X.Y version.
59-
version = '0.4.3'
59+
version = '0.4.4'
6060
# The full version, including alpha/beta/rc tags.
61-
release = '0.4.3-develop'
61+
release = '0.4.4-develop'
6262

6363
# The language for content autogenerated by Sphinx. Refer to documentation
6464
# for a list of supported languages.

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Solidity is a contract-oriented, high-level language whose syntax is similar to
55
and it is designed to target the Ethereum Virtual Machine.
66

77
Solidity is statically typed, supports inheritance, libraries and complex
8-
user-defines types among other features.
8+
user-defined types among other features.
99

1010
As you will see, it is possible to create contracts for voting,
1111
crowdfunding, blind auctions, multi-signature wallets and more.

docs/installing-solidity.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Versioning
1212
Solidity versions follow `semantic versioning <https://semver.org>`_ and in addition to
1313
releases, **nightly development builds** are also made available. The nightly builds
1414
are not guaranteed to be working and despite best efforts they might contain undocumented
15-
and/or broken changes. We recommend to use the latest release. Package installers below
15+
and/or broken changes. We recommend using the latest release. Package installers below
1616
will use the latest release.
1717

1818
Browser-Solidity

liblll/CodeFragment.cpp

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,32 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
330330
if (nonStandard)
331331
return;
332332

333-
std::map<std::string, Instruction> const c_arith = { { "+", Instruction::ADD }, { "-", Instruction::SUB }, { "*", Instruction::MUL }, { "/", Instruction::DIV }, { "%", Instruction::MOD }, { "&", Instruction::AND }, { "|", Instruction::OR }, { "^", Instruction::XOR } };
334-
std::map<std::string, pair<Instruction, bool>> const c_binary = { { "<", { Instruction::LT, false } }, { "<=", { Instruction::GT, true } }, { ">", { Instruction::GT, false } }, { ">=", { Instruction::LT, true } }, { "S<", { Instruction::SLT, false } }, { "S<=", { Instruction::SGT, true } }, { "S>", { Instruction::SGT, false } }, { "S>=", { Instruction::SLT, true } }, { "=", { Instruction::EQ, false } }, { "!=", { Instruction::EQ, true } } };
335-
std::map<std::string, Instruction> const c_unary = { { "!", Instruction::ISZERO } };
333+
std::map<std::string, Instruction> const c_arith = {
334+
{ "+", Instruction::ADD },
335+
{ "-", Instruction::SUB },
336+
{ "*", Instruction::MUL },
337+
{ "/", Instruction::DIV },
338+
{ "%", Instruction::MOD },
339+
{ "&", Instruction::AND },
340+
{ "|", Instruction::OR },
341+
{ "^", Instruction::XOR }
342+
};
343+
std::map<std::string, pair<Instruction, bool>> const c_binary = {
344+
{ "<", { Instruction::LT, false } },
345+
{ "<=", { Instruction::GT, true } },
346+
{ ">", { Instruction::GT, false } },
347+
{ ">=", { Instruction::LT, true } },
348+
{ "S<", { Instruction::SLT, false } },
349+
{ "S<=", { Instruction::SGT, true } },
350+
{ "S>", { Instruction::SGT, false } },
351+
{ "S>=", { Instruction::SLT, true } },
352+
{ "=", { Instruction::EQ, false } },
353+
{ "!=", { Instruction::EQ, true } }
354+
};
355+
std::map<std::string, Instruction> const c_unary = {
356+
{ "!", Instruction::ISZERO },
357+
{ "~", Instruction::NOT }
358+
};
336359

337360
vector<CodeFragment> code;
338361
CompilerState ns = _s;
@@ -449,14 +472,15 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
449472
m_asm << end.tag();
450473
m_asm.donePaths();
451474
}
452-
else if (us == "WHILE")
475+
else if (us == "WHILE" || us == "UNTIL")
453476
{
454477
requireSize(2);
455478
requireDeposit(0, 1);
456479

457480
auto begin = m_asm.append();
458481
m_asm.append(code[0].m_asm);
459-
m_asm.append(Instruction::ISZERO);
482+
if (us == "WHILE")
483+
m_asm.append(Instruction::ISZERO);
460484
auto end = m_asm.appendJumpI();
461485
m_asm.append(code[1].m_asm, 0);
462486
m_asm.appendJump(begin);
@@ -541,17 +565,6 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
541565
// At end now.
542566
m_asm.append(end);
543567
}
544-
else if (us == "~")
545-
{
546-
requireSize(1);
547-
requireDeposit(0, 1);
548-
549-
m_asm.append(code[0].m_asm, 1);
550-
m_asm.append((u256)1);
551-
m_asm.append((u256)0);
552-
m_asm.append(Instruction::SUB);
553-
m_asm.append(Instruction::SUB);
554-
}
555568
else if (us == "SEQ")
556569
{
557570
unsigned ii = 0;
@@ -567,6 +580,10 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s)
567580
m_asm.append(i.m_asm);
568581
m_asm.popTo(1);
569582
}
583+
else if (us == "PANIC")
584+
{
585+
m_asm.appendJump(m_asm.errorTag());
586+
}
570587
else if (us.find_first_of("1234567890") != 0 && us.find_first_not_of("QWERTYUIOPASDFGHJKLZXCVBNM1234567890_") == string::npos)
571588
m_asm.append((u256)varAddress(s));
572589
else

libsolidity/ast/Types.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,11 +349,14 @@ TypePointer IntegerType::binaryOperatorResult(Token::Value _operator, TypePointe
349349
return commonType;
350350
if (Token::isBooleanOp(_operator))
351351
return TypePointer();
352-
// Nothing else can be done with addresses
353352
if (auto intType = dynamic_pointer_cast<IntegerType const>(commonType))
354353
{
354+
// Nothing else can be done with addresses
355355
if (intType->isAddress())
356356
return TypePointer();
357+
// Signed EXP is not allowed
358+
if (Token::Exp == _operator && intType->isSigned())
359+
return TypePointer();
357360
}
358361
else if (auto fixType = dynamic_pointer_cast<FixedPointType const>(commonType))
359362
if (Token::Exp == _operator)

libsolidity/codegen/LValue.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -231,20 +231,14 @@ void StorageItem::storeValue(Type const& _sourceType, SourceLocation const& _loc
231231
m_context
232232
<< (u256(0x1) << (256 - 8 * dynamic_cast<FixedBytesType const&>(*m_dataType).numBytes()))
233233
<< Instruction::SWAP1 << Instruction::DIV;
234-
else if (
235-
m_dataType->category() == Type::Category::Integer &&
236-
dynamic_cast<IntegerType const&>(*m_dataType).isSigned()
237-
)
234+
else
238235
// remove the higher order bits
239236
m_context
240237
<< (u256(1) << (8 * (32 - m_dataType->storageBytes())))
241238
<< Instruction::SWAP1
242239
<< Instruction::DUP2
243240
<< Instruction::MUL
244241
<< Instruction::DIV;
245-
else if (m_dataType->category() == Type::Category::FixedPoint)
246-
// implementation should be very similar to the integer case.
247-
solAssert(false, "Not yet implemented - FixedPointType.");
248242
m_context << Instruction::MUL << Instruction::OR;
249243
// stack: value storage_ref updated_value
250244
m_context << Instruction::SWAP1 << Instruction::SSTORE;

0 commit comments

Comments
 (0)