[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-02-10 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #13 from Дилян Палаузов --- For clang being buggy from https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679#c11 I filled https://github.com/llvm/llvm-project/issues/81358 .

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-02-06 Thread egallager at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 Eric Gallager changed: What|Removed |Added CC||egallager at gcc dot gnu.org ---

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #11 from Jakub Jelinek --- Anyway, seems clang is buggy: clang -O2 -m32 -mno-sse -mfpmath=387 -fexcess-precision=standard #include int main () { #if FLT_EVAL_METHOD == 2 && LDBL_MANT_DIG == 64 && DBL_MANT_DIG == 53 if ((double)

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #10 from Jakub Jelinek --- Oh, you mean the pow equality comparison. I think you should study something about floating point, errors, why equality comparisons of floating point values are usually a bad idea etc. There is no gcc

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #9 from Jakub Jelinek --- That is not what I read from what you've posted, -fexcess-precision=standard is consistent between the compilers, -fexcess-precision=fast is not (and doesn't have to be), neither between different

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #8 from Дилян Палаузов --- -fexcess-precision=standard does not ensure consistent behaviour between gcc 13.2.1 20231205 (Red Hat 13.2.1-6) and clang 17.0.5. -msse2 -mfpmath=sse does for diff.c: #include #include int main(void) {

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #6 from Andrew Pinski --- Because 64bit uses the SSE2 fp instructions rather than x87 fp instructions.

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #5 from Дилян Палаузов --- gcc -m64 -fexcess-precision=fast -o diff diff.c && ./diff 0.00 gcc -m32 -fexcess-precision=fast -o diff diff.c && ./diff -2.00 clang -m32 -fexcess-precision=fast -o diff diff.c && ./diff 0.00

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread jakub at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #4 from Jakub Jelinek --- Yeah, it is, that is how excess precision behaves. Due to the cast applying just to l rather than l - d it returns 0.0 with -fexcess-precision=standard, but if you change it to (double)(l - d) then it will

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

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

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread dilyan.palauzov at aegee dot org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 --- Comment #2 from Дилян Палаузов --- This happens only without optimizations: $ gcc -O0 -m32 -o diff diff.c && ./diff -2.00 $ gcc -O1 -m32 -o diff diff.c && ./diff 0.00 $ gcc -O2 -m32 -o diff diff.c && ./diff 0.00 $ gcc -O3

[Bug target/113679] long long minus double with gcc -m32 produces different results than other compilers or gcc -m64

2024-01-31 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113679 Andrew Pinski changed: What|Removed |Added Component|c |target --- Comment #1 from Andrew