[Issue 4169] building dmd with a modern gcc produces a buggy compiler

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue May 25 20:55:53 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4169


Brad Roberts <braddr at puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|FIXED                       |


--- Comment #5 from Brad Roberts <braddr at puremagic.com> 2010-05-25 20:55:50 PDT ---
Looks like you missed one file's changes:

diff --git a/src/mtype.c b/src/mtype.c
--- a/src/mtype.c
+++ b/src/mtype.c
@@ -2832,14 +2832,17 @@ Expression *TypeBasic::defaultInit(Loc loc)
      * so that uninitialised variables can be
      * detected even if exceptions are disabled.
      */
-    unsigned short snan[8] = { 0, 0, 0, 0xA000, 0x7FFF };
+    union {
+        unsigned short us[8];
+        long double    ld;
+    } snan = {{ 0, 0, 0, 0xA000, 0x7FFF }};
     /*
      * Although long doubles are 10 bytes long, some
      * C ABIs pad them out to 12 or even 16 bytes, so
      * leave enough space in the snan array.
      */
     assert(REALSIZE <= sizeof(snan));
-    d_float80 fvalue = *(long double*)snan;
+    d_float80 fvalue = snan.ld;
 #endif

 #if LOGDEFAULTINIT


The rest of the compiler builds w/o aliasing warnings on my box from tip of svn
now.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list