This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, fortran] Cosmetics: Dup. code removal, indent fix, typo fix.


Hi Jerry,

thanks for the review. Committed as r220345.

Regards,
	Andre

On Sat, 31 Jan 2015 07:41:24 -0800
Jerry DeLisle <jvdelisle@charter.net> wrote:

> On 01/30/2015 04:10 AM, Andre Vehreschild wrote:
> > Hi all,
> >
> > I fear this fix is not so obvious in one location, I therefore ask for a
> > review. The attached patch fixes:
> >
> > - a duplicate code fragment (possibly due to merged twice),
> > - the indentation in the trans-expr.c block (in my first patch), and
> > - a typo on the datatype-size to create for the charlen.
> >
> > The length of a char-array is stored as a 4-byte BT_INTEGER. Due to a typo a
> > 1-byte BT_INTEGER was requested. The patch fixes this. I know this patch
> > mixes several trivial issues. Should I do separate patches for each of
> > them, or what is the most desirable method?
> >
> 
> Cosmetic things are OK to throw in the mix as long as you have the Changelog. 
> Duplicate code removal is just about as obvious as one can get. No need for 
> separate patches.
> 
> > Bootstraps and regtests ok on x86_64-linux-gnu/FC20.
> >
> 
> I have learned the hard way that if you forget the testing even on trivial 
> things it can byte you.  OK to commit!  Thanks.


-- 
Andre Vehreschild * Email: vehre ad gmx dot de 
Index: gcc/fortran/trans-decl.c
===================================================================
--- gcc/fortran/trans-decl.c	(Revision 220344)
+++ gcc/fortran/trans-decl.c	(Arbeitskopie)
@@ -1443,8 +1443,6 @@
       if (sym->ts.type == BT_CLASS && sym->backend_decl)
 	GFC_DECL_CLASS(sym->backend_decl) = 1;
 
-      if (sym->ts.type == BT_CLASS && sym->backend_decl)
-	GFC_DECL_CLASS(sym->backend_decl) = 1;
      return sym->backend_decl;
     }
 
Index: gcc/fortran/trans-expr.c
===================================================================
--- gcc/fortran/trans-expr.c	(Revision 220344)
+++ gcc/fortran/trans-expr.c	(Arbeitskopie)
@@ -660,26 +660,26 @@
 	 expression can be evaluated to a constant one.  */
       else
         {
-          /* Try to simplify the expression.  */
-          gfc_simplify_expr (e, 0);
-          if (e->expr_type == EXPR_CONSTANT && !e->ts.u.cl->resolved)
-            {
-              /* Amazingly all data is present to compute the length of a
-                 constant string, but the expression is not yet there.  */
-              e->ts.u.cl->length = gfc_get_constant_expr (BT_INTEGER, 1,
-                                                          &e->where);
-              mpz_set_ui (e->ts.u.cl->length->value.integer,
-                          e->value.character.length);
-              gfc_conv_const_charlen (e->ts.u.cl);
-              e->ts.u.cl->resolved = 1;
-              gfc_add_modify (&parmse->pre, ctree, e->ts.u.cl->backend_decl);
-            }
-          else
-            {
-              gfc_error ("Can't compute the length of the char array at %L.",
-                         &e->where);
-            }
-        }
+	  /* Try to simplify the expression.  */
+	  gfc_simplify_expr (e, 0);
+	  if (e->expr_type == EXPR_CONSTANT && !e->ts.u.cl->resolved)
+	    {
+	      /* Amazingly all data is present to compute the length of a
+		 constant string, but the expression is not yet there.  */
+	      e->ts.u.cl->length = gfc_get_constant_expr (BT_INTEGER, 4,
+							  &e->where);
+	      mpz_set_ui (e->ts.u.cl->length->value.integer,
+			  e->value.character.length);
+	      gfc_conv_const_charlen (e->ts.u.cl);
+	      e->ts.u.cl->resolved = 1;
+	      gfc_add_modify (&parmse->pre, ctree, e->ts.u.cl->backend_decl);
+	    }
+	  else
+	    {
+	      gfc_error ("Can't compute the length of the char array at %L.",
+			 &e->where);
+	    }
+	}
     }
   /* Pass the address of the class object.  */
   parmse->expr = gfc_build_addr_expr (NULL_TREE, var);
Index: gcc/fortran/ChangeLog
===================================================================
--- gcc/fortran/ChangeLog	(Revision 220344)
+++ gcc/fortran/ChangeLog	(Arbeitskopie)
@@ -1,3 +1,10 @@
+
+2015-01-30  Andre Vehreschild  <vehre@gmx.de>
+
+	* trans-decl.c (gfc_get_symbol_decl): Removed duplicate code.
+	* trans-expr.c (gfc_conv_intrinsic_to_class): Fixed indentation.
+	Fixed datatype of charlen to be a 32-bit int.
+
 2015-02-01  Joseph Myers  <joseph@codesourcery.com>
 
 	* error.c (gfc_warning (const char *, ...), gfc_warning_now (const

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]