From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18562 invoked by alias); 21 Feb 2010 18:32:21 -0000 Received: (qmail 18439 invoked by alias); 21 Feb 2010 18:32:06 -0000 Date: Sun, 21 Feb 2010 18:32:00 -0000 Message-ID: <20100221183206.18438.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/msg02174.txt.bz2 ------- Comment #17 from joseph at codesourcery dot com 2010-02-21 18:32 ------- Subject: Re: [4.5 Regression] c-c++-common/pr41779.c doesn't work On Sun, 21 Feb 2010, manu at gcc dot gnu dot org wrote: > ------- Comment #16 from manu at gcc dot gnu dot org 2010-02-21 18:25 ------- > (In reply to comment #15) > > > > With the intended semantics, we should warn; there would be an actual > > conversion from integer to float there, that could change the value. > > Great. Any hints where could be the problem or fix? Where convert_and_check is called, for (a) conditional expressions and (b) binary operations, to convert two operands to a common type, the conversion is (correctly) to the type with excess precision (possibly long double where the semantic type is narrower, float or double). I would suggest having a c_ep_convert_and_check or similar function that handles excess precision: it would take the result type, the semantic result type (the type that gets used eventually to build an EXCESS_PRECISION_EXPR) and the value to convert. It would just call convert_and_check, ignoring the semantic type, *except* when the operand has integer type *and* the semantic type is non-NULL; in that case, it would first convert to the semantic type them to the result type. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43128