diff mbox

[libgcc] : Fix float128 soft-float for mingw targets

Message ID CAEwic4aZE8WXvs0TwAWr-1GZn6JNzi7_WJ50vBcm45HpdPVGdw@mail.gmail.com
State New
Headers show

Commit Message

Kai Tietz Feb. 27, 2012, 6:57 a.m. UTC
Hi,

by recent tests in gcc.target/i386 I noticed that testcase
float128-2.c failed on executation.  This failure is caused by
incompatible bitfield-structure definition in soft-fp/quad.h for
enabled ms-bitfields layout.

Patch marks those structures to be 'gcc_struct' for mingw targets.

ChangeLog

2012-02-27  Kai Tietz  <ktietz@redhat.com>

	* soft-fp/quad.h: Mark bitfield-structures as gcc_struct.

Regression tested for i686-w64-mingw32, x86_64-w64-mingw32, and
x86_64-unknown-linux-gnu for all languages (including Ada + Obj-C++).
Ok for apply?

Regards,
Kai

Comments

Joseph Myers Feb. 27, 2012, 3:43 p.m. UTC | #1
On Mon, 27 Feb 2012, Kai Tietz wrote:

> 2012-02-27  Kai Tietz  <ktietz@redhat.com>
> 
> 	* soft-fp/quad.h: Mark bitfield-structures as gcc_struct.
> 
> Regression tested for i686-w64-mingw32, x86_64-w64-mingw32, and
> x86_64-unknown-linux-gnu for all languages (including Ada + Obj-C++).
> Ok for apply?

As explained in codingconventions.html, soft-fp is imported from glibc.  
For files that come from glibc, you can only copy in the glibc versions, 
unchanged.

Thus, you should submit this fix to libc-alpha.  You'll need to explain 
what the differences in struct layout actually are.  In my view, rather 
than adding any __MINGW32__ conditionals in the header, you should instead 
have an _FP_STRUCT_LAYOUT macro that sfp-machine.h can define, and that 
soft-fp.h defines to empty if not defined in sfp-machine.h.  That way 
quad.h can use _FP_STRUCT_LAYOUT and you avoid any conditionals on 
__MINGW32__ in any of the core soft-fp code.

I would have expected any struct layout issue to apply to the other 
headers (single.h, double.h, extended.h) just as to quad.h, so if you're 
only changing one header you'll need to explain why the issue doesn't 
affect the others.
diff mbox

Patch

Index: soft-fp/quad.h
===================================================================
--- soft-fp/quad.h	(revision 184486)
+++ soft-fp/quad.h	(working copy)
@@ -67,7 +67,11 @@ 
 union _FP_UNION_Q
 {
    TFtype flt;
-   struct
+   struct
+#ifdef __MINGW32__
+  /* Make sure we are using gnu-style bitfield handling.  */
+  __attribute__ ((gcc_struct))
+#endif
    {
 #if __BYTE_ORDER == __BIG_ENDIAN
       unsigned sign : 1;
@@ -174,7 +178,12 @@ 
   struct {
     _FP_W_TYPE a, b;
   } longs;
-  struct {
+  struct
+#ifdef __MINGW32__
+  /* Make sure we are using gnu-style bitfield handling.  */
+  __attribute__ ((gcc_struct))
+#endif
+  {
 #if __BYTE_ORDER == __BIG_ENDIAN
     unsigned sign    : 1;
     unsigned exp     : _FP_EXPBITS_Q;