public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "joseph at codesourcery dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/43128] [4.5 Regression] c-c++-common/pr41779.c doesn't work
Date: Tue, 23 Feb 2010 16:39:00 -0000	[thread overview]
Message-ID: <20100223163844.10072.qmail@sourceware.org> (raw)
In-Reply-To: <bug-43128-682@http.gcc.gnu.org/bugzilla/>



------- 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


  parent reply	other threads:[~2010-02-23 16:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-20  7:12 [Bug c/43128] New: " hjl dot tools at gmail dot com
2010-02-20 10:40 ` [Bug c/43128] " manu at gcc dot gnu dot org
2010-02-20 11:00   ` Andrew Pinski
2010-02-20 11:01 ` pinskia at gmail dot com
2010-02-20 11:51 ` manu at gcc dot gnu dot org
2010-02-20 11:51 ` manu at gcc dot gnu dot org
2010-02-20 13:52 ` rguenth at gcc dot gnu dot org
2010-02-20 15:53 ` hjl dot tools at gmail dot com
2010-02-21 15:39 ` hjl dot tools at gmail dot com
2010-02-21 15:56 ` hjl dot tools at gmail dot com
2010-02-21 16:16 ` hjl dot tools at gmail dot com
2010-02-21 16:46 ` [Bug c/43128] [4.5 Regression] " hjl dot tools at gmail dot com
2010-02-21 16:48 ` hjl dot tools at gmail dot com
2010-02-21 17:25 ` manu at gcc dot gnu dot org
2010-02-21 17:43 ` joseph at codesourcery dot com
2010-02-21 17:57 ` manu at gcc dot gnu dot org
2010-02-21 18:00 ` hjl dot tools at gmail dot com
2010-02-21 18:16 ` joseph at codesourcery dot com
2010-02-21 18:25 ` manu at gcc dot gnu dot org
2010-02-21 18:32 ` joseph at codesourcery dot com
2010-02-22 23:56 ` manu at gcc dot gnu dot org
2010-02-23  0:27 ` manu at gcc dot gnu dot org
2010-02-23  0:30 ` joseph at codesourcery dot com
2010-02-23  8:39 ` manu at gcc dot gnu dot org
2010-02-23 10:23 ` manu at gcc dot gnu dot org
2010-02-23 16:32 ` joseph at codesourcery dot com
2010-02-23 16:39 ` joseph at codesourcery dot com [this message]
2010-02-23 17:34 ` manu at gcc dot gnu dot org
2010-02-24 10:39 ` manu at gcc dot gnu dot org
2010-02-24 13:10 ` manu at gcc dot gnu dot org
2010-02-24 13:10 ` manu at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100223163844.10072.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).