Patchwork [fortran] Reap dead code

login
register
mail settings
Submitter Steve Kargl
Date Oct. 22, 2011, 8:16 p.m.
Message ID <20111022201614.GA23280@troutmask.apl.washington.edu>
Download mbox | patch
Permalink /patch/121189/
State New
Headers show

Comments

Steve Kargl - Oct. 22, 2011, 8:16 p.m.
The attach patch reaps some code that is now dead
due to my recent changes for ishftc in check.c.
Regression tested on i686-*-freebsd.

2011-10-22  Steevn G. Kargl  <kargl@gcc.gnu.org>

	* simplify.c (gfc_simplify_ishftc): Reap dead code.

Patch

Index: simplify.c
===================================================================
--- simplify.c	(revision 180320)
+++ simplify.c	(working copy)
@@ -3145,51 +3145,20 @@  gfc_simplify_ishftc (gfc_expr *e, gfc_ex
   if (e->expr_type != EXPR_CONSTANT || s->expr_type != EXPR_CONSTANT)
     return NULL;
 
-  if (gfc_extract_int (s, &shift) != NULL)
-    {
-      gfc_error ("Invalid second argument of ISHFTC at %L", &s->where);
-      return &gfc_bad_expr;
-    }
+  gfc_extract_int (s, &shift);
 
   k = gfc_validate_kind (e->ts.type, e->ts.kind, false);
-  isize = gfc_integer_kinds[k].bit_size;
+  ssize = isize = gfc_integer_kinds[k].bit_size;
 
   if (sz != NULL)
     {
       if (sz->expr_type != EXPR_CONSTANT)
 	return NULL;
 
-      if (gfc_extract_int (sz, &ssize) != NULL || ssize <= 0)
-	{
-	  gfc_error ("Invalid third argument of ISHFTC at %L", &sz->where);
-	  return &gfc_bad_expr;
-	}
-
-      if (ssize > isize)
-	{
-	  gfc_error ("Magnitude of third argument of ISHFTC exceeds "
-		     "BIT_SIZE of first argument at %L", &s->where);
-	  return &gfc_bad_expr;
-	}
+      gfc_extract_int (sz, &ssize);
     }
-  else
-    ssize = isize;
-
-  if (shift >= 0)
-    ashift = shift;
-  else
-    ashift = -shift;
 
-  if (ashift > ssize)
-    {
-      if (sz != NULL)
-	gfc_error ("Magnitude of second argument of ISHFTC exceeds "
-		   "third argument at %L", &s->where);
-      else
-	gfc_error ("Magnitude of second argument of ISHFTC exceeds "
-		   "BIT_SIZE of first argument at %L", &s->where);
-      return &gfc_bad_expr;
-    }
+  ashift = (shift >= 0) ? shift : -shift;
 
   result = gfc_get_constant_expr (e->ts.type, e->ts.kind, &e->where);