From patchwork Thu Oct 23 13:42:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 402519 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 8479B1400F4 for ; Fri, 24 Oct 2014 00:46:43 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=IoRtd8c83hwgOt6iy70H+X/1vFU2OTpbUUjei27NlRREnxRDQ2sul 6HlpeFhVdbHbX3zeBrtB/fWjsKMV0LWFT/Ta6vhVC1/e4MvBy38rbR9j7JGVtpD9 gU84qW8TXcvCv3RmDT7BgWwXjUxbUXbFAy9l0y6HRFZf8bDDTfEjZc= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=w3kkskQmj8f7f53VPp4Fm2+y0QI=; b=t8pg74tkJm6sdNfYvTEF rSJ2fR4R4IIHt+q1s2UiAyvH+NjRBUBhmnAfwtMwceVaJHUI/11CTFcMr4pz8SK/ YUcgXhezrBTIoDoG/mdVnl4obczVbUSa/PEDxj9lJEPkNqQsdb26DHNRpT7pbZ2Q y3N5Scmz/Phj5WWMtnrwQJY= Received: (qmail 11902 invoked by alias); 23 Oct 2014 13:46:31 -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 11848 invoked by uid 89); 23 Oct 2014 13:46:30 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx2.suse.de Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (CAMELLIA256-SHA encrypted) ESMTPS; Thu, 23 Oct 2014 13:46:28 +0000 Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E0263ABA5 for ; Thu, 23 Oct 2014 13:46:24 +0000 (UTC) Date: Thu, 23 Oct 2014 15:42:20 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix copy&paste error in fold Message-ID: User-Agent: Alpine 2.11 (LSU 23 2013-08-11) MIME-Version: 1.0 The following makes sure to convert the correct argument, not the one we already converted. Currently we end up folding ptr-type - integer-type. Oops. Fails spectacularly on match-and-simplify where this is the first strip-nops missed-optimization (on bogus input, that is). I'm considering this is obvious but will include it in a bootstrap/regtest anyway. Thanks, Richard. 2014-10-23 Richard Biener * fold-const.c (fold_binary_loc): Fix copy-and-pasto. Index: gcc/fold-const.c =================================================================== --- gcc/fold-const.c (revision 216546) +++ gcc/fold-const.c (working copy) @@ -10596,8 +10596,9 @@ fold_binary_loc (location_t loc, TREE_OPERAND (arg1, 0)); tree arg11 = fold_convert_loc (loc, type, TREE_OPERAND (arg1, 1)); - tree tmp = fold_binary_loc (loc, MINUS_EXPR, type, arg0, - fold_convert_loc (loc, type, arg10)); + tree tmp = fold_binary_loc (loc, MINUS_EXPR, type, + fold_convert_loc (loc, type, arg0), + arg10); if (tmp) return fold_build2_loc (loc, MINUS_EXPR, type, tmp, arg11); }