Branch: Tag:

2014-06-26

2014-06-26 18:14:58 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Build: Support compilers with union aliasing problems.

There are apparently compilers that don't understand that the
fields in unions overlap, and overcache overwritten fieldvalues.

Also restores support for compilers without support for static union init.

7494:      #############################################################################    + AC_MSG_CHECKING(if union aliasing works) + AC_CACHE_VAL(pike_cv_have_working_union_aliasing, [ +  AC_TRY_RUN([ +  struct foo {int a;}; +  struct bar {char b[2];}; +  union anything +  { +  struct foo foo; +  struct bar bar; +  }; +  int main() { +  union anything u; +  u.bar.b[0] = u.bar.b[1] = ~0; +  u.foo.a = 0; +  return u.bar.b[0]; +  } +  ], +  pike_cv_have_working_union_aliasing=yes, +  pike_cv_have_working_union_aliasing=no, +  pike_cv_have_working_union_aliasing=yes) + ]) + AC_MSG_RESULT($pike_cv_have_working_union_aliasing) + if test "$pike_cv_have_union_init" = no; then +  AC_DEFINE(NO_COMBINED_TYPE_SUBTYPE) + fi +  + ############################################################################# +    AC_MSG_CHECKING(if port.c works in CONFIGURE_TEST mode)   AC_CACHE_VAL(pike_cv_configure_test_port_c, [    AC_TRY_RUN([