Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ void bb_disconnect(basic_block_t *pred, basic_block_t *succ)
/* The symbol is an argument of function or the variable in declaration */
void add_symbol(basic_block_t *bb, var_t *var)
{
if (!bb)
return;
symbol_t *sym;
for (sym = bb->symbol_list.head; sym; sym = sym->next) {
if (sym->var == var)
Expand Down
9 changes: 9 additions & 0 deletions tests/driver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,15 @@ int main() {
}
EOF

# Unreachable declaration should not cause prog seg-falut (prog should leave normally with exit code 0)
try_ 0 << EOF
int main()
{
return 0;
int a = 5;
}
EOF

try_ 1 << EOF
int is_odd(int x);

Expand Down