From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11204 invoked by alias); 2 Feb 2005 15:04:25 -0000 Mailing-List: contact java-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: java-prs-owner@gcc.gnu.org Received: (qmail 11184 invoked by uid 48); 2 Feb 2005 15:04:24 -0000 Date: Wed, 02 Feb 2005 15:04:00 -0000 From: "kon at iki dot fi" To: java-prs@gcc.gnu.org Message-ID: <20050202150413.19758.kon@iki.fi> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug java/19758] New: compiler allows super.fun() even if abstract X-Bugzilla-Reason: CC X-SW-Source: 2005-q1/txt/msg00273.txt.bz2 List-Id: A GCC checked out from CVS on 2005-01-29 compiles the following code without complaint, generating an invokespecial to the abstract method First.fun(). The linker will detect the error, but I think it would make sense to reject such code at compile time, like KJC and Jikes do, or at least warn about it. KJC gives "JLS 15.12.3" as a rationale. abstract class First { abstract void fun(); } class Second extends First { void fun() { super.fun(); } } $ /usr/lib/kaffe/bin/kjc abstract.java abstract.java:7: error:Can not call abstract method "void First.fun()" with prefix "super" [JLS 15.12.3] $ jikes-gij abstract.java Found 1 semantic error compiling "abstract.java": 7. super.fun(); ^---------^ *** Semantic Error: An abstract method, "fun", cannot be invoked. $ gcj -C -Wall -Wextra abstract.java $ gcj -v abstract.java Using built-in specs. Reading specs from /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/i386-pc-linux-gnu/4.0.0/../../../libgcj.spec rename spec lib to liborig Configured with: /home/kalle/src/FOREIGN-CVS/gcc/configure --prefix=/home/kalle --exec-prefix=/home/kalle/i386-pc-linux-gnu --host=i386-pc-linux-gnu --build=i386-pc-linux-gnu --enable-java-awt=gtk,xlib Thread model: posix gcc version 4.0.0 20050129 (experimental) /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../libexec/gcc/i386-pc-linux-gnu/4.0.0/jc1 abstract.java -fhash-synchronization -fno-use-divide-subroutine -fuse-boehm-gc -fnon-call-exceptions -fno-omit-frame-pointer -fkeep-inline-functions -quiet -dumpbase abstract.java -auxbase abstract -g1 -version -o /tmp/ccS8XoWC.s GNU Java version 4.0.0 20050129 (experimental) (i386-pc-linux-gnu) compiled by GNU C version 4.0.0 20050129 (experimental). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Class path starts here: ./ /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/../../../share/java/libgcj-4.0.0.jar/ (system) (zip) as -V -Qy -o /tmp/cc6hh3qe.o /tmp/ccS8XoWC.s GNU assembler version 2.15 (i386-linux) using BFD version 2.15 /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../libexec/gcc/i386-pc-linux-gnu/4.0.0/collect2 --eh-frame-hdr -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/i386-pc-linux-gnu/4.0.0/crtbegin.o -L/home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/i386-pc-linux-gnu/4.0.0 -L/home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc -L/home/kalle/i386-pc-linux-gnu/lib/gcc/i386-pc-linux-gnu/4.0.0 -L/home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/i386-pc-linux-gnu/4.0.0/../../.. -L/home/kalle/i386-pc-linux-gnu/lib/gcc/i386-pc-linux-gnu/4.0.0/../../.. /tmp/cc6hh3qe.o -lgcc_s -lgcc -lgcj -lm -lpthread -ldl -lgcc_s -lgcc -lc -lgcc_s -lgcc /home/kalle/stow/gcc/i386-pc-linux-gnu/bin/../lib/gcc/i386-pc-linux-gnu/4.0.0/crtend.o /usr/lib/crtn.o /usr/lib/crt1.o(.text+0x18): In function `_start': ../sysdeps/i386/elf/start.S:98: undefined reference to `main' /tmp/cc6hh3qe.o(.text+0xe): In function `Second::fun()': : undefined reference to `First::fun()' /tmp/cc6hh3qe.o(.data+0xc): undefined reference to `First::fun()' collect2: ld returned 1 exit status -- Summary: compiler allows super.fun() even if abstract Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: minor Priority: P2 Component: java AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kon at iki dot fi CC: gcc-bugs at gcc dot gnu dot org,java-prs at gcc dot gnu dot org GCC build triplet: i386-pc-linux-gnu GCC host triplet: i386-pc-linux-gnu GCC target triplet: i386-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19758