public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101953] New: bug on the default cast operator from double to unsigned short
@ 2021-08-17 22:19 mlwmohawk at gmail dot com
  2021-08-17 22:19 ` [Bug c/101953] " mlwmohawk at gmail dot com
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: mlwmohawk at gmail dot com @ 2021-08-17 22:19 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101953
           Summary: bug on the default cast operator from double to
                    unsigned short
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mlwmohawk at gmail dot com
  Target Milestone: ---

markw@snoopy:~$ gcc --version
gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
markw@snoopy:~$ ./badpi
-32000 vs -32000

On Raspberry PI:
pi@raspberrypi:~ $ gcc --version
gcc (Raspbian 8.3.0-6+rpi1) 8.3.0
pi@raspberrypi:~ $ ./badpi
0 vs -32000

This is the code:
#include <stdio.h>
#include <stdint.h>
#include <math.h>

int main(int argc, char **argv)
{
    uint32_t foo;
    int bar;
    double val = -32000;

    bar = ceil(val);
    foo = ceil(val);

    printf("%d vs %d\n", foo, bar);
}

gcc -Wall -o badpi badpi.c -lm

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2021-08-18 22:12 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 22:19 [Bug c/101953] New: bug on the default cast operator from double to unsigned short 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
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

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