[Top][All Lists]

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

Re: autoconf: feature request: test for GCC version

From: Eric Blake
Subject: Re: autoconf: feature request: test for GCC version
Date: Wed, 13 Apr 2011 15:59:02 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv: Gecko/20110307 Fedora/3.1.9-0.39.b3pre.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.9

On 04/13/2011 03:49 PM, Philip Prindeville wrote:
> It is sometimes useful to be able to detect the compiler version (as in the 
> case of GCC 4.2 doing some fairly aggressive optimization that breaks fragile 
> code).

Thanks for the report.

> How about something like:

Unfortunately, I don't think that a macro like this belongs in autoconf.
 Why not instead follow the autoconf philosophy of feature tests rather
than version tests, and specifically compile a problematic program that
gets miscompiled by broken compilers and changes OPTIMIZE in that case.
 For all you know, gcc 4.2 on one machine may have some vendor-specific
patches that don't cause the same breakage that you are seeing with
out-of-the-box gcc 4.2.  Or, fix your code to be standards-compliant so
that undefined code doesn't trip up a valid optimization; and if gcc is
still miscompiling your program in your eyes, then report that as a bug
to the gcc folks (who will help you either see where your program is
non-compliant or will fix gcc to avoid the miscompilation).

Eric Blake   address@hidden    +1-801-349-2682
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]