public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug translation/109132] New: Apple M1 floating point bug when optimizing
@ 2023-03-14 20:07 muecker at gwdg dot de
  2023-03-14 20:10 ` [Bug target/109132] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: muecker at gwdg dot de @ 2023-03-14 20:07 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 109132
           Summary: Apple M1 floating point bug when optimizing
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: translation
          Assignee: unassigned at gcc dot gnu.org
          Reporter: muecker at gwdg dot de
  Target Milestone: ---

There seems to be a floating point error when optimizing on Apple M1. When
taking the conjugate of a complex number and multiplying with itself, then the
imaginary part should be zero.

% cat bug.c         

#include <stdio.h>
#include <complex.h>

__attribute__((noinline))
complex float f(complex float a, complex float b)
{
        return a * conjf(b);
}

int main()
{
        complex float x = -0x1.f5cf72p-3 + 0x1.f0f84ap-2i;
        complex float y = f(x, x);
        printf("%a %a\n", crealf(y), cimagf(y));
        return (0. != cimagf(y));
}

% gcc-12 bug.c      
% ./a.out && echo ok
0x1.2eab1ep-2 0x0p+0
ok
% gcc-12 -O1 bug.c  
% ./a.out && echo ok
0x1.2eab1ep-2 0x0p+0
ok
% gcc-12 -O2 bug.c  
% ./a.out && echo ok
0x1.2eab1ep-2 0x1.1b990cp-29

% gcc-12 --version
gcc-12 (Homebrew GCC 12.2.0) 12.2.0
Copyright (C) 2022 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.

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

end of thread, other threads:[~2023-03-14 20:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-14 20:07 [Bug translation/109132] New: Apple M1 floating point bug when optimizing muecker at gwdg dot de
2023-03-14 20:10 ` [Bug target/109132] " pinskia at gcc dot gnu.org
2023-03-14 20:11 ` pinskia at gcc dot gnu.org
2023-03-14 20:14 ` pinskia at gcc dot gnu.org
2023-03-14 20:29 ` muecker at gwdg dot de

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