[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #28 from Jakub Jelinek --- That flag does work: gcc -fsanitize=float-cast-overflow -Wall -o pr101953{,.c} -lm; ./pr101953 pr101953.c:12:11: runtime error: -32000 is outside the range of representable values of type 'unsigned int'

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread harald at gigawatt dot nl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #27 from Harald van Dijk --- (In reply to jos...@codesourcery.com from comment #25) > The option to use to detect this is -fsanitize=float-cast-overflow (note: > I haven't tested if it detects this particular case). As per the

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #26 from M W --- pi@raspberrypi:~ $ gcc -fsanitize=float-cast-overflow -Wall -o badpi badpi.c -lm pi@raspberrypi:~ $ That flag doesn't work

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread joseph at codesourcery dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #25 from joseph at codesourcery dot com --- The option to use to detect this is -fsanitize=float-cast-overflow (note: I haven't tested if it detects this particular case). As per the manual: "Unlike other similar options,

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #24 from M W --- I know it is documented as "undefined," but it is also unexpected without even a warning. Anyone maintaining code and/or porting to rpi will simply not expect this behavior. I certainly didn't. I had been using my

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread msebor at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Martin Sebor changed: What|Removed |Added CC||msebor at gcc dot gnu.org --- Comment

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread harald at gigawatt dot nl via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Harald van Dijk changed: What|Removed |Added CC||harald at gigawatt dot nl ---

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-18 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #21 from Andrew Pinski --- (In reply to M W from comment #18) > I can't believe that this is acceptable. Shocked. in fact. You should read bug 323.

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 M W changed: What|Removed |Added Resolution|INVALID |--- Status|RESOLVED

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #18 from M W --- I can't believe that this is acceptable. Shocked. in fact.

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #17 from Andrew Pinski --- (In reply to M W from comment #15) > I'm quite sure that is impacting way more projects than have realized it. Almost all of the open source ones have been fixed years ago. Both with IBM and ARM doing a

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andrew Pinski changed: What|Removed |Added Resolution|--- |INVALID Status|UNCONFIRMED

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 M W changed: What|Removed |Added Resolution|INVALID |--- Status|RESOLVED

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #14 from Andrew Pinski --- MIPS64 does: trunc.w.d $f0,$f0 ; int c.le.d $fcc0,$f1,$f0 bc1t$fcc0,.L2 nop trunc.w.d $f0,$f0 mfc1$2,$f0 b .L3 nop .L2:

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #13 from Andrew Pinski --- Newer PowerPC does: fctiwz 0,0 ; int fctiwuz 0,0 ;unsigned Older PPC does: fctiwz 0,0 ; int fctidz 0,0 ; unsigned So it depends on which generation of PowerPC ISA you use.

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #12 from Andrew Pinski --- For aarch64 we do: fcvtzs w0, d0 ; int fcvtzu w0, d0 ; uint32_t For ARM: vcvt.s32.f64s15, d16 ; int vcvt.u32.f64s15, d7 ; uint32_t For x86 we do:

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #11 from Andrew Pinski --- (In reply to Andrew Pinski from comment #10) > 6.3.1.4 Real floating and integer > 1 When a finite value of real floating type is converted to an integer type > other than _Bool, > the fractional part is

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #10 from Andrew Pinski --- 6.3.1.4 Real floating and integer 1 When a finite value of real floating type is converted to an integer type other than _Bool, the fractional part is discarded (i.e., the value is truncated toward zero).

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andrew Pinski changed: What|Removed |Added Resolution|DUPLICATE |INVALID --- Comment #9 from Andrew

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andrew Pinski changed: What|Removed |Added Resolution|--- |DUPLICATE

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 M W changed: What|Removed |Added Status|RESOLVED|UNCONFIRMED Resolution|INVALID

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #6 from M W --- "Unexpected because not understanding C/C++ standard is normal these days." I'm sort of ticked off by that. I have used some form of this code for over two decades on a lot of different platforms. Mac, Windows,

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #5 from Andrew Pinski --- >it is unexpected. Unexpected because not understanding C/C++ standard is normal these days.

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |RESOLVED Resolution|---

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 M W changed: What|Removed |Added Resolution|INVALID |--- Status|RESOLVED

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 Andreas Schwab changed: What|Removed |Added Resolution|--- |INVALID

[Bug c/101953] bug on the default cast operator from double to unsigned short

2021-08-17 Thread mlwmohawk at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101953 --- Comment #1 from M W --- This also happens on C++