Windows built Clang and bitcode

Should I expect Clang built with Visual Studio to work properly on Windows? My test file is:

   int i, j;
   for (i=0; i<10; i++)
       j = i + 5;

I invoke Clang as follows:
clang -emit-llvm-bc test.c

Then -
lli test.bc (length 575 bytes)

which produces:
lli: error loading program 'test.bc': Bitcode stream should be a multiple of 4 bytes in length

Where am I going wrong on this?

BTW, thanks Eli for the quick response to the other question. I'll try LLVM.


Hi Henry,

This is most likely because the output file wasn't being opened in
binary mode. I just pushed a change which I hope will correct this,
however I personally do not have a machine to test this on.

If you try my change and it still doesn't work, can you verify that
'clang -emit-llvm test.c' produces the correct output (which should be
readable by llvm-as).

- Daniel

Yes, thanks it works now with the changed code.

Daniel Dunbar wrote: