From patchwork Wed Jul 17 16:41:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: pchang9@cs.wisc.edu X-Patchwork-Id: 259717 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id B040A2C0079 for ; Thu, 18 Jul 2013 02:41:33 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:subject:from:to:mime-version:content-type; q= dns; s=default; b=jdtmmKgNG8rGlylXkngaEX7W4MfZuFfNZQvnPRQonOl/Fs p1xfd5OY5kPHhevZyU9RCwcJFRaIsixKkR0k92XFslbNbb+of8Rpvdcx6WhL0CTw nhe1VzGln5KYgBeoWqI2/hXay8QEg3wUDy4tYlQ5wdDTEZBIQPXsyAtGlfc00= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:subject:from:to:mime-version:content-type; s= default; bh=ydtOLQSjHfrGlHyaSI2dr4ilBRI=; b=oIoFOn/aSLpo1u5O7cVk uClkXJObXAvCNI+2+UCSW9rNKloVRw0TceZY38+JA4Cz///L2nLvES7X0V7CSRRG obVdZFI9b4vwXzpdiGo/+07ZAlX0ISaWdRjpa16rY15/RUdsJEWJ0M7RiPFJgFGc xkCYC8KO6hiyPnJ9wzCtC38= Received: (qmail 13418 invoked by alias); 17 Jul 2013 16:41:27 -0000 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 Received: (qmail 13386 invoked by uid 89); 17 Jul 2013 16:41:26 -0000 X-Spam-SWARE-Status: No, score=-3.3 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_MED, RCVD_IN_HOSTKARMA_W, RDNS_NONE, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.1 Received: from Unknown (HELO sandstone.cs.wisc.edu) (128.105.6.39) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Wed, 17 Jul 2013 16:41:26 +0000 Received: from webmail.cs.wisc.edu (george.cs.wisc.edu [128.105.7.110]) by sandstone.cs.wisc.edu (8.14.1/8.14.1) with ESMTP id r6HGfIVR003003 for ; Wed, 17 Jul 2013 11:41:18 -0500 Received: from 72.33.255.231 (SquirrelMail authenticated user pchang9) by webmail.cs.wisc.edu with HTTP; Wed, 17 Jul 2013 11:41:18 -0500 Message-ID: <4978b6a088d027de6688a6baf6f8016d.squirrel@webmail.cs.wisc.edu> Date: Wed, 17 Jul 2013 11:41:18 -0500 Subject: [Patch, PR 57810] Wasted work in validate_const_int() From: pchang9@cs.wisc.edu To: gcc-patches@gcc.gnu.org User-Agent: SquirrelMail/1.4.22 MIME-Version: 1.0 X-Virus-Found: No Hi, The problem appears in revision 200945 in version 4.9. I attached a one-line patch that fixes it. I also reported this problem at http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57810 . In method "validate_const_int()" in "gcc/read-rtl.c", the loop on line 804 should break immediately after "valid" is set to "0". All the iterations after "valid" set to "0" do not perform any useful work, at best they just set "valid" again to "0". Suggested patch: -Chang Index: gcc/read-rtl.c =================================================================== --- gcc/read-rtl.c (revision 200945) +++ gcc/read-rtl.c (working copy) @@ -803,7 +803,11 @@ valid = 0; for (; *cp; cp++) if (! ISDIGIT (*cp)) - valid = 0; + { + valid = 0; + break; + } + if (!valid) fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string); } Index: gcc/read-rtl.c =================================================================== --- gcc/read-rtl.c (revision 200945) +++ gcc/read-rtl.c (working copy) @@ -803,7 +803,11 @@ valid = 0; for (; *cp; cp++) if (! ISDIGIT (*cp)) - valid = 0; + { + valid = 0; + break; + } + if (!valid) fatal_with_file_and_line ("invalid decimal constant \"%s\"\n", string); }