public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* java/1140: final field initialized with cast expression not treated as constant
@ 2000-12-20 12:08 gcb
  0 siblings, 0 replies; only message in thread
From: gcb @ 2000-12-20 12:08 UTC (permalink / raw)
  To: java-gnats

>Number:         1140
>Category:       java
>Synopsis:       final field initialized with cast expression not treated as constant
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    apbianco
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 20 12:06:32 PST 2000
>Closed-Date:    Thu Jun 01 09:09:15 PDT 2000
>Last-Modified:  Thu Jun  1 09:16:01 PDT 2000
>Originator:     gcb@gnu.org
>Release:        gcc version 2.96 20000103 (experimental)
>Organization:
>Environment:
Linux/x86
>Description:
A final static field that is initialized with a cast
expression is not treated as a constant expression (e.g.
as a case value).
>How-To-Repeat:
Compile the above java file (gcj -C or gcj -c).
>Fix:
The patch.
>Release-Note:
I updated Tom's partial commit with an optimization I
wrote when I was working on a fix:

  http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01719.html

  
>Audit-Trail:

Formerly PR gcj/131


From: Pekka Nikander <pekka.nikander@hut.fi>
To: java-gnats@sourceware.cygnus.com, apbianco@cygnus.com, gcb@gnu.org
Cc:  
Subject: Re: gcj/131
Date: Thu, 23 Mar 2000 13:14:48 +0200

 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=131&database=java
 
 I think this bug is related to a subtle code generator bug.
 If you define a static final field that doesn't use casts,
 the compiler generates a compile time constant.  However,
 if you add a cast to the definition, without any other
 changes, the compiler does not any more recognize the 
 initializer as a constant but produces code into <clinit>.
 
 Test code:
 
   package main;
   class dummy {
      static final byte b0 = 0;
      static final byte b1 = (byte)0;
   }
 
 Resulting assembler code (for Hitachi H8/300):
 
 	.section .text
 	.align 1
 	.global __003cclinit_003e__Q24main5dummyU
 __003cclinit_003e__Q24main5dummyU:
 	mov.w	#__CL_Q24main5dummy,r6
 	jsr	@_initClass__Q34java4lang5Class
 	sub.b	r0l,r0l
 	mov.b	r0l,@__Q24main5dummy$b1
 	rts
 	.global __Q24main5dummy$b0
 	.section .data
 __Q24main5dummy$b0:
 	.byte 0
 	.global __Q24main5dummy$b1
 	.section .bss
 __Q24main5dummy$b1:
 	.space 2
 
 The bug seems to be in parse.y around line 14300 (YMMV, I have a custom version)
 
   if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
     return NULL_TREE;
 
 Integer constants etc are handled before; CONVERT_EXPR (which does have
 a TREE_TYPE defined) trips on this; e.g. PLUS_EXPR doesn't have a type
 defined, and it passes.
 
 Maybe this whole test is more or less bogus?
 
 --Pekka Nikander

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/131
Date: Tue, 28 Mar 2000 19:14:05 -0800 (PST)

 Pekka Nikander writes:
 
 >  Integer constants etc are handled before; CONVERT_EXPR (which does have
 >  a TREE_TYPE defined) trips on this; e.g. PLUS_EXPR doesn't have a type
 >  defined, and it passes.
 >
 >  Maybe this whole test is more or less bogus?
 
 Yes, It looks like the whole test could go, especially since
 {VAR,FIELD}_DECLs are properly handled in the switch statement down
 below, I think this patch could be applied:
 
 Index: parse.y
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
 retrieving revision 1.146
 diff -u -p -r1.146 parse.y
 --- parse.y     2000/03/23 07:01:24     1.146
 +++ parse.y     2000/03/29 02:07:49
 @@ -14488,8 +14503,6 @@ fold_constant_for_init (node, context)
  
    if (code == INTEGER_CST || code == REAL_CST)
      return convert (TREE_TYPE (context), node);
 -  if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
 -    return NULL_TREE;
  
    switch (code)
      {
 
 And with the new 1.1 enabled front end, gcj won't trip on the
 following code:
 
 class dummy {
   static final byte b0 = 1;
   static final byte b1 = (byte)2;
   static final byte b2 = b0+b1;
 }
 
 And will have `b2' initialized to 2 without any intervention from
 <clinit>. Then the next step is the prevent <clinit> from being
 generated unless necessary -- I'm working on it.
 
 ./A

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: Pekka Nikander <Pekka.Nikander@hut.fi>
Cc: java-gnats@sourceware.cygnus.com
Subject: Re: gcj/131
Date: Thu, 30 Mar 2000 15:10:48 -0800 (PST)

 Pekka Nikander writes:
 
 > I've been running with the test disabled for about a week now,
 > without any apparent problems.  Thus, I wholly agree with you.
 
 And it looks like with the attached patch, we can get rid of <clinit>
 when it turns out to be unnecessary. I'm testing it at the moment and
 so far it looks OK.
 
 ./A
 
 Index: parse.y
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
 retrieving revision 1.146
 diff -u -p -r1.146 parse.y
 --- parse.y	2000/03/23 07:01:24	1.146
 +++ parse.y	2000/03/30 23:08:25
 @@ -136,6 +136,7 @@ static tree obtain_incomplete_type PARAM
  static tree java_complete_lhs PARAMS ((tree));
  static tree java_complete_tree PARAMS ((tree));
  static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
 +static int maybe_yank_clinit PARAMS ((tree));
  static void java_complete_expand_method PARAMS ((tree));
  static int  unresolved_type_p PARAMS ((tree, tree *));
  static void create_jdep_list PARAMS ((struct parser_ctxt *));
 @@ -7332,17 +7333,17 @@ maybe_generate_pre_expand_clinit (class_
  
    end_artificial_method_body (mdecl);
  
 -  /* Now we want to place <clinit> as the last method for interface so
 -     that it doesn't interfere with the dispatch table based
 -     lookup. */
 -  if (CLASS_INTERFACE (TYPE_NAME (class_type))
 -      && TREE_CHAIN (TYPE_METHODS (class_type)))
 +  /* Now we want to place <clinit> as the last method (because we need
 +     it at least for interface so that it doesn't interfere with the
 +     dispatch table based lookup. */
 +  if (TREE_CHAIN (TYPE_METHODS (class_type)))
      {
 -      tree current = 
 -	TYPE_METHODS (class_type) = TREE_CHAIN (TYPE_METHODS (class_type));
 +      current = TREE_CHAIN (TYPE_METHODS (class_type));
 +      TYPE_METHODS (class_type) = current;
  
        while (TREE_CHAIN (current))
  	current = TREE_CHAIN (current);
 +
        TREE_CHAIN (current) = mdecl;
        TREE_CHAIN (mdecl) = NULL_TREE;
      }
 @@ -7350,6 +7351,47 @@ maybe_generate_pre_expand_clinit (class_
    return mdecl;
  }
  
 +/* See whether we could get rid of <clinit>. Criteria are: all static
 +   final fields have constant initial values. Return 1 if <clinit> was
 +   discarded, 0 otherwise. */
 +
 +static int
 +maybe_yank_clinit (mdecl)
 +     tree mdecl;
 +{
 +  tree type, current;
 +
 +  if (!DECL_CLINIT_P (mdecl))
 +    return 0;
 +
 +  type = DECL_CONTEXT (mdecl);
 +  current = TYPE_FIELDS (type);
 +
 +  for (current = (current ? TREE_CHAIN (current) : current); 
 +       current; current = TREE_CHAIN (current))
 +    if (!(FIELD_STATIC (current) && FIELD_FINAL (current)
 +	  && DECL_INITIAL (current) && TREE_CONSTANT (DECL_INITIAL (current))))
 +      break;
 +
 +  if (current)
 +    return 0;
 +
 +  /* Get rid of <clinit> in the class' list of methods */
 +  if (TYPE_METHODS (type) == mdecl)
 +    TYPE_METHODS (type) = TREE_CHAIN (mdecl);
 +  else
 +    for (current = TYPE_METHODS (type); current; 
 +	 current = TREE_CHAIN (current))
 +      if (TREE_CHAIN (current) == mdecl)
 +	{
 +	  TREE_CHAIN (current) = TREE_CHAIN (mdecl);
 +	  break;
 +	}
 +
 +  return 1;
 +}
 +
 +
  /* Complete and expand a method.  */
  
  static void
 @@ -7403,16 +7445,21 @@ java_complete_expand_method (mdecl)
  	  && !flag_emit_xref)
  	missing_return_error (current_function_decl);
  
 -      complete_start_java_method (mdecl); 
 -
 -      /* Don't go any further if we've found error(s) during the
 -         expansion */
 -      if (!java_error_count)
 -	source_end_java_method ();
 -      else
 -	{
 -	  pushdecl_force_head (DECL_ARGUMENTS (mdecl));
 -	  poplevel (1, 0, 1);
 +      /* Check wether we could just get rid of clinit, now the picture
 +         is complete. */
 +      if (!maybe_yank_clinit (mdecl))
 +	{
 +	  complete_start_java_method (mdecl); 
 +
 +	  /* Don't go any further if we've found error(s) during the
 +	     expansion */
 +	  if (!java_error_count)
 +	    source_end_java_method ();
 +	  else
 +	    {
 +	      pushdecl_force_head (DECL_ARGUMENTS (mdecl));
 +	      poplevel (1, 0, 1);
 +	    }
  	}
  
        /* Pop the exceptions and sanity check */
 @@ -14488,8 +14535,6 @@ fold_constant_for_init (node, context)
  
    if (code == INTEGER_CST || code == REAL_CST)
      return convert (TREE_TYPE (context), node);
 -  if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
 -    return NULL_TREE;
  
    switch (code)
      {

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/131
Date: Tue, 18 Apr 2000 18:04:46 -0700 (PDT)

 Alexandre Petit-Bianco writes:
 > The following reply was made to PR gcj/131; it has been noted by GNATS.
 > 
 > From: Alexandre Petit-Bianco <apbianco@cygnus.com>
 > To: Pekka Nikander <Pekka.Nikander@hut.fi>
 > Cc: java-gnats@sourceware.cygnus.com
 > Subject: Re: gcj/131
 > Date: Thu, 30 Mar 2000 15:10:48 -0800 (PST)
 > 
 >  Pekka Nikander writes:
 >  
 >  > I've been running with the test disabled for about a week now,
 >  > without any apparent problems.  Thus, I wholly agree with you.
 >  
 >  And it looks like with the attached patch, we can get rid of <clinit>
 >  when it turns out to be unnecessary. I'm testing it at the moment and
 >  so far it looks OK.
 
 Oops. The patch triggered regressions. Here's a new patch.
 
 ./A
 
 2000-04-17  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
         * parse.y (maybe_yank_clinit): New function.
         (maybe_generate_pre_expand_clinit): Always link <clinit> at the
         end of the list of methods belonging to a class.
         (java_complete_expand_method): Check whether <clinit> is really
         necessary and expand it accordingly.
         (fold_constant_for_init): Let VAR_DECL and FIELD_DECL be processed
         by the method's switch statement.
 
 Index: parse.y
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
 retrieving revision 1.150
 diff -u -p -r1.150 parse.y
 --- parse.y	2000/04/06 05:29:30	1.150
 +++ parse.y	2000/04/19 00:49:44
 @@ -136,6 +136,7 @@ static tree obtain_incomplete_type PARAM
  static tree java_complete_lhs PARAMS ((tree));
  static tree java_complete_tree PARAMS ((tree));
  static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
 +static int maybe_yank_clinit PARAMS ((tree));
  static void java_complete_expand_method PARAMS ((tree));
  static int  unresolved_type_p PARAMS ((tree, tree *));
  static void create_jdep_list PARAMS ((struct parser_ctxt *));
 @@ -7343,17 +7344,17 @@ maybe_generate_pre_expand_clinit (class_
  
    end_artificial_method_body (mdecl);
  
 -  /* Now we want to place <clinit> as the last method for interface so
 -     that it doesn't interfere with the dispatch table based
 -     lookup. */
 -  if (CLASS_INTERFACE (TYPE_NAME (class_type))
 -      && TREE_CHAIN (TYPE_METHODS (class_type)))
 +  /* Now we want to place <clinit> as the last method (because we need
 +     it at least for interface so that it doesn't interfere with the
 +     dispatch table based lookup. */
 +  if (TREE_CHAIN (TYPE_METHODS (class_type)))
      {
 -      tree current = 
 -	TYPE_METHODS (class_type) = TREE_CHAIN (TYPE_METHODS (class_type));
 +      current = TREE_CHAIN (TYPE_METHODS (class_type));
 +      TYPE_METHODS (class_type) = current;
  
        while (TREE_CHAIN (current))
  	current = TREE_CHAIN (current);
 +
        TREE_CHAIN (current) = mdecl;
        TREE_CHAIN (mdecl) = NULL_TREE;
      }
 @@ -7361,12 +7362,55 @@ maybe_generate_pre_expand_clinit (class_
    return mdecl;
  }
  
 +/* See whether we could get rid of <clinit>. Criteria are: all static
 +   final fields have constant initial values. Return 1 if <clinit> was
 +   discarded, 0 otherwise. */
 +
 +static int
 +maybe_yank_clinit (mdecl)
 +     tree mdecl;
 +{
 +  tree type, current;
 +
 +  if (!DECL_CLINIT_P (mdecl))
 +    return 0;
 +
 +  type = DECL_CONTEXT (mdecl);
 +  current = TYPE_FIELDS (type);
 +
 +  for (current = (current ? TREE_CHAIN (current) : current); 
 +       current; current = TREE_CHAIN (current))
 +    if (!(FIELD_STATIC (current) && FIELD_FINAL (current)
 +	  && DECL_INITIAL (current) && TREE_CONSTANT (DECL_INITIAL (current))))
 +      break;
 +
 +  if (current)
 +    return 0;
 +
 +  /* Get rid of <clinit> in the class' list of methods */
 +  if (TYPE_METHODS (type) == mdecl)
 +    TYPE_METHODS (type) = TREE_CHAIN (mdecl);
 +  else
 +    for (current = TYPE_METHODS (type); current; 
 +	 current = TREE_CHAIN (current))
 +      if (TREE_CHAIN (current) == mdecl)
 +	{
 +	  TREE_CHAIN (current) = TREE_CHAIN (mdecl);
 +	  break;
 +	}
 +
 +  return 1;
 +}
 +
 +
  /* Complete and expand a method.  */
  
  static void
  java_complete_expand_method (mdecl)
       tree mdecl;
  {
 +  int yank_clinit = 0;
 +
    current_function_decl = mdecl;
    /* Fix constructors before expanding them */
    if (DECL_CONSTRUCTOR_P (mdecl))
 @@ -7413,16 +7457,20 @@ java_complete_expand_method (mdecl)
  	  && TREE_CODE (TREE_TYPE (TREE_TYPE (mdecl))) != VOID_TYPE
  	  && !flag_emit_xref)
  	missing_return_error (current_function_decl);
 -
 -      complete_start_java_method (mdecl); 
  
 +      /* Check wether we could just get rid of clinit, now the picture
 +         is complete. */
 +      if (!(yank_clinit = maybe_yank_clinit (mdecl)))
 +	complete_start_java_method (mdecl); 
 +      
        /* Don't go any further if we've found error(s) during the
 -         expansion */
 -      if (!java_error_count)
 +	 expansion */
 +      if (!java_error_count && !yank_clinit)
  	source_end_java_method ();
        else
  	{
 -	  pushdecl_force_head (DECL_ARGUMENTS (mdecl));
 +	  if (java_error_count)
 +	    pushdecl_force_head (DECL_ARGUMENTS (mdecl));
  	  poplevel (1, 0, 1);
  	}
  
 @@ -14513,8 +14558,6 @@ fold_constant_for_init (node, context)
  
    if (code == INTEGER_CST || code == REAL_CST)
      return convert (TREE_TYPE (context), node);
 -  if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
 -    return NULL_TREE;
  
    switch (code)
      {

From: Alexandre Petit-Bianco <apbianco@cygnus.com>
To: java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/131
Date: Wed, 19 Apr 2000 20:42:12 -0700 (PDT)

 Alexandre Petit-Bianco writes:
 >  Oops. The patch triggered regressions. Here's a new patch.
 
 Maybe someday I'll get it right. Third patch.
 
 ./A
 
 2000-04-17  Alexandre Petit-Bianco  <apbianco@cygnus.com>
 
 	* parse.y (maybe_yank_clinit): New function.
 	(maybe_generate_pre_expand_clinit): Always link <clinit> at the
 	end of the list of methods belonging to a class.
 	(java_complete_expand_method): Check whether <clinit> is really
 	necessary and expand it accordingly.
 	(fold_constant_for_init): Let VAR_DECL and FIELD_DECL be processed
 	by the method's switch statement.
 
 Index: parse.y
 ===================================================================
 RCS file: /cvs/gcc/egcs/gcc/java/parse.y,v
 retrieving revision 1.152
 diff -u -p -r1.152 parse.y
 --- parse.y	2000/04/20 02:52:26	1.152
 +++ parse.y	2000/04/20 03:38:46
 @@ -136,6 +136,7 @@ static tree obtain_incomplete_type PARAM
  static tree java_complete_lhs PARAMS ((tree));
  static tree java_complete_tree PARAMS ((tree));
  static tree maybe_generate_pre_expand_clinit PARAMS ((tree));
 +static int maybe_yank_clinit PARAMS ((tree));
  static void java_complete_expand_method PARAMS ((tree));
  static int  unresolved_type_p PARAMS ((tree, tree *));
  static void create_jdep_list PARAMS ((struct parser_ctxt *));
 @@ -7343,17 +7344,17 @@ maybe_generate_pre_expand_clinit (class_
  
    end_artificial_method_body (mdecl);
  
 -  /* Now we want to place <clinit> as the last method for interface so
 -     that it doesn't interfere with the dispatch table based
 -     lookup. */
 -  if (CLASS_INTERFACE (TYPE_NAME (class_type))
 -      && TREE_CHAIN (TYPE_METHODS (class_type)))
 +  /* Now we want to place <clinit> as the last method (because we need
 +     it at least for interface so that it doesn't interfere with the
 +     dispatch table based lookup. */
 +  if (TREE_CHAIN (TYPE_METHODS (class_type)))
      {
 -      tree current = 
 -	TYPE_METHODS (class_type) = TREE_CHAIN (TYPE_METHODS (class_type));
 +      current = TREE_CHAIN (TYPE_METHODS (class_type));
 +      TYPE_METHODS (class_type) = current;
  
        while (TREE_CHAIN (current))
  	current = TREE_CHAIN (current);
 +
        TREE_CHAIN (current) = mdecl;
        TREE_CHAIN (mdecl) = NULL_TREE;
      }
 @@ -7361,12 +7362,63 @@ maybe_generate_pre_expand_clinit (class_
    return mdecl;
  }
  
 +/* See whether we could get rid of <clinit>. Criteria are: all static
 +   final fields have constant initial values and the body of <clinit>
 +   is empty. Return 1 if <clinit> was discarded, 0 otherwise. */
 +
 +static int
 +maybe_yank_clinit (mdecl)
 +     tree mdecl;
 +{
 +  tree type, current;
 +  tree fbody, bbody;
 +  
 +  if (!DECL_CLINIT_P (mdecl))
 +    return 0;
 +  
 +  /* If the body isn't empty, then we keep <clinit> */
 +  fbody = DECL_FUNCTION_BODY (mdecl);
 +  if ((bbody = BLOCK_EXPR_BODY (fbody)))
 +    bbody = BLOCK_EXPR_BODY (bbody);
 +  if (bbody && bbody != empty_stmt_node)
 +    return 0;
 +  
 +  type = DECL_CONTEXT (mdecl);
 +  current = TYPE_FIELDS (type);
 +
 +  for (current = (current ? TREE_CHAIN (current) : current); 
 +       current; current = TREE_CHAIN (current))
 +    if (!(FIELD_STATIC (current) && FIELD_FINAL (current)
 +	  && DECL_INITIAL (current) && TREE_CONSTANT (DECL_INITIAL (current))))
 +      break;
 +
 +  if (current)
 +    return 0;
 +
 +  /* Get rid of <clinit> in the class' list of methods */
 +  if (TYPE_METHODS (type) == mdecl)
 +    TYPE_METHODS (type) = TREE_CHAIN (mdecl);
 +  else
 +    for (current = TYPE_METHODS (type); current; 
 +	 current = TREE_CHAIN (current))
 +      if (TREE_CHAIN (current) == mdecl)
 +	{
 +	  TREE_CHAIN (current) = TREE_CHAIN (mdecl);
 +	  break;
 +	}
 +
 +  return 1;
 +}
 +
 +
  /* Complete and expand a method.  */
  
  static void
  java_complete_expand_method (mdecl)
       tree mdecl;
  {
 +  int yank_clinit = 0;
 +
    current_function_decl = mdecl;
    /* Fix constructors before expanding them */
    if (DECL_CONSTRUCTOR_P (mdecl))
 @@ -7414,15 +7466,19 @@ java_complete_expand_method (mdecl)
  	  && !flag_emit_xref)
  	missing_return_error (current_function_decl);
  
 -      complete_start_java_method (mdecl); 
 -
 +      /* Check wether we could just get rid of clinit, now the picture
 +         is complete. */
 +      if (!(yank_clinit = maybe_yank_clinit (mdecl)))
 +	complete_start_java_method (mdecl); 
 +      
        /* Don't go any further if we've found error(s) during the
 -         expansion */
 -      if (!java_error_count)
 +	 expansion */
 +      if (!java_error_count && !yank_clinit)
  	source_end_java_method ();
        else
  	{
 -	  pushdecl_force_head (DECL_ARGUMENTS (mdecl));
 +	  if (java_error_count)
 +	    pushdecl_force_head (DECL_ARGUMENTS (mdecl));
  	  poplevel (1, 0, 1);
  	}
  
 @@ -14529,8 +14585,6 @@ fold_constant_for_init (node, context)
  
    if (code == INTEGER_CST || code == REAL_CST)
      return convert (TREE_TYPE (context), node);
 -  if (TREE_TYPE (node) != NULL_TREE && code != VAR_DECL && code != FIELD_DECL)
 -    return NULL_TREE;
  
    switch (code)
      {
State-Changed-From-To: open->feedback
State-Changed-By: apbianco
State-Changed-When: Thu Apr 27 14:03:24 2000
State-Changed-Why:
    OK, I'd like to close this PR. I'm attaching the lastest
    patch (it's the third rev.)

From: apbianco@cygnus.com
To: apbianco@cygnus.com, gcb@gnu.org, java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/131
Date: 27 Apr 2000 21:03:24 -0000

 Synopsis: final field initialized with cast expression not treated as constant
 
 State-Changed-From-To: open->feedback
 State-Changed-By: apbianco
 State-Changed-When: Thu Apr 27 14:03:24 2000
 State-Changed-Why:
     OK, I'd like to close this PR. I'm attaching the lastest
     patch (it's the third rev.)
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=131&database=java
State-Changed-From-To: feedback->closed
State-Changed-By: apbianco
State-Changed-When: Thu Jun  1 09:09:15 2000
State-Changed-Why:
    The complete patch was checked in yesterday:
    
      http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01719.html

From: apbianco@cygnus.com
To: apbianco@cygnus.com, gcb@gnu.org, java-gnats@sourceware.cygnus.com
Cc:  
Subject: Re: gcj/131
Date: 1 Jun 2000 16:09:15 -0000

 Synopsis: final field initialized with cast expression not treated as constant
 
 State-Changed-From-To: feedback->closed
 State-Changed-By: apbianco
 State-Changed-When: Thu Jun  1 09:09:15 2000
 State-Changed-Why:
     The complete patch was checked in yesterday:
     
       http://gcc.gnu.org/ml/gcc-patches/2000-05/msg01719.html
 
 http://sourceware.cygnus.com/cgi-bin/gnatsweb.pl?cmd=view&pr=131&database=java
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="const_iface.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="const_iface.java"

Y2xhc3MgZmluYWxfY29uc3QKewogICAgc3RhdGljIGZpbmFsIGJ5dGUgQ09OU1QgPSAoYnl0ZSkx
NzsKICAgIAogICAgcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpCiAgICB7
Cglzd2l0Y2ggKDEpCgl7CgkgICAgY2FzZSBDT05TVDoJYnJlYWs7Cgl9CiAgICB9Cn0K----gnatsweb-attachment----
Content-Type: application/octet-stream; name="patch-131"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="patch-131"

MjAwMC0wNC0xNyAgQWxleGFuZHJlIFBldGl0LUJpYW5jbyAgPGFwYmlhbmNvQGN5Z251cy5jb20+
CgoJKiBwYXJzZS55IChtYXliZV95YW5rX2NsaW5pdCk6IE5ldyBmdW5jdGlvbi4KCShtYXliZV9n
ZW5lcmF0ZV9wcmVfZXhwYW5kX2NsaW5pdCk6IEFsd2F5cyBsaW5rIDxjbGluaXQ+IGF0IHRoZQoJ
ZW5kIG9mIHRoZSBsaXN0IG9mIG1ldGhvZHMgYmVsb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cl9jb3VudCkKKwkgZXhwYW5zaW9uICovCisgICAgICBpZiAoIWphdmFfZXJyb3Jf
Y291bnQgJiYgIXlhbmtfY2xpbml0KQogCXNvdXJjZV9lbmRfamF2YV9tZXRob2QgKCk7CiAgICAg
ICBlbHNlCiAJewotCSAgcHVzaGRlY2xfZm9yY2VfaGVhZCAoREVDTF9BUkdVTUVOVFMgKG1kZWNs
KSk7CisJICBpZiAoamF2YV9lcnJvcl9jb3VudCkKKwkgICAgcHVzaGRlY2xfZm9yY2VfaGVhZCAo
REVDTF9BUkdVTUVOVFMgKG1kZWNsKSk7CiAJICBwb3BsZXZlbCAoMSwgMCwgMSk7CiAJfQogCkBA
IC0xNDUyOSw4ICsxNDU4NSw2IEBAIGZvbGRfY29uc3RhbnRfZm9yX2luaXQgKG5vZGUsIGNvbnRl
eHQpCiAKICAgaWYgKGNvZGUgPT0gSU5URUdFUl9DU1QgfHwgY29kZSA9PSBSRUFMX0NTVCkKICAg
ICByZXR1cm4gY29udmVydCAoVFJFRV9UWVBFIChjb250ZXh0KSwgbm9kZSk7Ci0gIGlmIChUUkVF
X1RZUEUgKG5vZGUpICE9IE5VTExfVFJFRSAmJiBjb2RlICE9IFZBUl9ERUNMICYmIGNvZGUgIT0g
RklFTERfREVDTCkKLSAgICByZXR1cm4gTlVMTF9UUkVFOwogCiAgIHN3aXRjaCAoY29kZSkKICAg
ICB7Cg==



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-12-20 12:08 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-12-20 12:08 java/1140: final field initialized with cast expression not treated as constant gcb

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