From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17859 invoked by alias); 21 Nov 2005 21:34:22 -0000 Received: (qmail 17841 invoked by uid 48); 21 Nov 2005 21:34:22 -0000 Date: Mon, 21 Nov 2005 21:34:00 -0000 Message-ID: <20051121213422.17840.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug java/24980] GCJ/GIJ segfaults on Workout.java from Click and Hack's "Java Puzzlers" In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: java-prs@gcc.gnu.org From: "vadimn at redhat dot com" Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org X-SW-Source: 2005-q4/txt/msg00379.txt.bz2 List-Id: ------- Comment #3 from vadimn at redhat dot com 2005-11-21 21:34 ------- Yeah, this may be a dup. Bryce did mention that native-compiling this program with -O2 should turn on the TCO. There are two problems with this theory. Number one, it still segfaults for me: | $ gcj -O2 --main=Workout Workout.java | $ ./a.out | Segmentation fault This may be ok, because I'm using a rather old GCJ build. Number two, the TCO cannot possibly be applied in this case. (I can't see how at the moment, but I'm willing to be convinced otherwise.) Bryce ran the program under a newer version of GCJ and got some equally bizarre results: public static void main(String[] args) { workHard(); System.out.println("It's nap time."); } In his case, it printed out "It's nap time." This is incorrect, because the program should either run out of stack and throw a StackOverflowError, or it should it should run out of memory if stack frames are allocated on the heap. Under no circumstances can the method return normally. (I misspoke in my original post where I said the program should, in theory, terminate successfully.) So, yeah, if this is a dup, close it. Note though this program generates a much more interesting stress pattern than the one that aph posted in bug 1373. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24980