From 25e8b6ceb492818d78314bfccd8808556d059761 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Sat, 14 Jun 2008 19:49:45 +0000 Subject: [PATCH] re PR java/36247 (Segfault with -findirect-dispatch and --jni) PR java/36247: * class.c (build_class_ref): Initialize this_classdollar when From-SVN: r136787 --- gcc/java/ChangeLog | 6 ++++++ gcc/java/class.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/gcc/java/ChangeLog b/gcc/java/ChangeLog index 144e25d4c37..943299d5318 100644 --- a/gcc/java/ChangeLog +++ b/gcc/java/ChangeLog @@ -1,3 +1,9 @@ +2008-06-14 Tom Tromey + + PR java/36247: + * class.c (build_class_ref): Initialize this_classdollar when + needed. + 2008-05-23 Andrew Haley * jcf-parse.c (give_name_to_class): Call find_sourcefile to find full diff --git a/gcc/java/class.c b/gcc/java/class.c index 85e37bc468b..dff75ac9e43 100644 --- a/gcc/java/class.c +++ b/gcc/java/class.c @@ -1142,7 +1142,13 @@ build_class_ref (tree type) return build_indirect_class_ref (type); if (type == output_class && flag_indirect_classes) - return this_classdollar; + { + /* This can be NULL if we see a JNI stub before we see any + other method. */ + if (! this_classdollar) + this_classdollar = build_classdollar_field (output_class); + return this_classdollar; + } if (TREE_CODE (type) == RECORD_TYPE) return build_static_class_ref (type); -- 2.30.2