public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/7483: build_assertion gets assertion status wrong
@ 2002-08-03 17:36 jmr
  0 siblings, 0 replies; 2+ messages in thread
From: jmr @ 2002-08-03 17:36 UTC (permalink / raw)
  To: gcc-gnats


>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:


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

* Re: java/7483: build_assertion gets assertion status wrong
@ 2002-08-13 15:36 tromey
  0 siblings, 0 replies; 2+ messages in thread
From: tromey @ 2002-08-13 15:36 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, java-prs, jmr, nobody, tromey

Synopsis: build_assertion gets assertion status wrong

Responsible-Changed-From-To: unassigned->tromey
Responsible-Changed-By: tromey
Responsible-Changed-When: Tue Aug 13 15:29:49 2002
Responsible-Changed-Why:
    I'm handling this
State-Changed-From-To: open->closed
State-Changed-By: tromey
State-Changed-When: Tue Aug 13 15:29:49 2002
State-Changed-Why:
    I agree your patch is correct.
    I've checked it in, with a small modification.
    Thanks.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7483


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

end of thread, other threads:[~2002-08-13 22:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-03 17:36 java/7483: build_assertion gets assertion status wrong jmr
2002-08-13 15:36 tromey

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).