Skip to content

Commit 55b5b7e

Browse files
author
Daniel Kroening
authored
Merge pull request #714 from smowton/fix_lazy_methods_with_opaque_globals
Tolerate missing symbols in gather_needed_globals. Fixes #620
2 parents a79ea27 + e333f8d commit 55b5b7e

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/java_bytecode/java_bytecode_language.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,9 +387,16 @@ static void gather_needed_globals(
387387
{
388388
if(e.id()==ID_symbol)
389389
{
390-
const auto &sym=symbol_table.lookup(to_symbol_expr(e).get_identifier());
391-
if(sym.is_static_lifetime)
392-
needed.add(sym);
390+
// If the symbol isn't in the symbol table at all, then it is defined
391+
// on an opaque type (i.e. we don't have the class definition at this point)
392+
// and will be created during the typecheck phase.
393+
// We don't mark it as 'needed' as it doesn't exist yet to keep.
394+
auto findit=symbol_table.symbols.find(to_symbol_expr(e).get_identifier());
395+
if(findit!=symbol_table.symbols.end() &&
396+
findit->second.is_static_lifetime)
397+
{
398+
needed.add(findit->second);
399+
}
393400
}
394401
else
395402
forall_operands(opit, e)

0 commit comments

Comments
 (0)