[MLton] x86_64 port status

Stephen Weeks MLton@mlton.org
Tue, 9 May 2006 16:31:40 -0700


> Perhaps a better approach would be to define the following:
> 
>    struct PointerAux { unsigned char[4]; } __attribute__ ((aligned (4));
>    typedef struct PointerAux* Pointer;

I tried this out and it worked well.  To be clear, I used

  struct PointerAux { unsigned char z[4]; } __attribute__ ((aligned (4)));

This cut down the number of "cast increases required alignment" warnings
from 143 to 95.  All of the warnings eliminated were from basis/*
files.  Only one such warning remains.

  basis/Real/modf.c:10: warning: cast increases required alignment of target type

The remaining warnings are all in gc/* files.  I looked at a few, and
they stem from the mismatch between the fact that "Pointer" is aligned
while various C pointer types are not.  The only fix I see is to
define a number of new types that reflect the alignment constraint.
For example, instead of GC_arrayCounter* we would define a new type,
GC_arrayCounter_ptr.

I'm not sure it's worth the trouble, though.  It would certainly be
easier to turn off -Wcast-align when compiling the gc/* files.

For completeness, there are three additional warnings inside alerts
that show up when building libmlton-gdb.

  gc/dfs-mark.c:231: warning: cast increases required alignment of target type
  gc/dfs-mark.c:231: warning: cast increases required alignment of target type
  gc/dfs-mark.c:236: warning: cast increases required alignment of target type

Here are the remaining warnings in gc/*.

  gc/array-allocate.c:66: warning: cast increases required alignment of target type
  gc/array-allocate.c:68: warning: cast increases required alignment of target type
  gc/array-allocate.c:70: warning: cast increases required alignment of target type
  gc/array-allocate.c:79: warning: cast increases required alignment of target type
  gc/array-allocate.c:93: warning: cast increases required alignment of target type
  gc/array.c:16: warning: cast increases required alignment of target type
  gc/array.c:39: warning: cast increases required alignment of target type
  gc/call-stack.c:34: warning: cast increases required alignment of target type
  gc/cheney-copy.c:27: warning: cast increases required alignment of target type
  gc/cheney-copy.c:28: warning: cast increases required alignment of target type
  gc/copy-thread.c:19: warning: cast increases required alignment of target type
  gc/copy-thread.c:26: warning: cast increases required alignment of target type
  gc/copy-thread.c:27: warning: cast increases required alignment of target type
  gc/copy-thread.c:42: warning: cast increases required alignment of target type
  gc/copy-thread.c:43: warning: cast increases required alignment of target type
  gc/copy-thread.c:45: warning: cast increases required alignment of target type
  gc/copy-thread.c:67: warning: cast increases required alignment of target type
  gc/copy-thread.c:68: warning: cast increases required alignment of target type
  gc/copy-thread.c:80: warning: cast increases required alignment of target type
  gc/current.c:15: warning: cast increases required alignment of target type
  gc/current.c:25: warning: cast increases required alignment of target type
  gc/dfs-mark.c:154: warning: cast increases required alignment of target type
  gc/dfs-mark.c:218: warning: cast increases required alignment of target type
  gc/dfs-mark.c:229: warning: cast increases required alignment of target type
  gc/dfs-mark.c:230: warning: cast increases required alignment of target type
  gc/dfs-mark.c:239: warning: cast increases required alignment of target type
  gc/dfs-mark.c:240: warning: cast increases required alignment of target type
  gc/dfs-mark.c:243: warning: cast increases required alignment of target type
  gc/dfs-mark.c:246: warning: cast increases required alignment of target type
  gc/dfs-mark.c:269: warning: cast increases required alignment of target type
  gc/dfs-mark.c:272: warning: cast increases required alignment of target type
  gc/dfs-mark.c:305: warning: cast increases required alignment of target type
  gc/dfs-mark.c:317: warning: cast increases required alignment of target type
  gc/dfs-mark.c:321: warning: cast increases required alignment of target type
  gc/dfs-mark.c:322: warning: cast increases required alignment of target type
  gc/dfs-mark.c:324: warning: cast increases required alignment of target type
  gc/dfs-mark.c:333: warning: cast increases required alignment of target type
  gc/foreach.c:66: warning: cast increases required alignment of target type
  gc/foreach.c:67: warning: cast increases required alignment of target type
  gc/foreach.c:73: warning: cast increases required alignment of target type
  gc/foreach.c:97: warning: cast increases required alignment of target type
  gc/foreach.c:113: warning: cast increases required alignment of target type
  gc/foreach.c:129: warning: cast increases required alignment of target type
  gc/foreach.c:139: warning: cast increases required alignment of target type
  gc/foreach.c:150: warning: cast increases required alignment of target type
  gc/foreach.c:151: warning: cast increases required alignment of target type
  gc/foreach.c:213: warning: cast increases required alignment of target type
  gc/forward.c:66: warning: cast increases required alignment of target type
  gc/forward.c:113: warning: cast increases required alignment of target type
  gc/forward.c:130: warning: cast increases required alignment of target type
  gc/forward.c:131: warning: cast increases required alignment of target type
  gc/forward.c:138: warning: cast increases required alignment of target type
  gc/gc_state.c:13: warning: cast increases required alignment of target type
  gc/gc_state.c:168: warning: cast increases required alignment of target type
  gc/gc_state.c:174: warning: cast increases required alignment of target type
  gc/hash-cons.c:67: warning: cast increases required alignment of target type
  gc/hash-cons.c:169: warning: cast increases required alignment of target type
  gc/hash-cons.c:170: warning: cast increases required alignment of target type
  gc/hash-cons.c:171: warning: cast increases required alignment of target type
  gc/hash-cons.c:257: warning: cast increases required alignment of target type
  gc/hash-cons.c:257: warning: cast increases required alignment of target type
  gc/init-world.c:97: warning: cast increases required alignment of target type
  gc/init-world.c:99: warning: cast increases required alignment of target type
  gc/init-world.c:118: warning: cast increases required alignment of target type
  gc/int-inf.c:32: warning: cast increases required alignment of target type
  gc/int-inf.c:94: warning: cast increases required alignment of target type
  gc/int-inf.c:125: warning: cast increases required alignment of target type
  gc/int-inf.c:342: warning: cast increases required alignment of target type
  gc/mark-compact.c:23: warning: cast increases required alignment of target type
  gc/mark-compact.c:23: warning: cast increases required alignment of target type
  gc/mark-compact.c:35: warning: cast increases required alignment of target type
  gc/mark-compact.c:35: warning: cast increases required alignment of target type
  gc/mark-compact.c:41: warning: cast increases required alignment of target type
  gc/mark-compact.c:41: warning: cast increases required alignment of target type
  gc/mark-compact.c:80: warning: cast increases required alignment of target type
  gc/mark-compact.c:147: warning: cast increases required alignment of target type
  gc/mark-compact.c:149: warning: cast increases required alignment of target type
  gc/mark-compact.c:152: warning: cast increases required alignment of target type
  gc/mark-compact.c:184: warning: cast increases required alignment of target type
  gc/mark-compact.c:266: warning: cast increases required alignment of target type
  gc/new-object.c:38: warning: cast increases required alignment of target type
  gc/new-object.c:59: warning: cast increases required alignment of target type
  gc/new-object.c:77: warning: cast increases required alignment of target type
  gc/object-size.c:47: warning: cast increases required alignment of target type
  gc/object.c:30: warning: cast increases required alignment of target type
  gc/object.c:101: warning: cast increases required alignment of target type
  gc/objptr.c:71: warning: cast increases required alignment of target type
  gc/objptr.c:74: warning: cast increases required alignment of target type
  gc/stack.c:72: warning: cast increases required alignment of target type
  gc/switch-thread.c:14: warning: cast increases required alignment of target type
  gc/switch-thread.c:15: warning: cast increases required alignment of target type
  gc/thread.c:19: warning: cast increases required alignment of target type
  gc/weak.c:44: warning: cast increases required alignment of target type
  gc/weak.c:59: warning: cast increases required alignment of target type