public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "amylaar at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/27394] double -> char conversion varies with optimization level
Date: Tue, 02 May 2006 18:21:00 -0000	[thread overview]
Message-ID: <20060502182122.29217.qmail@sourceware.org> (raw)
In-Reply-To: <bug-27394-5394@http.gcc.gnu.org/bugzilla/>



------- Comment #5 from amylaar at gcc dot gnu dot org  2006-05-02 18:21 -------
(In reply to comment #4)
> (In reply to comment #1)
> > In 3.x, double -> char/int conversion was done consistently with the documented
> > behaviour of integer -> signed integer type conversion.
> > http://gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Integers-implementation.html#Integers-implementation.
> 
> That has nothing to do with float -> integer type conversion.

Actually, it has, in two ways:

- The wording is inexact.  You could argue that 128. is an integer in floating 
  point representation and thus covered by this clause.  Although from the
  context, it appears that that was not the intent.
- When the return statement is changed to "return (signed char)(int) d;",
  the clause applies, and indeed the behaviour becomes consistent.
  Having different semantics when you add an itermediate cast to int before
  casting to signed char is somewhat surprising.
  (I.e. although a conforming implementation, it does not follow the rule
   of least surprise.)


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27394


  parent reply	other threads:[~2006-05-02 18:21 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-02 17:14 [Bug tree-optimization/27394] New: " amylaar at gcc dot gnu dot org
2006-05-02 17:53 ` [Bug tree-optimization/27394] " amylaar at gcc dot gnu dot org
2006-05-02 17:55 ` pinskia at gcc dot gnu dot org
2006-05-02 17:58 ` pinskia at gcc dot gnu dot org
2006-05-02 18:00 ` pinskia at gcc dot gnu dot org
2006-05-02 18:21 ` amylaar at gcc dot gnu dot org [this message]
2006-05-03  9:17 ` schwab at suse dot de
2006-05-29 22:19 ` pinskia at gcc dot gnu dot org
2006-11-15 16:28 ` amylaar 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=20060502182122.29217.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).