From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6225 invoked by alias); 13 May 2010 11:13:33 -0000 Received: (qmail 6207 invoked by uid 48); 13 May 2010 11:13:33 -0000 Date: Thu, 13 May 2010 11:13:00 -0000 Subject: [Bug java/44109] New: gcj handling of assertions is in conflict with documentation X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: java-prs@gcc.gnu.org From: "pkeller at globalphasing dot com" Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org X-SW-Source: 2010-q2/txt/msg00049.txt.bz2 Built/installed gcc under openSUSE 11.1 with: ../configure --prefix=$pre --enable-languages=c,java Test program AssertionTest.java: class AssertionTest { static public void main( String args[] ) { assert false: "test assertion"; System.out.println("Hello World!"); } } Compile/link as follows: $pre/bin/gcj -v -save-temps --disable-assertions -Wl,-rpath,$pre/lib64 --main=AssertionTest AssertionTest.java Output in AssertionTest.out. Note in particular the line: cc1: warning: command line option "-fdisable-assertions" is valid for Java but not for C which is also output when not using the -v option. According to the documentation from 'man -M $pre/share/man gcj', the --disable-assertions option should exclude assertion checks from the compiled code, but this does not appear to happen. Running the binary as: ./a.out; echo $? gives: Exception in thread "main" java.lang.AssertionError: test assertion at AssertionTest.main(a.out) 1 Expected: Hello World! 0 Also, from man -M $pre/share/man gcj By default, assertions are enabled when generating class files or when not optimizing, and disabled when generating optimized binaries. However, generating an optimized binary as follows: $pre/bin/gcj -O -Wl,-rpath,$pre/lib64 --main=AssertionTest AssertionTest.java succeeds without errors or warnings, but assertions are not disabled. "./a.out; echo $?" gives the same result as above. >>From a cursory look at some older versions of gcc, it appears that this is long-standing behaviour. If it is intentional, maybe this is merely a documentation bug? -- Summary: gcj handling of assertions is in conflict with documentation Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pkeller at globalphasing dot com GCC build triplet: x86_64-unknown-linux-gnu GCC host triplet: x86_64-unknown-linux-gnu GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44109