[LLVMdev] Just got bitten by accidentally using the wrong gcc

Shantonu Sen ssen at apple.com
Fri Mar 21 06:56:23 PDT 2008


I recommend you don't parse version strings. In fact I switch the  
check to use AC_COMPILE precisely for the reason that gcc --version is  
totally unreliable and vendor specific. For example, what's the  
regular expression that tells you what the GCC version is:
i686-apple-darwin9-gcc-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5470)  
(Aspen 5470.3)

Per the rest of this thread, you can't even be sure that gcc 4.x.y on  
one linux distribution is compile the same as on another. If there are  
test cases that you'd like to embed directly into the configure script  
that will crash the compiler, that's probably worth doing up front.  
For the "gcc miscompiles llvm" bugs, can we rely on anything other  
than the testsuite?

Shantonu

Sent from my MacBook

On Mar 20, 2008, at 3:43 PM, Joachim Durchholz wrote:

>
> Am Donnerstag, den 20.03.2008, 15:27 -0700 schrieb Shantonu Sen:
>> llvm's ./configure already does that for gcc < 3.
>>
>> What are valid versions? Exactly 4.0 and 4.2? 4.0 and >=4.2?
>
> There's a list at http://llvm.org/docs/GettingStarted.html#brokengcc  
> so
> there is a reasonable basis.
> The list isn't comprehensive, of course, and will likely grow in the
> future. OTOH extending it as new problems come up should be easy to  
> do.
>
>> dnl Verify that GCC is version 3.0 or higher
>> if test "$GCC" = "yes"
>> then
>>   AC_COMPILE_IFELSE([[#if !defined(__GNUC__) || __GNUC__ < 3
>> #error Unsupported GCC version
>> #endif
>> ]], [], [AC_MSG_ERROR([gcc 3.x required, but you have a lower
>> version])])
>> fi
>
> It might be simpler (and faster) to check the output of gcc -v.
> Extending the list to other tools would be easier, too.
>
> Anybody able to give model code for that?
>
> Regards,
> Jo
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list