From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10246 invoked by alias); 23 Feb 2010 16:39:01 -0000 Received: (qmail 10073 invoked by alias); 23 Feb 2010 16:38:44 -0000 Date: Tue, 23 Feb 2010 16:39:00 -0000 Message-ID: <20100223163844.10072.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "joseph at codesourcery dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-02/txt/msg02342.txt.bz2 ------- Comment #23 from joseph at codesourcery dot com 2010-02-23 16:38 ------- Subject: Re: [4.5 Regression] c-c++-common/pr41779.c doesn't work On Tue, 23 Feb 2010, manu at gcc dot gnu dot org wrote: > ------- Comment #21 from manu at gcc dot gnu dot org 2010-02-23 10:23 ------- > (In reply to comment #19) > > > > The present logic is: convert (with convert_and_check) both operands to a > > common type, which may have excess precision; then, later, after producing > > the tree for the result of the operation, wrap that in an > > EXCESS_PRECISION_EXPR, using the semantic type, if there is a semantic > > type different from the type with excess precision. > > This is only true for build_binary_op. In build_conditional_expr both operands > are converted to the semantic type first, if I am reading the code correctly, > so there is nothing to fix (in fact, I cannot build a testcase that misses the > warning when using conditional expression). No, the conversion is to the type with excess precision. Try: float a; int b; int c; long double f(void) { return c ? a + a : b; } If you use "a" instead of "a + a", then it's just a float rather than a long double wrapped in an EXCESS_PRECISION_EXPR. build_binary_op explicitly adds excess precision early on for various operations where it is necessary to describe the semantics of what the processor can do. But there is no need to add excess precision for a conditional expression - just to handle operands that already have it. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43128