[LLVMdev] [LLVMDev] trouble building gcc-frontend from source

John Criswell criswell at cs.uiuc.edu
Fri Mar 13 07:39:51 PDT 2009


Gautam Sewani wrote:
> On Fri, Mar 13, 2009 at 2:38 PM, Duncan Sands <baldrick at free.fr> wrote:
>   
>> Hi, the versions of llvm-gcc and llvm you are using are
>> not synchronized.  Probably one is from subversion while
>> the other is not.
>>     
I've run into this, too.  The problem is that the inliner pass uses a 30
bit integer to store the inline cost; the code that calculates the
inline cost generates a cost that is too large, and so you hit the
assertion.

I haven't yet distilled a test case for this yet (had some problems with
bugpoint for some mysterious reason), but I do have a work-around: go
into include/llvm/Transforms/Utils/InlineCost.h and make the following
change:


Index: InlineCost.h
===================================================================
--- InlineCost.h        (revision 66848)
+++ InlineCost.h        (working copy)
@@ -37,8 +37,13 @@
       Never
     };

+#if 0
     int Cost : 30;
     unsigned Type :  2;
+#else
+    int Cost;
+    unsigned Type :  2;
+#endif

     InlineCost(int C, int T) : Cost(C), Type(T) {
       assert(Cost == C && "Cost exceeds InlineCost precision");

Basically, you're changing the inline cost variable from 30 to 32 bits. 
After that, do a RELEASE build of LLVM and retry building llvm-gcc.

-- John T.

>> Ciao,
>>
>> Duncan.
>>
>>     
>
> Ok, I 'synchronized' both of them, but now I am getting a different
> error. On running make, the output ends with the following error:
>
>
> /home/gautam/code/llvm/llvm-gcc-4.2/obj/./gcc/xgcc
> -B/home/gautam/code/llvm/llvm-gcc-4.2/obj/./gcc/
> -B/home/gautam/code/llvm/llvm-gcc-4.2/obj/../install/i686-pc-linux-gnu/bin/
> -B/home/gautam/code/llvm/llvm-gcc-4.2/obj/../install/i686-pc-linux-gnu/lib/
> -isystem /home/gautam/code/llvm/llvm-gcc-4.2/obj/../install/i686-pc-linux-gnu/include
> -isystem /home/gautam/code/llvm/llvm-gcc-4.2/obj/../install/i686-pc-linux-gnu/sys-include
>  -O2  -O2 -g -O2  -DIN_GCC    -W -Wall -Wwrite-strings
> -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
> -isystem ./include  -fPIC -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2
> -D__GCC_FLOAT_NOT_NEEDED  -I. -I. -I../../trunk/gcc
> -I../../trunk/gcc/. -I../../trunk/gcc/../include
> -I../../trunk/gcc/../libcpp/include  -I../../trunk/gcc/../libdecnumber
> -I../libdecnumber -I/home/gautam/code/llvm/llvm_install/include
> -I/home/gautam/code/llvm/llvm/include  -DL_gcov -c
> ../../trunk/gcc/libgcov.c -o libgcc/./_gcov.o
> cc1: /home/gautam/code/llvm/llvm/include/llvm/Transforms/Utils/InlineCost.h:44:
> llvm::InlineCost::InlineCost(int, int): Assertion `Cost == C && "Cost
> exceeds InlineCost precision"' failed.
> ../../trunk/gcc/libgcov.c:644: internal compiler error: Aborted
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://developer.apple.com/bugreporter> for instructions.
> make[4]: *** [libgcc/./_gcov.o] Error 1
> make[4]: Leaving directory `/home/gautam/code/llvm/llvm-gcc-4.2/obj/gcc'
> make[3]: *** [libgcc.a] Error 2
> make[3]: Leaving directory `/home/gautam/code/llvm/llvm-gcc-4.2/obj/gcc'
> make[2]: *** [all-stage1-gcc] Error 2
> make[2]: Leaving directory `/home/gautam/code/llvm/llvm-gcc-4.2/obj'
> make[1]: *** [stage1-bubble] Error 2
> make[1]: Leaving directory `/home/gautam/code/llvm/llvm-gcc-4.2/obj'
> make: *** [all] Error 2
>
> I also tried using the gcc-4.2 compiler (by changing the value of the
> environment variables CC and CXX), but got the same error.
>
> Where am I going wrong? Any help would be greatly appreciated.
>
> Regards
> Gautam
> _______________________________________________
> 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