Bug 21022 - [4.0 only] ICE while compiling GdkFontMetrics.class with stabs debugging
Summary: [4.0 only] ICE while compiling GdkFontMetrics.class with stabs debugging
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: debug (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.1
Assignee: Andrew Haley
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: build, ice-on-valid-code, patch
: 20910 21225 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-04-14 13:48 UTC by Andreas Tobler
Modified: 2005-04-30 17:57 UTC (History)
6 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-04-16 19:53:44


Attachments
Class File which causes the Bus Error. (1.13 KB, application/octet-stream)
2005-04-18 20:16 UTC, Andreas Tobler
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Tobler 2005-04-14 13:48:32 UTC
I get the following bus error when I compile libgcj with awt support on darwin:

gnu/java/awt/peer/gtk/GdkFontMetrics.java: In class
'gnu.java.awt.peer.gtk.GdkFontMetrics':
gnu/java/awt/peer/gtk/GdkFontMetrics.java: In constructor '(java.awt.Font)':
gnu/java/awt/peer/gtk/GdkFontMetrics.java:0: internal compiler error: Bus error
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

The backtrace of in gdb of the error looks like this:

Program received signal EXC_BAD_ACCESS, Could not access memory.
fold_convert (type=0x4160c380, arg=0x0) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/fold-const.c:1885
1885      tree orig = TREE_TYPE (arg);
(gdb) bt
#0  fold_convert (type=0x4160c380, arg=0x0) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/fold-const.c:1885
#1  0x002636dc in bit_from_pos (offset=0x2636dc, bitpos=0x1f5d18) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/stor-layout.c:538
#2  0x002636dc in bit_from_pos (offset=0x2636dc, bitpos=0x1f5d18) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/stor-layout.c:538
#3  0x000f0d0c in dbxout_type (type=0x41640c00, full=0) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/dbxout.c:1406
#4  0x000f033c in dbxout_type (type=0x41640e00, full=1) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/dbxout.c:2102
#5  0x000f2f68 in dbxout_symbol (decl=0x41640f00, local=0) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/dbxout.c:2570
#6  0x00144a84 in debug_flush_symbol_queue () at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/final.c:3825
#7  0x000f3d1c in dbxout_function_decl (decl=0x41643980) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/dbxout.c:3391
#8  0x0028af98 in rest_of_compilation () at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/passes.c:330
#9  0x0005dc7c in execute_pass_list (pass=0x48efd8) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/tree-optimize.c:552
#10 0x0005dff4 in tree_rest_of_compilation (fndecl=0x0) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/tree-optimize.c:695
#11 0x002b85e0 in cgraph_expand_function (node=0x41657a00) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/cgraphunit.c:931
#12 0x002b86d4 in cgraph_assemble_pending_functions () at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/cgraphunit.c:364
#13 0x002b8e44 in cgraph_finalize_function (decl=0x41643980, nested=0 '\0') at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/cgraphunit.c:456
#14 0x00031c90 in end_java_method () at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/java/decl.c:2025
#15 0x0004a8c8 in parse_class_file () at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/java/jcf-parse.c:935
#16 0x0004d14c in java_parse_file (set_yydebug=1096860544) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/java/jcf-parse.c:1288
#17 0x0026a60c in toplev_main (argc=1078961420, argv=0xbffffa40) at
/Volumes/src/gcc/gcc-cvs/gcc/gcc/toplev.c:1000
#18 0x00002754 in _start (argc=25, argv=0xbffff924, envp=0xbffff98c) at
/SourceCache/Csu/Csu-47/crt.c:267
#19 0x8fe1a558 in __dyld__dyld_start ()
(gdb) 


I can reproduce this on 4.0.x branch too. Unfortunately the error is not as easy
to reproduce for others. It requires that you have a gtk installation with
shared libgcc. All in all about half a day or more of compilation work.

Anyway.

The error appears since Tom Tromey checked in findirect-dispatch compilation for
the awt-peer sources around 2005-04-05.

The error does also happen on tiger.

Further analysis has showed, if I remove the debug switch -g from the
compilation command, I do not get the bus error.

Note, darwin still uses stabs as preferred dbg format. I was not able to build a
gcc on darwin with dwarf2 as default. Neither was I able to reproduce the
failure on linuxppc -with-stabs.

Andrew Pinski noted on IRC that it might be a java fe bug. 

For me the question is now, how can I continue to debug this error?

The sooner or later (29 of April) the libgcj awt issue will come since then the
new darwin release can really run gtk-awt java based apps.
Comment 1 Andrew Pinski 2005-04-16 19:53:44 UTC
Confirmed on x86-pc-linux-gnu with compiling the generated GdkFontMetrics.class from gcj build 
with the following command line.
gcj -S -gstabs -findirect-dispatch GdkFontMetrics.class 
Comment 2 Andrew Pinski 2005-04-16 20:07:47 UTC
Here is the backtrace:
#0  fold_convert (type=0xb7bf8288, arg=0x0) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/fold-
const.c:1883
#1  0x083be08f in bit_from_pos (offset=0xb7bf8288, bitpos=0xb7bf8288)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/stor-layout.c:538
#2  0x083d176f in bit_position (field=0xb7c37510) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/
tree.c:1495
#3  0x081ce78e in dbxout_type (type=0xb7c2abd0, full=0) at /home/peshtigo/pinskia/src/gnu/gcc/
src/gcc/dbxout.c:1406
#4  0x081ce46e in dbxout_type (type=0xb7c2ad80, full=1) at /home/peshtigo/pinskia/src/gnu/gcc/
src/gcc/dbxout.c:2112
#5  0x081d21ea in dbxout_symbol (decl=Variable "decl" is not available.
) at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/dbxout.c:2534
#6  0x083f2df2 in rest_of_decl_compilation (decl=0xb7c2ae58, top_level=1, at_end=0)
    at /home/peshtigo/pinskia/src/gnu/gcc/src/gcc/passes.c:249


