From patchwork Fri Jul 29 09:56:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 107362 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 42841B6EE8 for ; Fri, 29 Jul 2011 19:56:45 +1000 (EST) Received: (qmail 30100 invoked by alias); 29 Jul 2011 09:56:42 -0000 Received: (qmail 30091 invoked by uid 22791); 29 Jul 2011 09:56:41 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, TW_BG X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 29 Jul 2011 09:56:27 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id 2DEA08980B for ; Fri, 29 Jul 2011 11:56:26 +0200 (CEST) Date: Fri, 29 Jul 2011 11:56:26 +0200 (CEST) From: Richard Guenther To: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix comparison type in builtin folding Message-ID: User-Agent: Alpine 2.00 (LNX 1167 2008-08-23) MIME-Version: 1.0 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 I noticed the following when LTOing libgfortran into polyhedron with -Ofast which delays signbit folding and exposes the bogus comparison type to the new stricter type checking. Bootstrapped and tested on x86_64-unknown-linux-gnu, applied. Richard. 2011-07-29 Richard Guenther * builtins.c (fold_builtin_signbit): Build the comparison with a proper type. Index: gcc/builtins.c =================================================================== --- gcc/builtins.c (revision 176920) +++ gcc/builtins.c (working copy) @@ -8645,8 +8645,9 @@ fold_builtin_signbit (location_t loc, tr /* If ARG's format doesn't have signed zeros, return "arg < 0.0". */ if (!HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (arg)))) - return fold_build2_loc (loc, LT_EXPR, type, arg, - build_real (TREE_TYPE (arg), dconst0)); + return fold_convert (type, + fold_build2_loc (loc, LT_EXPR, boolean_type_node, arg, + build_real (TREE_TYPE (arg), dconst0))); return NULL_TREE; }