public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/95418] New: Static assert going off on MinGW
@ 2020-05-29 14:22 markus.boeck02 at gmail dot com
2020-05-30 20:17 ` [Bug libfortran/95418] " anlauf at gcc dot gnu.org
` (11 more replies)
0 siblings, 12 replies; 13+ messages in thread
From: markus.boeck02 at gmail dot com @ 2020-05-29 14:22 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
Bug ID: 95418
Summary: Static assert going off on MinGW
Product: gcc
Version: 11.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libfortran
Assignee: unassigned at gcc dot gnu.org
Reporter: markus.boeck02 at gmail dot com
Target Milestone: ---
Since commit "i386: Use generic division to generate INEXACT exception"
(d3a1459cd4f2d4997fb53e34ddef72e91a7855c1) libgfortran is not able to be
compiled with the target x86_64-w64-mingw32. This is due to a _Static_assert
going off in fpu-target.h. The exact error message is:
In file included from ../../../libgfortran/runtime/fpu.c:29:
./fpu-target.h:91:1: error: static assertion failed: "GFC_FPE_STATE_BUFFER_SIZE
is too small"
91 | _Static_assert (sizeof(struct fenv) <= (size_t)
GFC_FPE_STATE_BUFFER_SIZE,
| ^~~~~~~~~~~~~~
Reverting the above commit makes compilation succeed.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
@ 2020-05-30 20:17 ` anlauf at gcc dot gnu.org
2020-05-31 9:07 ` markus.boeck02 at gmail dot com
` (10 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-05-30 20:17 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
anlauf at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |WAITING
Last reconfirmed| |2020-05-30
--- Comment #1 from anlauf at gcc dot gnu.org ---
(In reply to Markus Böck from comment #0)
> Since commit "i386: Use generic division to generate INEXACT exception"
> (d3a1459cd4f2d4997fb53e34ddef72e91a7855c1) libgfortran is not able to be
> compiled with the target x86_64-w64-mingw32. This is due to a _Static_assert
> going off in fpu-target.h. The exact error message is:
>
> In file included from ../../../libgfortran/runtime/fpu.c:29:
> ./fpu-target.h:91:1: error: static assertion failed:
> "GFC_FPE_STATE_BUFFER_SIZE is too small"
> 91 | _Static_assert (sizeof(struct fenv) <= (size_t)
> GFC_FPE_STATE_BUFFER_SIZE,
> | ^~~~~~~~~~~~~~
>
> Reverting the above commit makes compilation succeed.
Can you print sizeof(struct fenv)?
On Linux, this is 32, the same as defined in gcc/fortran/libgfortran.h
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
2020-05-30 20:17 ` [Bug libfortran/95418] " anlauf at gcc dot gnu.org
@ 2020-05-31 9:07 ` markus.boeck02 at gmail dot com
2020-05-31 18:07 ` [Bug libfortran/95418] [11 Regression] " tkoenig at gcc dot gnu.org
` (9 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: markus.boeck02 at gmail dot com @ 2020-05-31 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #2 from Markus Böck <markus.boeck02 at gmail dot com> ---
I printed the size of the struct and it yielded 36. Interestingly, using clang
instead yields 32 like on Linux
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
2020-05-30 20:17 ` [Bug libfortran/95418] " anlauf at gcc dot gnu.org
2020-05-31 9:07 ` markus.boeck02 at gmail dot com
@ 2020-05-31 18:07 ` tkoenig at gcc dot gnu.org
2020-05-31 18:07 ` tkoenig at gcc dot gnu.org
` (8 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-05-31 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tkoenig at gcc dot gnu.org,
| |uros at gcc dot gnu.org
Summary|Static assert going off on |[11 Regression] Static
|MinGW |assert going off on MinGW
--- Comment #3 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
Adding the author of the patch.
Uros: I find no discussion of this patch on the fortran mailing list.
Please remember to do so in the future if you touch the libgfortran
or gcc/fortran directories.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (2 preceding siblings ...)
2020-05-31 18:07 ` [Bug libfortran/95418] [11 Regression] " tkoenig at gcc dot gnu.org
@ 2020-05-31 18:07 ` tkoenig at gcc dot gnu.org
2020-05-31 18:42 ` pinskia at gcc dot gnu.org
` (7 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-05-31 18:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |11.0
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (3 preceding siblings ...)
2020-05-31 18:07 ` tkoenig at gcc dot gnu.org
@ 2020-05-31 18:42 ` pinskia at gcc dot gnu.org
2020-05-31 18:55 ` pinskia at gcc dot gnu.org
` (6 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-05-31 18:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Looks like:
unsigned short int __cs_selector;
- unsigned short int __opcode;
+ unsigned int __opcode:11;
+ unsigned int __unused4:5;
For Windows ABI, the int causes the bitfield to start at the next 4byte
alignment. Unlike Linux ABI.
I suspect using unsigned short will fix the issue. NOTE clang might not
implement the correct Windows ABI.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (4 preceding siblings ...)
2020-05-31 18:42 ` pinskia at gcc dot gnu.org
@ 2020-05-31 18:55 ` pinskia at gcc dot gnu.org
2020-05-31 19:34 ` ubizjak at gmail dot com
` (5 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-05-31 18:55 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> Looks like:
> unsigned short int __cs_selector;
> - unsigned short int __opcode;
> + unsigned int __opcode:11;
> + unsigned int __unused4:5;
>
> For Windows ABI, the int causes the bitfield to start at the next 4byte
> alignment. Unlike Linux ABI.
> I suspect using unsigned short will fix the issue. NOTE clang might not
> implement the correct Windows ABI.
The Visual Windows ABI does say the following:
a bit-field won't share the same storage unit with the previous
bit-field if their underlying types have different sizes, and the
bit-field will be aligned to the highest alignment of the underlying
types of itself and of the previous bit-field
--- CUT ---
So this is why the difference between Linux and Windows ABI comes into place.
So I suspect Clang is wrong.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (5 preceding siblings ...)
2020-05-31 18:55 ` pinskia at gcc dot gnu.org
@ 2020-05-31 19:34 ` ubizjak at gmail dot com
2020-05-31 20:06 ` ubizjak at gmail dot com
` (4 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2020-05-31 19:34 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #6 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Thomas Koenig from comment #3)
> Adding the author of the patch.
>
> Uros: I find no discussion of this patch on the fortran mailing list.
> Please remember to do so in the future if you touch the libgfortran
> or gcc/fortran directories.
Thomas,
Contrary to my other libgfortran contribution, I was under the impression that
the patch touches only deep architectural details of the x87 chip, and should
be (and in fact is) independent of libgfortran implementation.
I would like to point out that the part, referred in Comment #4 unifies the
structure definition with the ones in libgcc soft-fp and libatomic. So, if this
change turns out to be problematic for MinGW, then the existing definitions in
libgcc in libatomic are wrong as well. Actually, libgcc sfp-machine.h defines:
#ifdef __MINGW32__
/* Make sure we are using gnu-style bitfield handling. */
#define _FP_STRUCT_LAYOUT __attribute__ ((gcc_struct))
#endif
which should probably be added to libgfortran fpu-387.h (and libatomic fenv.c).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (6 preceding siblings ...)
2020-05-31 19:34 ` ubizjak at gmail dot com
@ 2020-05-31 20:06 ` ubizjak at gmail dot com
2020-05-31 21:32 ` markus.boeck02 at gmail dot com
` (3 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2020-05-31 20:06 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #7 from Uroš Bizjak <ubizjak at gmail dot com> ---
Created attachment 48649
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48649&action=edit
Untested patch.
Can someone with an access to MinGW target please test the attached patch?
The layout is defined by the hardware, and gcc_struct reflects this layout.
BTW: I also doubt defining _FP_STRUCT_LAYOUT in sfp-machine.h has any effect,
we have to use __attribute__ ((gcc_struct)) directly on the structure
definition.
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (7 preceding siblings ...)
2020-05-31 20:06 ` ubizjak at gmail dot com
@ 2020-05-31 21:32 ` markus.boeck02 at gmail dot com
2020-05-31 22:07 ` tkoenig at gcc dot gnu.org
` (2 subsequent siblings)
11 siblings, 0 replies; 13+ messages in thread
From: markus.boeck02 at gmail dot com @ 2020-05-31 21:32 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #8 from Markus Böck <markus.boeck02 at gmail dot com> ---
Tested the above patch and the build failure is gone now
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (8 preceding siblings ...)
2020-05-31 21:32 ` markus.boeck02 at gmail dot com
@ 2020-05-31 22:07 ` tkoenig at gcc dot gnu.org
2020-06-01 20:29 ` cvs-commit at gcc dot gnu.org
2020-06-01 20:35 ` ubizjak at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-05-31 22:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #9 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Uroš Bizjak from comment #6)
> Thomas,
>
> Contrary to my other libgfortran contribution, I was under the impression
> that the patch touches only deep architectural details of the x87 chip, and
> should be (and in fact is) independent of libgfortran implementation.
Well, that's what https://gcc.gnu.org/fortran/ states - please copy
us in in the future. It makes more sense to have a simpler rule
than to make exceptions for specific subdirectories. (You can, of
course, also commit a change as "obvious and simple", but we'd
also appreciate a note about this).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (9 preceding siblings ...)
2020-05-31 22:07 ` tkoenig at gcc dot gnu.org
@ 2020-06-01 20:29 ` cvs-commit at gcc dot gnu.org
2020-06-01 20:35 ` ubizjak at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-06-01 20:29 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Uros Bizjak <uros@gcc.gnu.org>:
https://gcc.gnu.org/g:832c1192eba6dd100e2f757e30ea6373f782ff55
commit r11-774-g832c1192eba6dd100e2f757e30ea6373f782ff55
Author: Uros Bizjak <ubizjak@gmail.com>
Date: Mon Jun 1 22:23:51 2020 +0200
i386: Add __attribute__ ((gcc_struct)) to struct fenv [PR95418]
Windows ABI (MinGW) is different than Linux ABI when bitfileds are
involved.
The following patch adds __attribute__ ((gcc_struct)) to struct fenv in
order
to match the layout of x87 state image in memory.
2020-06-01 Uroš Bizjak <ubizjak@gmail.com>
libatomic/ChangeLog:
* config/x86/fenv.c (struct fenv): Add __attribute__
((gcc_struct)).
libgcc/ChangeLog:
* config/i386/sfp-exceptions.c (struct fenv):
Add __attribute__ ((gcc_struct)).
libgfortran/ChangeLog:
PR libfortran/95418
* config/fpu-387.h (struct fenv): Add __attribute__ ((gcc_struct)).
^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug libfortran/95418] [11 Regression] Static assert going off on MinGW
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
` (10 preceding siblings ...)
2020-06-01 20:29 ` cvs-commit at gcc dot gnu.org
@ 2020-06-01 20:35 ` ubizjak at gmail dot com
11 siblings, 0 replies; 13+ messages in thread
From: ubizjak at gmail dot com @ 2020-06-01 20:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95418
Uroš Bizjak <ubizjak at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |FIXED
Target| |x86_64-w64-mingw32
--- Comment #11 from Uroš Bizjak <ubizjak at gmail dot com> ---
Fixed.
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2020-06-01 20:35 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-29 14:22 [Bug libfortran/95418] New: Static assert going off on MinGW markus.boeck02 at gmail dot com
2020-05-30 20:17 ` [Bug libfortran/95418] " anlauf at gcc dot gnu.org
2020-05-31 9:07 ` markus.boeck02 at gmail dot com
2020-05-31 18:07 ` [Bug libfortran/95418] [11 Regression] " tkoenig at gcc dot gnu.org
2020-05-31 18:07 ` tkoenig at gcc dot gnu.org
2020-05-31 18:42 ` pinskia at gcc dot gnu.org
2020-05-31 18:55 ` pinskia at gcc dot gnu.org
2020-05-31 19:34 ` ubizjak at gmail dot com
2020-05-31 20:06 ` ubizjak at gmail dot com
2020-05-31 21:32 ` markus.boeck02 at gmail dot com
2020-05-31 22:07 ` tkoenig at gcc dot gnu.org
2020-06-01 20:29 ` cvs-commit at gcc dot gnu.org
2020-06-01 20:35 ` ubizjak at gmail dot 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).