Fix internal compiler error for arrays of recursive structs.

This commit is contained in:
Daniel Kirchner 2019-10-01 16:40:39 +02:00
parent 48c77c971d
commit 7202ebb5b2
4 changed files with 25 additions and 0 deletions

View File

@ -16,6 +16,7 @@ Bugfixes:
* Code Generator: Fix internal error when popping a dynamic storage array of mappings.
* Name Resolver: Fix wrong source location when warning on shadowed aliases in import declarations.
* Scanner: Fix multi-line natspec comment parsing with triple slashes when file is encoded with CRLF instead of LF.
* Type System: Fix arrays of recursive structs.
* Yul Optimizer: Fix reordering bug in connection with shifted one and mul/div-instructions in for loop conditions.

View File

@ -2050,6 +2050,8 @@ unsigned StructType::calldataOffsetOfMember(std::string const& _member) const
bool StructType::isDynamicallyEncoded() const
{
if (recursive())
return true;
solAssert(interfaceType(false).get(), "");
for (auto t: memoryMemberTypes())
{

View File

@ -0,0 +1,12 @@
contract Test {
struct RecursiveStruct {
RecursiveStruct[] vals;
}
function func() public pure {
RecursiveStruct[1] memory val = [ RecursiveStruct(new RecursiveStruct[](42)) ];
assert(val[0].vals.length == 42);
}
}
// -----
// func() ->

View File

@ -0,0 +1,10 @@
contract Test {
struct RecursiveStruct {
RecursiveStruct[] vals;
}
function func() private pure {
RecursiveStruct[1] memory val;
val;
}
}