public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: <jmr@fulcrummicro.com>
To: gcc-gnats@gcc.gnu.org
Subject: java/7483: build_assertion gets assertion status wrong
Date: Sat, 03 Aug 2002 17:36:00 -0000	[thread overview]
Message-ID: <200208040029.g740TBw21452@churchill.internal.avlsi.com> (raw)


>Number:         7483
>Category:       java
>Synopsis:       build_assertion gets assertion status wrong
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          wrong-code
>Submitter-Id:   net
>Arrival-Date:   Sat Aug 03 17:36:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     jmr@fulcrummicro.com
>Release:        3.3 20020801 (experimental)
>Organization:
>Environment:
System: Linux churchill 2.4.3-12 #1 Fri Jun 8 15:05:56 EDT 2001 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured) 
>Description:
	The program:

        public class TestAssert {
            public static void main(String[] args) {
                boolean enabled = false;
                assert enabled = true;
                System.out.println("Asserts " + (enabled ? "enabled" : "disabled"));
            }
        }

        prints "disabled" even though VMClassLoader.defaultAssertionStatus()
        always returns true.

>How-To-Repeat:
; gcj -v --main=TestAssert TestAssert.java -o test_assert    
Reading specs from /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/specs
Reading specs from /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../../libgcj.spec
rename spec lib to liborig
Configured with: ../gcc/configure --enable-threads=posix --prefix=/home/user/jmr/app/gcc --enable-shared --enable-languages=c++,java : (reconfigured) 
Thread model: posix
gcc version 3.3 20020801 (experimental)
 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/jc1 TestAssert.java -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fkeep-inline-functions -quiet -dumpbase TestAssert.java -g1 -version -o /tmp/ccg64c5c.s
GNU Java version 3.3 20020801 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.2 20020713 (experimental).
Class path starts here:
    ./
    /home/user/jmr/app/gcc/share/java/libgcj-3.3.jar/ (system) (zip)
 as --traditional-format -V -Qy -o /tmp/ccOs6Xkj.o /tmp/ccg64c5c.s
GNU assembler version 2.12 (i686-pc-linux-gnu) using BFD version 2.12
 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/jvgenmain TestAssertmain /tmp/ccUGM6ar.i
 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/cc1 /tmp/ccUGM6ar.i -quiet -dumpbase TestAssertmain.c -g1 -version -fdollars-in-identifiers -o /tmp/ccg64c5c.s
GNU C version 3.3 20020801 (experimental) (i686-pc-linux-gnu)
        compiled by GNU C version 3.2 20020713 (experimental).
 as --traditional-format -V -Qy -o /tmp/ccymSnAz.o /tmp/ccg64c5c.s
GNU assembler version 2.12 (i686-pc-linux-gnu) using BFD version 2.12
 /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/collect2 -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o test_assert /usr/lib/crt1.o /usr/lib/crti.o /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/crtbegin.o -L/home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3 -L/home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/../../.. /tmp/ccymSnAz.o /tmp/ccOs6Xkj.o -lgcc_s -lgcc -lgcj -lm -lpthread -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/user/jmr/app/gcc/lib/gcc-lib/i686-pc-linux-gnu/3.3/crtend.o /usr/lib/crtn.o

; ./test_assert
Asserts disabled

>Fix:
; cvs diff parse.y                ;: ~/gcc-compile/gcc/gcc/java 17:24 churchill
Index: parse.y
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/java/parse.y,v
retrieving revision 1.390
diff -c -r1.390 parse.y
*** parse.y     2 Jul 2002 02:56:11 -0000       1.390
--- parse.y     4 Aug 2002 00:24:25 -0000
***************
*** 15353,15358 ****
--- 15353,15361 ----
        call = build (CALL_EXPR, NULL_TREE, id, NULL_TREE, NULL_TREE);
        call = make_qualified_primary (classdollar, call, location);
        TREE_SIDE_EFFECTS (call) = 1;
+ 
+       /* Invert to obtain !CLASS.desiredAssertionStatus().  */
+       call = build1 (TRUTH_NOT_EXPR, NULL_TREE, call);
        DECL_INITIAL (field) = call;
  
        /* Record the initializer in the initializer statement list.  */
>Release-Note:
>Audit-Trail:
>Unformatted:


             reply	other threads:[~2002-08-04  0:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-03 17:36 jmr [this message]
2002-08-13 15:36 tromey

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=200208040029.g740TBw21452@churchill.internal.avlsi.com \
    --to=jmr@fulcrummicro.com \
    --cc=gcc-gnats@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).