From patchwork Sat Oct 22 20:16:14 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Kargl X-Patchwork-Id: 121189 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id BDC0BB70C7 for ; Sun, 23 Oct 2011 07:16:42 +1100 (EST) Received: (qmail 6903 invoked by alias); 22 Oct 2011 20:16:36 -0000 Received: (qmail 6868 invoked by uid 22791); 22 Oct 2011 20:16:29 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_HF X-Spam-Check-By: sourceware.org Received: from troutmask.apl.washington.edu (HELO troutmask.apl.washington.edu) (128.95.76.21) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 22 Oct 2011 20:16:15 +0000 Received: from troutmask.apl.washington.edu (localhost.apl.washington.edu [127.0.0.1]) by troutmask.apl.washington.edu (8.14.5/8.14.5) with ESMTP id p9MKGEL4023290; Sat, 22 Oct 2011 13:16:14 -0700 (PDT) (envelope-from sgk@troutmask.apl.washington.edu) Received: (from sgk@localhost) by troutmask.apl.washington.edu (8.14.5/8.14.5/Submit) id p9MKGEna023289; Sat, 22 Oct 2011 13:16:14 -0700 (PDT) (envelope-from sgk) Date: Sat, 22 Oct 2011 13:16:14 -0700 From: Steve Kargl To: fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [PATCH,fortran] Reap dead code Message-ID: <20111022201614.GA23280@troutmask.apl.washington.edu> Mime-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * simplify.c (gfc_simplify_ishftc): Reap dead code. 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);