This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PR java/25429: can't see private static final int CREATE = 1
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, java-patches at gcc dot gnu dot org
- Date: Thu, 15 Dec 2005 16:38:03 +0000
- Subject: PR java/25429: can't see private static final int CREATE = 1
Constant propagation is broken when importing into an inner class.
Fixed thusly. Tested/bootstrapped.
class C
{
private static final int CONST = 0;
class I {
public void f () {
switch(0) {
case CONST:
}
}
}
}
Andrew.
2005-12-13 Andrew Haley <aph@redhat.com>
PR java/25429
* parse.y (resolve_expression_name): Don't generate accessor
methods for initialized static final variables.
Index: java/parse.y
===================================================================
--- java/parse.y (revision 108423)
+++ java/parse.y (working copy)
@@ -9584,8 +9584,12 @@
/* If we're processing an inner class and we're trying
to access a field belonging to an outer class, build
- the access to the field. */
- if (nested_member_access_p (current_class, decl))
+ the access to the field.
+ As usual, we have to treat initialized static final
+ variables as a special case. */
+ if (nested_member_access_p (current_class, decl)
+ && ! (JDECL_P (decl) && CLASS_FINAL_VARIABLE_P (decl)
+ && DECL_INITIAL (decl) != NULL_TREE))
{
if (!fs && CLASS_STATIC (TYPE_NAME (current_class)))
{