public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mlwmohawk at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101953] bug on the default cast operator from double to unsigned short
Date: Wed, 18 Aug 2021 00:32:27 +0000	[thread overview]
Message-ID: <bug-101953-4-mCD5hCi3EZ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101953-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953

M W <mlwmohawk at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|INVALID                     |---
             Status|RESOLVED                    |UNCONFIRMED

--- Comment #3 from M W <mlwmohawk at gmail dot com> ---
(In reply to Andreas Schwab from comment #2)
> -32000.0 is outside the range of uint32_t, thus the conversion is undefined.

I understand your response, but I disagree. Why is it different than x86_64? I
have been using gcc for literally decades and have NEVER seen this evaluation.
Why is it different from 9.3.0?

On CentOS 7, we get

[root@localhost ~]# gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-16)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@localhost ~]# ./badpi 
-32000 vs -32000


This is a bug that breaks real code. There is an extra step being taken on
raspberry pi that breaks existing code. 

If you think this is the correct behavior, remember, it is unexpected. At least
give a warning when a value is set to zero instead of a faithful attempt to
return the correct bits.

  parent reply	other threads:[~2021-08-18  0:32 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 22:19 [Bug c/101953] New: " mlwmohawk at gmail dot com
2021-08-17 22:19 ` [Bug c/101953] " mlwmohawk at gmail dot com
2021-08-17 22:51 ` schwab@linux-m68k.org
2021-08-18  0:32 ` mlwmohawk at gmail dot com [this message]
2021-08-18  0:40 ` pinskia at gcc dot gnu.org
2021-08-18  0:41 ` pinskia at gcc dot gnu.org
2021-08-18  1:11 ` mlwmohawk at gmail dot com
2021-08-18  1:12 ` mlwmohawk at gmail dot com
2021-08-18  1:22 ` pinskia at gcc dot gnu.org
2021-08-18  1:23 ` pinskia at gcc dot gnu.org
2021-08-18  1:26 ` pinskia at gcc dot gnu.org
2021-08-18  1:26 ` pinskia at gcc dot gnu.org
2021-08-18  1:32 ` pinskia at gcc dot gnu.org
2021-08-18  1:36 ` pinskia at gcc dot gnu.org
2021-08-18  1:41 ` pinskia at gcc dot gnu.org
2021-08-18  3:01 ` mlwmohawk at gmail dot com
2021-08-18  3:03 ` pinskia at gcc dot gnu.org
2021-08-18  3:05 ` pinskia at gcc dot gnu.org
2021-08-18  3:21 ` mlwmohawk at gmail dot com
2021-08-18  3:37 ` mlwmohawk at gmail dot com
2021-08-18  3:59 ` pinskia at gcc dot gnu.org
2021-08-18  6:02 ` pinskia at gcc dot gnu.org
2021-08-18 12:26 ` harald at gigawatt dot nl
2021-08-18 15:23 ` msebor at gcc dot gnu.org
2021-08-18 15:34 ` mlwmohawk at gmail dot com
2021-08-18 20:44 ` joseph at codesourcery dot com
2021-08-18 21:59 ` mlwmohawk at gmail dot com
2021-08-18 22:05 ` harald at gigawatt dot nl
2021-08-18 22:12 ` jakub at gcc dot gnu.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=bug-101953-4-mCD5hCi3EZ@http.gcc.gnu.org/bugzilla/ \
    --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).