Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion in emit for recursive function arguments #1215

Open
xermicus opened this issue Mar 8, 2023 · 1 comment
Open

Infinite recursion in emit for recursive function arguments #1215

xermicus opened this issue Mar 8, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@xermicus
Copy link
Contributor

xermicus commented Mar 8, 2023

Describe the bug
The following snip causes an infinite recursion in emit:

struct S {
    int256 f1;
    S[] f2;
}

// FIXME (stack overrun in emit):
function foo(S memory s) pure {}

contract Foo {
	function bar() public {
		S memory s = S({ f1: 1, f2: new S[](0) });
		foo(s);
	}
 }

To Reproduce

Expected behavior
This is allowed in solc too, it should compile to a valid contract

@xermicus xermicus added the bug Something isn't working label Mar 8, 2023
@xermicus
Copy link
Contributor Author

xermicus commented Mar 8, 2023

@LucasSte found another broken example

contract Test {
	struct S {
		int foo;
		S[] s;
	}

	function test(int foo) public returns (S) {
        S ss = S(foo, new S[](2));
        return ss;
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant