public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang
@ 2023-02-16 16:26 arnez at linux dot ibm.com
  2023-02-16 16:28 ` [Bug math/30130] " arnez at linux dot ibm.com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: arnez at linux dot ibm.com @ 2023-02-16 16:26 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30130

            Bug ID: 30130
           Summary: [s390] The _FPU_SETCW macro yields compile error with
                    Clang
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: math
          Assignee: unassigned at sourceware dot org
          Reporter: arnez at linux dot ibm.com
  Target Milestone: ---

The _FPU_SETCW and _FPU_GETCW macros don't work with Clang.  Compiling this
sample program:

    #include <fpu_control.h>
    void foo() { _FPU_SETCW(0); }

gives

    foo.c:2:14: error: invalid operand for instruction
    void foo() { _FPU_SETCW(0); }
                 ^

This is because the inline assembly contains a spurious second operand which is
accepted by the GNU assembler, but not by Clang/LLVM.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug math/30130] [s390] The _FPU_SETCW macro yields compile error with Clang
  2023-02-16 16:26 [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang arnez at linux dot ibm.com
@ 2023-02-16 16:28 ` arnez at linux dot ibm.com
  2023-02-16 16:38 ` arnez at linux dot ibm.com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: arnez at linux dot ibm.com @ 2023-02-16 16:28 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30130

Andreas Arnez <arnez at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |stli at linux dot ibm.com

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug math/30130] [s390] The _FPU_SETCW macro yields compile error with Clang
  2023-02-16 16:26 [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang arnez at linux dot ibm.com
  2023-02-16 16:28 ` [Bug math/30130] " arnez at linux dot ibm.com
@ 2023-02-16 16:38 ` arnez at linux dot ibm.com
  2023-02-28 12:21 ` stli at linux dot ibm.com
  2023-02-28 13:05 ` stli at linux dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: arnez at linux dot ibm.com @ 2023-02-16 16:38 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30130

--- Comment #1 from Andreas Arnez <arnez at linux dot ibm.com> ---
Created attachment 14687
  --> https://sourceware.org/bugzilla/attachment.cgi?id=14687&action=edit
Proposed fix for _FPU_SETCW/_FPUGETCW on s390

This is an untested possible fix for the compile error.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug math/30130] [s390] The _FPU_SETCW macro yields compile error with Clang
  2023-02-16 16:26 [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang arnez at linux dot ibm.com
  2023-02-16 16:28 ` [Bug math/30130] " arnez at linux dot ibm.com
  2023-02-16 16:38 ` arnez at linux dot ibm.com
@ 2023-02-28 12:21 ` stli at linux dot ibm.com
  2023-02-28 13:05 ` stli at linux dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: stli at linux dot ibm.com @ 2023-02-28 12:21 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30130

--- Comment #2 from Stefan Liebler <stli at linux dot ibm.com> ---
Hi Andreas,

I've successfully tested your patch with gcc/binutils. And also double checked
that your example builds with clang.

In glibc the spurious second operand was already used when the file
fpu_control.h was introduced back in 2000.

As information, the instructions efpc/sfpc really have no second operand, which
is reflected in binutils commit from 2007 which should be landed in binutils
2.18:
https://github.com/bminor/binutils-gdb/commit/b8e558488cb3c85687107ef81b2504fac0c11a6b
There is also this comment:
/* Actually efpc and sfpc do not take an optional operand.
   This is just a workaround for existing code e.g. glibc.  */

Note: glibc-upstream currently requires binutils 2.25 or newer. Thus we can
just remove the second operand in glibc.

Please post your patch to libc-alpha@sourceware.org and add "[BZ #30130]" to
the subject. Then I will commit it and close this bugzilla.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

* [Bug math/30130] [s390] The _FPU_SETCW macro yields compile error with Clang
  2023-02-16 16:26 [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang arnez at linux dot ibm.com
                   ` (2 preceding siblings ...)
  2023-02-28 12:21 ` stli at linux dot ibm.com
@ 2023-02-28 13:05 ` stli at linux dot ibm.com
  3 siblings, 0 replies; 5+ messages in thread
From: stli at linux dot ibm.com @ 2023-02-28 13:05 UTC (permalink / raw)
  To: glibc-bugs

https://sourceware.org/bugzilla/show_bug.cgi?id=30130

Stefan Liebler <stli at linux dot ibm.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
   Target Milestone|---                         |2.38
         Resolution|---                         |FIXED

--- Comment #3 from Stefan Liebler <stli at linux dot ibm.com> ---
Fixed with commit:
"S390: Fix _FPU_SETCW/GETCW when compiling with Clang [BZ #30130]"
https://sourceware.org/git/?p=glibc.git;a=commit;h=3862773e1efba89ac7da43be80e64140b073c4e2

Thanks for your patch.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

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

end of thread, other threads:[~2023-02-28 13:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-16 16:26 [Bug math/30130] New: [s390] The _FPU_SETCW macro yields compile error with Clang arnez at linux dot ibm.com
2023-02-16 16:28 ` [Bug math/30130] " arnez at linux dot ibm.com
2023-02-16 16:38 ` arnez at linux dot ibm.com
2023-02-28 12:21 ` stli at linux dot ibm.com
2023-02-28 13:05 ` stli at linux dot ibm.com

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