public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
From: "kon at iki dot fi" <gcc-bugzilla@gcc.gnu.org>
To: java-prs@gcc.gnu.org
Subject: [Bug java/19758] New: compiler allows super.fun() even if abstract
Date: Wed, 02 Feb 2005 15:04:00 -0000	[thread overview]
Message-ID: <20050202150413.19758.kon@iki.fi> (raw)

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


             reply	other threads:[~2005-02-02 15:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-02-02 15:04 kon at iki dot fi [this message]
2005-02-02 15:13 ` [Bug java/19758] " pinskia at gcc dot gnu dot org

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=20050202150413.19758.kon@iki.fi \
    --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).