This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

[IRIX 6.2] Java PATCH: jvgenmain creates bogus output


Trying to build libgcj 2.95 on IRIX 6.2, I noticed that jvgenmain creates
invalid output:

Consider the following command (with whatever hello.java you like):

% gcj -v --main=Hello -o Hello hello.java

Reading specs from /vol/gnu/lib/gcc-lib/mips-sgi-irix6.2/2.95/specs
Reading specs from /vol/gnu/lib/libgcj.spec
rename spec lib to liborig
gcc version 2.95 19990728 (release)
 /vol/gnu/lib/gcc-lib/mips-sgi-irix6.2/2.95/jc1 hello.java -quiet -g1 -version -o /var/tmp/ccQMcXxk.s
GNU Java version 2.95 19990728 (release) (mips-sgi-irix6.2) compiled by GNU C version 2.95 19990728 (release).
 /usr/bin/as -g0 -nocpp -show -G 0 -w -n32 -o /var/tmp/ccIXn9PM.o /var/tmp/ccQMcXxk.s
/usr/bin/../lib32/cmplrs/as -g0 -nocpp -show -G 0 -w -n32 -o /var/tmp/ccIXn9PM.o /var/tmp/ccQMcXxk.s
/usr/lib32/cmplrs/asm -EB -pic2 -elf -g0 -G0 -w -mips3 -n32 -O0 -t5_ll_sc_bug /var/tmp/ccQMcXxk.s -o /var/tmp/ccIXn9PM.o 
 /vol/gnu/lib/gcc-lib/mips-sgi-irix6.2/2.95/jvgenmain Hello /var/tmp/ccY0gntE.i
 /vol/gnu/lib/gcc-lib/mips-sgi-irix6.2/2.95/cc1 /var/tmp/ccY0gntE.i -quiet -dumpbase hello.c -g1 -version -o /var/tmp/cc6FPx9E.s
GNU C version 2.95 19990728 (release) (mips-sgi-irix6.2) compiled by GNU C version 2.95 19990728 (release).
/var/tmp/ccY0gntE.i:1: parse error before character 02
/var/tmp/ccY0gntE.i: In function `main':
/var/tmp/ccY0gntE.i:4: `_CL_5Hello' undeclared (first use in this function)
/var/tmp/ccY0gntE.i:4: (Each undeclared identifier is reported only once
/var/tmp/ccY0gntE.i:4: for each function it appears in.)
/var/tmp/ccY0gntE.i:4: parse error before character 02

Rerunning with -save-temps, I see get the following hello.i:

hello.i


which contains embedded non-ASCII characters after the mangled class name.
I found that jvgenmain.c (main) forgot to '\0'-terminate the obstack used
to hold the mangled classname.

The following patch fixes this.

	Rainer

-----------------------------------------------------------------------------
Rainer Orth, Faculty of Technology, Bielefeld University

Email: ro@TechFak.Uni-Bielefeld.DE


Tue Aug  3 00:28:31 1999  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>

	* jvgenmain.c (main): NUL-terminate name_obstack.

Index: jvgenmain.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/java/jvgenmain.c,v
retrieving revision 1.8
diff -u -p -r1.8 jvgenmain.c
--- jvgenmain.c	1999/03/21 06:09:18	1.8
+++ jvgenmain.c	1999/08/04 18:24:07
@@ -96,6 +96,7 @@ main (int argc, const char **argv)
 
   gcc_obstack_init (&name_obstack);
   append_gpp_mangled_classtype (&name_obstack, classname);
+  obstack_1grow (&name_obstack, '\0');
   mangled_classname = obstack_finish (&name_obstack);
 
   if (argc > 2 && strcmp (argv[2], "-") != 0)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]