public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug java/19758] New: compiler allows super.fun() even if abstract
@ 2005-02-02 15:04 kon at iki dot fi
  2005-02-02 15:13 ` [Bug java/19758] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 3+ messages in thread
From: kon at iki dot fi @ 2005-02-02 15:04 UTC (permalink / raw)
  To: java-prs

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


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

* [Bug java/19758] compiler allows super.fun() even if abstract
  2005-02-02 15:04 [Bug java/19758] New: compiler allows super.fun() even if abstract kon at iki dot fi
@ 2005-02-02 15:13 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-02-02 15:13 UTC (permalink / raw)
  To: java-prs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-02-02 15:13 -------
Confirmed, it might turn out this is a dup of bug 12893.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |12893
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|                            |1
           Keywords|                            |accepts-invalid
   Last reconfirmed|0000-00-00 00:00:00         |2005-02-02 15:13:39
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19758


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

* [Bug java/19758] compiler allows super.fun() even if abstract
       [not found] <bug-19758-9521@http.gcc.gnu.org/bugzilla/>
@ 2007-01-09 20:50 ` tromey at gcc dot gnu dot org
  0 siblings, 0 replies; 3+ messages in thread
From: tromey at gcc dot gnu dot org @ 2007-01-09 20:50 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from tromey at gcc dot gnu dot org  2007-01-09 20:47 -------
All gcj front end bugs have been fixed by the gcj-eclipse branch merge.
I'm mass-closing the affected PRs.
If you believe one of these was closed in error, please reopen it
with a note explaining why.
Thanks.


-- 

tromey at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.3.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19758


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

end of thread, other threads:[~2007-01-09 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-02 15:04 [Bug java/19758] New: compiler allows super.fun() even if abstract kon at iki dot fi
2005-02-02 15:13 ` [Bug java/19758] " pinskia at gcc dot gnu dot org
     [not found] <bug-19758-9521@http.gcc.gnu.org/bugzilla/>
2007-01-09 20:50 ` tromey at gcc dot gnu dot org

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