Fwd: [JAVA, PATCH] PR java/8923: ICE when modifying a variable decleared "final static"

Andrew Pinski pinskia@gmail.com
Thu Jul 27 09:16:00 GMT 2006


Java patches also should be sent to java-patches@ as pre http:// 
gcc.gnu.org/lists.html.

Thanks,
Andrew Pinski

Begin forwarded message:

> From: Simon Martin <simartin@users.sourceforge.net>
> Date: July 26, 2006 11:37:12 PM PDT
> To: gcc-patches@gcc.gnu.org
> Subject: [JAVA, PATCH] PR java/8923: ICE when modifying a variable  
> decleared "final static"
>
> Hi all.
>
> The attached patch fixes the following test case, given in comment  
> #6, by
> checking, in the parser, that the operand to ++ or -- is not a  
> constant.
>
> === cut here ===
> class gcjbug {
>     public static void main (String [] p) {
>         System.out.println(1++);
>     }
> }
> === cut here ===
>
> The patched source tree has been successfully bootstrapped and  
> regtested on
> i686-pc-linux-gnu. Is it OK? If so, could someone commit it for me  
> (I don't
> have write access).
>
>
> I haven't figured a fix for the initial test case yet:
>
> === cut here ===
> public class myBug
> {
>         final static int myConst = 200;
>
>         public static void bug() { myConst++;   /* ICE */ }
> }
> === cut here ===
>
> A good place to emit an error would be in check-init.c(check_init),  
> because
> that's there that we get an error if myConst is not declared  
> static. From my
> investigation, it looks like we currently don't see that myConst is  
> final
> because it has been constant fold, and we get an INTEGER_CST. Is  
> there a
> way to get back to the declaration from there? I guess that adding  
> a check
> for INTEGER_CST in check_init would fix the problem, but I wonder  
> if it's a
> "good" solution...
>
> Thanks in advance for your feedback on the patch and for your  
> advice on the
> rest of the problem.
>
> Best regards,
> Simon
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr8923.patch
Type: text/x-diff
Size: 1036 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20060727/029f36cb/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pr8923.java
Type: text/x-java
Size: 75 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20060727/029f36cb/attachment-0001.bin>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: CL_8923
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20060727/029f36cb/attachment.ksh>
-------------- next part --------------



More information about the Java-patches mailing list