http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48496

--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-01-14 
17:45:28 UTC ---
Doesn't this code violate strict aliasing though?  And, it passes with
-fno-strict-aliasing.  Therefore, I think it would be better to fix up the
strict aliasing violation in libffi. completely untested patch:

--- libffi/src/ia64/ffi.c    2010-08-11 21:08:14.000000000 +0200
+++ libffi/src/ia64/ffi.c    2012-01-14 18:43:35.652923850 +0100
@@ -324,13 +324,17 @@ ffi_call(ffi_cif *cif, void (*fn)(void),
     case FFI_TYPE_FLOAT:
       if (gpcount < 8 && fpcount < 8)
         stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]);
-      stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i];
+      {
+        UINT32 tmp;
+        memcpy (&tmp, avalue[i], sizeof (UINT32));
+        stack->gp_regs[gpcount++] = tmp;
+      }
       break;

     case FFI_TYPE_DOUBLE:
       if (gpcount < 8 && fpcount < 8)
         stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]);
-      stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i];
+      memcpy (&stack->gp_regs[gpcount++], avalue[i], sizeof (UINT64));
       break;

     case FFI_TYPE_LONGDOUBLE:

With that IMHO this should be just a P2, not P1.

Reply via email to