[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #18 from LIU Hao --- I'll remember to do that next time.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 Uroš Bizjak changed: What|Removed |Added Status|WAITING |RESOLVED Resolution|--- |FIXED --- Comment #17 from Uroš Bizjak --- Fixed.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #16 from Uroš Bizjak --- (In reply to LIU Hao from comment #14) > (In reply to Jakub Jelinek from comment #13) > > And Uros has approved it already, so just check it in. > > Sorry I don't have write access to Git. As mentioned in [1]: "If you do not have write access and a patch of yours has been approved, but not committed, please advise the approver of that fact. You may want to point out lack of write access in your initial submission, too." [1] https://gcc.gnu.org/contribute.html
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275
--- Comment #15 from GCC Commits ---
The master branch has been updated by Uros Bizjak :
https://gcc.gnu.org/g:d9b785ab9255fe16ee6d9e93034704112735cfb6
commit r16-5487-gd9b785ab9255fe16ee6d9e93034704112735cfb6
Author: LIU Hao
Date: Tue Oct 14 14:46:46 2025 +0800
libgcc: Pass x87 control word in the correct type
The x87 control word should be passed as an `unsigned short`. Previous
code passed `unsigned int`, and when building with `-masm=intel`,
__asm__ __volatile__ ("fnstcw\t%0" : "=m" (_cw));
could expand to `fnstcw DWORD PTR [esp+48]` and cause errors like
{standard input}: Assembler messages:
{standard input}:7137: Error: operand size mismatch for `fnstcw'
libgcc/ChangeLog:
PR target/122275
* config/i386/32/dfp-machine.h (DFP_GET_ROUNDMODE): Change
`_frnd_orig` to
`unsigned short` for x87 control word.
(DFP_SET_ROUNDMODE): Manipulate the x87 control word as `unsigned
short`,
and manipulate the MXCSR as `unsigned int`.
Signed-off-by: LIU Hao
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #14 from LIU Hao --- (In reply to Jakub Jelinek from comment #13) > And Uros has approved it already, so just check it in. Sorry I don't have write access to Git.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #13 from Jakub Jelinek --- And Uros has approved it already, so just check it in.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #12 from LIU Hao --- There's v2 which fixes a typo in the message: https://gcc.gnu.org/pipermail/gcc-patches/2025-November/701514.html
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #11 from LIU Hao --- (In reply to Jakub Jelinek from comment #10) > The #c4 patch looks good to me, but I don't see it posted on gcc-patches. > Can you please do so? Oops forgot that. It's there now: https://gcc.gnu.org/pipermail/gcc-patches/2025-November/701510.html
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 Jakub Jelinek changed: What|Removed |Added CC||jakub at gcc dot gnu.org --- Comment #10 from Jakub Jelinek --- The #c4 patch looks good to me, but I don't see it posted on gcc-patches. Can you please do so?
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #9 from LIU Hao --- This is off-topic but I would like to inform you that there are really people who build LLVM with Intel syntax: https://github.com/llvm/llvm-project/pull/164453
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #3 from LIU Hao --- Created attachment 62553 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62553&action=edit proposed fix So, define an `unsigned short` for x87 CW, instead of reusing `_cw` which is exclusively used for MXCSR now.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 H.J. Lu changed: What|Removed |Added Ever confirmed|0 |1 Status|UNCONFIRMED |WAITING Last reconfirmed||2025-10-15 --- Comment #5 from H.J. Lu --- How do I reproduce it?
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #7 from H.J. Lu --- (In reply to LIU Hao from comment #6) > (In reply to H.J. Lu from comment #5) > > How do I reproduce it? > > Actually I changed the default value of `-masm=`: > > ``` > diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt > index 401acb201078..68400ab1be9d 100644 > --- a/gcc/config/i386/i386.opt > +++ b/gcc/config/i386/i386.opt > @@ -263,7 +263,7 @@ Target RejectNegative Negative(march=) Joined > Var(ix86_arch_string) > Generate code for given CPU. > > masm= > -Target RejectNegative Joined Enum(asm_dialect) Var(ix86_asm_dialect) > Init(ASM_ATT) > +Target RejectNegative Joined Enum(asm_dialect) Var(ix86_asm_dialect) > Init(ASM_INTEL) > Use given assembler dialect. > > Enum > > ``` > > Then this can be reproduced on i686-w64-mingw32, which I suspect is the only > affected target. How does the modified GCC work with https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53929 > (a few months ago I tried building GCC on x86_64-linux-gnu, but some headers > contain asm stmts that have no alternative templates for Intel syntax, so > building GCC turned out to be impractical out there.) So building GCC with -masm=intel doesn't work even if this bug is fixed.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #8 from LIU Hao --- (In reply to H.J. Lu from comment #7) > > How does the modified GCC work with > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53929 Sine some years ago, I have been building other packages, such as Binutils, Python, CMake, boost, OpenSSL, and so on. Other than some inline assembly in their code, there have not been any issues in GCC itself, afaics. > > (a few months ago I tried building GCC on x86_64-linux-gnu, but some headers > > contain asm stmts that have no alternative templates for Intel syntax, so > > building GCC turned out to be impractical out there.) > > So building GCC with -masm=intel doesn't work even if this bug is fixed. Well, not for i686-linux-gnu, I think.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 Sam James changed: What|Removed |Added Target Milestone|--- |16.0 Keywords||assemble-failure Summary|`DFP_SET_ROUNDMODE` etc.|[16 regression] |pass wrong operand size on |`DFP_SET_ROUNDMODE` etc. |i686-w64-mingw32|pass wrong operand size on ||i686-w64-mingw32 since ||r16-4276-g3dcf3410a74386 --- Comment #2 from Sam James --- (In reply to LIU Hao from comment #1) > commit 3dcf3410a743867a0744d3a3d737b2e0b9c035ac $ contrib/git-descr.sh 3dcf3410a743867a0744d3a3d737b2e0b9c035ac r16-4276-g3dcf3410a74386
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 --- Comment #6 from LIU Hao --- (In reply to H.J. Lu from comment #5) > How do I reproduce it? Actually I changed the default value of `-masm=`: ``` diff --git a/gcc/config/i386/i386.opt b/gcc/config/i386/i386.opt index 401acb201078..68400ab1be9d 100644 --- a/gcc/config/i386/i386.opt +++ b/gcc/config/i386/i386.opt @@ -263,7 +263,7 @@ Target RejectNegative Negative(march=) Joined Var(ix86_arch_string) Generate code for given CPU. masm= -Target RejectNegative Joined Enum(asm_dialect) Var(ix86_asm_dialect) Init(ASM_ATT) +Target RejectNegative Joined Enum(asm_dialect) Var(ix86_asm_dialect) Init(ASM_INTEL) Use given assembler dialect. Enum ``` Then this can be reproduced on i686-w64-mingw32, which I suspect is the only affected target. (a few months ago I tried building GCC on x86_64-linux-gnu, but some headers contain asm stmts that have no alternative templates for Intel syntax, so building GCC turned out to be impractical out there.)
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275
LIU Hao changed:
What|Removed |Added
Attachment #62553|0 |1
is obsolete||
--- Comment #4 from LIU Hao ---
Created attachment 62559
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=62559&action=edit
complete patch
Patch bootstrapped over master on {i686,x86_64}-w64-mingw32.
[Bug libgcc/122275] [16 regression] `DFP_SET_ROUNDMODE` etc. pass wrong operand size on i686-w64-mingw32 since r16-4276-g3dcf3410a74386
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122275 Richard Biener changed: What|Removed |Added Priority|P3 |P1
