RFC - PR java/8608: ICE if WFL not yet set in check_init()
Per Bothner
per@bothner.com
Sat Feb 12 20:22:00 GMT 2005
Here's a suggested patch. It's actually quite a simplification,
and brings us forward in phasing out parse_error_context and
"wfl" objects. Furthermore, it narrows down the error location
by setting input_location for each incoming expression. This
only seems to work for --enable-mapped-location, but in that
case I get:
./jc1 /tmp/Foo.java -quiet -o /tmp/Foo.s
/tmp/Foo.java: In class 'Foo':
/tmp/Foo.java: In method 'Foo.bar()':
/tmp/Foo.java:7:10: error: variable ‘a’ may not have been initialized
In the default case I get:
/tmp/Foo.java: In class 'Foo':
/tmp/Foo.java: In method 'Foo.bar()':
/tmp/Foo.java:4: error: variable ‘a’ may not have been initialized
The reason we're getting line 4 instead of line 7 is probably for
the same reason we're got an ICE in the first place: We need to
annotate the 'for' statement with a line number. But that's a
problem for another day.
To get the column numbers requires a small patch to
diagnostic_build_prefix, which may be inappropriate for 4.0.
I'll post that patch shortly - at least I'd like to get it
pre-approved for when mainline opens up for development.
A downside to this patch is that we might lose column number
information in the short term (i.e. until USE_MAPPED_LOCATION
becomes the default) for these errors. Personally, I think it's
worth it for the simplification, and for not having to change
the code after the branch, but I can be convinced otherwise.
There were no testsuite regressions with an earlier version
of this patch, but since I changed things slightlty I'll have
to re-run the testsuite before a check-in.
--
--Per Bothner
per@bothner.com http://per.bothner.com/
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: init.patch
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050212/aaa433d3/attachment.ksh>
More information about the Java-patches
mailing list