@@ -429,13 +429,15 @@ static void create_stub_global_symbol(
429
429
!add_failed, " caller should have checked symbol not already in table" );
430
430
}
431
431
432
- // / Find any incomplete ancestor of a given class
432
+ // / Find any incomplete ancestor of a given class that can have a stub static
433
+ // / field attached to it. This specifically excludes java.lang.Object, which we
434
+ // / know cannot have static fields.
433
435
// / \param start_class_id: class to start searching from
434
436
// / \param symbol_table: global symbol table
435
437
// / \param class_hierarchy: global class hierarchy
436
438
// / \return first incomplete ancestor encountered,
437
439
// / including start_class_id itself.
438
- static irep_idt get_any_incomplete_ancestor (
440
+ static irep_idt get_any_incomplete_ancestor_for_stub_static_field (
439
441
const irep_idt &start_class_id,
440
442
const symbol_tablet &symbol_table,
441
443
const class_hierarchyt &class_hierarchy)
@@ -450,8 +452,12 @@ static irep_idt get_any_incomplete_ancestor(
450
452
irep_idt to_check = classes_to_check.back ();
451
453
classes_to_check.pop_back ();
452
454
453
- if (symbol_table.lookup_ref (to_check).type .get_bool (ID_incomplete_class))
455
+ // Exclude java.lang.Object because it can
456
+ if (symbol_table.lookup_ref (to_check).type .get_bool (ID_incomplete_class) &&
457
+ to_check != " java::java.lang.Object" )
458
+ {
454
459
return to_check;
460
+ }
455
461
456
462
const class_hierarchyt::idst &parents =
457
463
class_hierarchy.class_map .at (to_check).parents ;
@@ -512,7 +518,7 @@ static void create_stub_global_symbols(
512
518
// class that was referred to. This is just a guess, but we have no
513
519
// better information to go on.
514
520
irep_idt add_to_class_id =
515
- get_any_incomplete_ancestor (
521
+ get_any_incomplete_ancestor_for_stub_static_field (
516
522
class_id, symbol_table, class_hierarchy);
517
523
518
524
// If there are no incomplete ancestors to ascribe the missing field
0 commit comments