After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 674773 - division by 0 due to unhandled alignment check failure at configure time
division by 0 due to unhandled alignment check failure at configure time
Status: RESOLVED DUPLICATE of bug 674483
Product: glib
Classification: Platform
Component: general
2.32.x
Other Linux
: Normal normal
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2012-04-25 08:51 UTC by Tomas Frydrych
Modified: 2012-04-25 13:21 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Tomas Frydrych 2012-04-25 08:51:44 UTC
Commit 839957f275875b6f8fd033d67379bce0fde1c58f, followed by 8f8fc836709cff58bd666b87937542088cfc19db added the following to configure.ac

AC_CHECK_ALIGNOF([guint32], [AC_INCLUDES_DEFAULT
typedef unsigned $gint32 guint32;])
AC_CHECK_ALIGNOF([guint64], [AC_INCLUDES_DEFAULT
typedef unsigned $gint64 guint64;])
AC_CHECK_ALIGNOF([unsigned long])

Unfortunately, the way in which the AC_CHECK_ALIGNOF macro calculates alignment is very fragile and generally does not work during crosscompilation. There are multiple problems with the macro implementation, but the one that is of consequence for glib is that the failure can result in ALIGNOF_<type> being defined to 0, which then leads to a happy division by 0 in msort_r (gqsort.c). So so some kind of a sanity check is needed here, preferably generating a configure-time error.

(BTW, it is not necessary to 'make this work' for crosscompilation; the way the autoconf crosscompilation limitations are usually addressed is to feed autoconf a precomputed cache of various autoconf variables, so all is needed here is to make it fail, so that it is obvious that these values are missing from the cache.)
Comment 1 Colin Walters 2012-04-25 13:21:57 UTC

*** This bug has been marked as a duplicate of bug 674483 ***