GCC Bugzilla – Bug 8433
Static initializers must be able to complete normally
Last modified: 2007-01-09 20:44:09 UTC
Java forbids static initializers from not being able to complete normally. These two classes should both cause a compile-time error, but gcj accepts them:
throw new NullPointerException("nope");
gcj (GCC) 3.2 20020818 (prerelease)
Configured with: /netrel/src/gcc-3.2-1/configure --enable-languages=c,c++,f77,ja
va --enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls --with
out-included-gettext --enable-interpreter --disable-sjlj-exceptions --disable-ve
rsion-specific-runtime-libs --enable-shared --build=i686-pc-linux --host=i686-pc
-cygwin --target=i686-pc-cygwin --enable-haifa --prefix=/usr --exec-prefix=/usr
--sysconfdir=/etc --libdir=/usr/lib --includedir=/nonexistent/include --libexecd
Thread model: posix
gcc version 3.2 20020818 (prerelease)
Compile the two example classes. It should give two compile errors.
State-Changed-Why: "Completes normally" is a technical term defined in the Java Language
Specification. See section 15.6 in the JSL 2nd Ed.
We already have a fair amount of machinery for this. However, when
I looked, it appeared difficult to fix this PR.
State-Changed-Why: I don't understand how gcj is expected to do this.
Determining whether a static initializer will complete normally is equivalent to the halting problem, and is therefore not computable.
Confirmed on mainline (20030525).
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.