public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/44109]  New: gcj handling of assertions is in conflict with documentation
@ 2010-05-13 11:13 pkeller at globalphasing dot com
  2010-05-13 11:14 ` [Bug java/44109] " pkeller at globalphasing dot com
  2010-05-13 11:15 ` pkeller at globalphasing dot com
  0 siblings, 2 replies; 3+ messages in thread
From: pkeller at globalphasing dot com @ 2010-05-13 11:13 UTC (permalink / raw)
  To: java-prs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug java/44109] gcj handling of assertions is in conflict with documentation
  2010-05-13 11:13 [Bug java/44109] New: gcj handling of assertions is in conflict with documentation pkeller at globalphasing dot com
@ 2010-05-13 11:14 ` pkeller at globalphasing dot com
  2010-05-13 11:15 ` pkeller at globalphasing dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pkeller at globalphasing dot com @ 2010-05-13 11:14 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from pkeller at globalphasing dot com  2010-05-13 11:14 -------
Created an attachment (id=20656)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20656&action=view)
Output from compile/link step of test program


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44109


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug java/44109] gcj handling of assertions is in conflict with documentation
  2010-05-13 11:13 [Bug java/44109] New: gcj handling of assertions is in conflict with documentation pkeller at globalphasing dot com
  2010-05-13 11:14 ` [Bug java/44109] " pkeller at globalphasing dot com
@ 2010-05-13 11:15 ` pkeller at globalphasing dot com
  1 sibling, 0 replies; 3+ messages in thread
From: pkeller at globalphasing dot com @ 2010-05-13 11:15 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from pkeller at globalphasing dot com  2010-05-13 11:15 -------
Created an attachment (id=20657)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20657&action=view)
Preprocessor output from compiling test program


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44109


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-05-13 11:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-13 11:13 [Bug java/44109] New: gcj handling of assertions is in conflict with documentation pkeller at globalphasing dot com
2010-05-13 11:14 ` [Bug java/44109] " pkeller at globalphasing dot com
2010-05-13 11:15 ` pkeller at globalphasing dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).