SEGV compiling this class
minyard@acm.org
minyard@acm.org
Thu Jun 21 09:14:00 GMT 2001
I'm getting a SEGV comiling the code at the end of this email with the
3.0 release. This is only on i386 (SuSE 7.1, with gcc compiled with
the stock compiler and bootstrapped with it self), it works fine on
PowerPC. Should I report this with GNATS? The compile tool provided
on the web page didn't have the option to compile Java code, so I
couldn't do that.
Here are the details:
gcc -v:
Reading specs from /home/minyard/gcc/install/lib/gcc-lib/i686-pc-linux-gnu/3.0/specs
Configured with: ../gcc-3.0/configure --enable-threads=libc-lock --enable-java-gc=egc --prefix=/home/minyard/gcc/install
Thread model: libc-lock
gcc version 3.0
Although I have an unusual threads package and GC, I don't think that
would have any bearing on this problem.
Command to cause this to happen:
gcj -c -O StackTraceConverter.java
Any optimization level causes this, it doesn't segv if the optimizer is not
turned on.
Compiler output:
StackTraceConverter.java: In class `StackTraceConverter':
StackTraceConverter.java: In method `StackTraceConverter.getCurrentStackTrace()':
StackTraceConverter.java:29: Internal error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL: http://www.gnu.org/software/gcc/bugs.html > for instructions.
-Corey
import java.io.*;
public class StackTraceConverter {
private static StringWriter stringWriter = new StringWriter();
private static PrintWriter printWriter = new PrintWriter(stringWriter);
private static Throwable reusableObj = new Throwable();
public static synchronized String stackTraceToString(Throwable t) {
StringBuffer buff = stringWriter.getBuffer();
buff.setLength(0);
try {
t.printStackTrace(printWriter);
}
catch (Exception e) {
printWriter.println("Unable to generate stack trace!");
printWriter.println("Exception: " + e.toString());
}
printWriter.flush();
return buff.toString();
}
public static synchronized String getCurrentStackTrace() {
return stackTraceToString(reusableObj.fillInStackTrace());
}
}
More information about the Java
mailing list