[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: AC_CHECK_ALIGNOF cross-compile detection fails with newer gcc and of

From: Eric Blake
Subject: Re: AC_CHECK_ALIGNOF cross-compile detection fails with newer gcc and offsetof fallback
Date: Thu, 06 Sep 2012 13:20:37 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:15.0) Gecko/20120828 Thunderbird/15.0

On 09/06/2012 01:00 PM, Mike Frysinger wrote:
> if a package doesn't happen to include stddef.h before trying to do
> AC_CHECK_ALIGNOF, the current cross-compile fallback fails with newer
> gcc.
> for example, see the attached generated conftest.c (taken from recent
> glib versions) where it does:
> AC_CHECK_TYPE([guint32],,,[typedef unsigned $gint32 guint32;])
> typedef unsigned $gint32 guint32;])
> compiling this gcc-4.5+ fails (checked 4.4.7, 4.5.3, 4.6.3, and 4.7.1):
> $ gcc -O2 conftest.c
> conftest.c: In function ‘main’:
> conftest.c:216:12: error: storage size of ‘test_array’ isn’t constant

Thanks for the analysis.

> if, however, we happen to pull in the stddef.h from gcc which now
> includes an offsetof definition itself (which uses a builtin),
> everything works nicely:
> $ gcc -O2 conftest.c -DSTDC_HEADERS
> perhaps one fix would be for AC_CHECK_ALIGNOF to require AC_STDC_HEADERS ?

Yes, that sounds reasonable.  Would you like to take the first shot at
writing the patch?

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]