alliedmodders / sourcepawn

A small, statically typed scripting language.
Other
363 stars 62 forks source link

spcomp assertion on malformed if #297

Closed Headline closed 5 years ago

Headline commented 5 years ago

thanks to shavit for reporting this one.

Gave it a shot myself, but a solution wasn't obvious to me. Here's how to replicate

int main(){
    if(
    {
        int b = c();
    }
}
C:\Users\Micha\Desktop\alliedmodders\sourcemod\sourcepawn\build\compiler\spcomp>spcomp test.sp
SourcePawn Compiler 1.10
Copyright (c) 1997-2006 ITB CompuPhase
Copyright (c) 2004-2018 AlliedModders LLC

Assertion failed: lval1->sym!=NULL, file C:\Users\Micha\Desktop\alliedmodders\sourcemod\sourcepawn\compiler\expressions.cpp, line 1057
dvander commented 5 years ago

Oh gross.

dvander commented 5 years ago

The bug is that { begins an array expression, but those are only expected within initializers.