public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "pkeller at globalphasing dot com" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/44109]  New: gcj handling of assertions is in conflict with documentation
Date: Thu, 13 May 2010 11:13:00 -0000	[thread overview]
Message-ID: <bug-44109-17178@http.gcc.gnu.org/bugzilla/> (raw)

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


             reply	other threads:[~2010-05-13 11:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-13 11:13 pkeller at globalphasing dot com [this message]
2010-05-13 11:14 ` [Bug java/44109] " pkeller at globalphasing dot com
2010-05-13 11:15 ` pkeller at globalphasing dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-44109-17178@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=java-prs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).