The field decl which is being taken the bit position of:
<field_decl 0xb7c37510 font
    type <pointer_type 0xb7c2d288
        type <record_type 0xb7c2d144 java.awt.Font type_4 DI
            size <integer_cst 0xb7bf1408 constant invariant 64>
            unit size <integer_cst 0xb7c0c708 constant invariant 8>
            align 32 symtab 21 alias set -1 fields <field_decl 0xb7c3506c D.487>
            pointer_to_this <pointer_type 0xb7c2d288> chain <type_decl 0xb7c2d21c java.awt.Font>>
        unsigned SI
        size <integer_cst 0xb7bf1360 constant invariant 32>
        unit size <integer_cst 0xb7bf1180 constant invariant 4>
        align 32 symtab 20 alias set -1
        pointer_to_this <pointer_type 0xb7c3757c>>
    ignored decl_1 VOID file gnu/java/awt/peer/gtk/GdkFontMetrics.java line 74
    align 1 offset_align 1 context <record_type 0xb7c2abd0 java.awt.FontMetrics> chain <field_decl 
0xb7c31948 D.454>>
Comment 3 Andreas Tobler 2005-04-16 20:16:01 UTC
I just built the tree without awt-gtk enabled. The
gnu/java/awt/peer/gtk/GdkFontMetrics.class is built even without gtk enabled.
So, a command line compile of the class to .o is possible and makes the bug
easier to reproduce for others. As Andrew P already mentioned.

On darwin I reproduce the bug this way:

/Volumes/src/gcc/gcc-cvs/objdir/./gcc/jc1
gnu/java/awt/peer/gtk/GdkFontMetrics.class -fhash-synchronization
-fuse-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions
-fkeep-inline-functions -feliminate-unused-debug-symbols -fPIC -quiet -dumpbase
GdkFontMetrics.class -auxbase GdkFontMetrics -g -O2 -Wno-deprecated -version
-fclasspath=
-fbootclasspath=/Volumes/src/gcc/gcc-cvs/objdir/powerpc-apple-darwin7.9.0/libjava:/Volumes/src/gcc/gcc-cvs/gcc/libjava:/Volumes/src/gcc/gcc-cvs/gcc/libjava/external/w3c_dom:/Volumes/src/gcc/gcc-cvs/gcc/libjava/external/sax
-fencoding=UTF-8 -findirect-dispatch -fjni -o /var/tmp//ccA7zDFV.s

It happens on both, 4.0 and 4.1.

Comment 4 Andreas Tobler 2005-04-18 20:16:34 UTC
Created attachment 8679 [details]
Class File which causes the Bus Error.
Comment 5 Andrew Haley 2005-04-19 13:26:11 UTC
See http://gcc.gnu.org/ml/gcc/2005-04/msg01068.html
Comment 6 GCC Commits 2005-04-19 15:43:15 UTC
Subject: Bug 21022

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	aph@gcc.gnu.org	2005-04-19 15:43:00

Modified files:
	gcc            : dbxout.c ChangeLog 

Log message:
	2005-04-19  Andrew Haley  <aph@redhat.com>
	
	PR java/21022
	* dbxout.c (dbxout_type_fields): Check DECL_IGNORED_P before
	looking at a field's bitpos.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dbxout.c.diff?cvsroot=gcc&r1=1.227&r2=1.228
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.8361&r2=2.8362

Comment 7 Andreas Tobler 2005-04-19 17:53:28 UTC
Completed a build of HEAD with awt-gtk enabled on darwin7.9.

Thanks!

I run now a build on 4.0, even if we may not get this fix in for 4.0.
Comment 8 Andreas Tobler 2005-04-19 20:26:53 UTC
Add on, a full bootstrap on 4.0 branch with the following config completed
successfully:

 /Volumes/src/gcc/gcc-4.0-branch/gcc/configure
--prefix=/Volumes/src/gcc/gcc-4.0-branch/testbin --enable-languages=c,c++,java
--enable-java-awt=gtk,xlib --enable-gtk-cairo --disable-checking
--enable-libgcj-multifile

[wolfram:gcc/gcc-4.0-branch/objdir] andreast% cat ../gcc/LAST_UPDATED 
Tue Apr 19 19:48:59 CEST 2005
Tue Apr 19 17:48:59 UTC 2005

And the dbxout patch from aph.
Comment 9 Andrew Pinski 2005-04-25 21:36:33 UTC
*** Bug 21225 has been marked as a duplicate of this bug. ***
Comment 10 GCC Commits 2005-04-28 16:33:55 UTC
Subject: Bug 21022

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	aph@gcc.gnu.org	2005-04-28 16:33:38

Modified files:
	gcc            : ChangeLog dbxout.c 

Log message:
	2005-04-19  Andrew Haley  <aph@redhat.com>
	
	PR java/21022
	* dbxout.c (dbxout_type_fields): Check DECL_IGNORED_P before
	looking at a field's bitpos.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.201&r2=2.7592.2.202
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dbxout.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.221.2.1&r2=1.221.2.2

Comment 11 Andrew Pinski 2005-04-28 16:53:27 UTC
Fixed, thanks again Andrew.
Comment 12 Andrew Pinski 2005-04-30 17:57:34 UTC
*** Bug 20910 has been marked as a duplicate of this bug. ***