"Value has wrong type!" on Bool:4 bitfield

I've built a debug build of llvm 2.6, and llvm-gcc 2.6 for arm-elf
with --enable-checking=yes.

On the attached test case (which is g++.dg/expr/bitfield4.C from the
GCC 4.2 testsuite) I get:

$ cc1plus bitfield4.ii -emit-llvm-bc -o bitfield4.o -quiet

cc1plus: /home/foad/svn/antix/toolchain/branches/w/foad/2757llvm26/toolchain/llvm/llvm-gcc/gcc/llvm-convert.cpp:999:
llvm::Value* TreeToLLVM::Emit(tree_node*, const MemRef*): Assertion
`(Result == 0 || (((enum tree_code)
(((exp)->common.type))->common.code) == VOID_TYPE) ||
isa<VectorType>(ConvertType(((exp)->common.type))) ||
Result->getType() == ConvertType(((exp)->common.type))) && "Value has
wrong type!"' failed.

At this point Result is "i8 1". ConvertType(TREE_TYPE(exp)) is i4. And
the code generated for the basic block so far is:

entry:
  %retval = alloca i32 ; <i32*> [#uses=0]
  %0 = alloca i4 ; <i4*> [#uses=1]
  %"alloca point" = bitcast i32 0 to i32 ; <i32> [#uses=0]
  %1 = load i8* getelementptr inbounds (%struct.S* @s, i32 0, i32 0),
align 1 ; <i8> [#uses=1]
  %2 = shl i8 %1, 4 ; <i8> [#uses=1]
  %3 = lshr i8 %2, 4 ; <i8> [#uses=1]
  %4 = trunc i8 %3 to i4 ; <i4> [#uses=1]
  store i4 %4, i4* %0, align 1
  %5 = load i8* getelementptr inbounds (%struct.S* @s, i32 0, i32 0),
align 1 ; <i8> [#uses=1]
  %6 = and i8 %5, -16 ; <i8> [#uses=1]
  %7 = or i8 %6, 1 ; <i8> [#uses=1]
  store i8 %7, i8* getelementptr inbounds (%struct.S* @s, i32 0, i32 0), align 1

Any idea what's going wrong?

Thanks,
Jay.

bitfield4.ii (285 Bytes)

cc1plus: /home/foad/svn/antix/toolchain/branches/w/foad/2757llvm26/toolchain/llvm/llvm-gcc/gcc/llvm-convert.cpp:999:
llvm::Value* TreeToLLVM::Emit(tree_node*, const MemRef*): Assertion
`(Result == 0 || (((enum tree_code)
(((exp)->common.type))->common.code) == VOID_TYPE) ||
isa<VectorType>(ConvertType(((exp)->common.type))) ||
Result->getType() == ConvertType(((exp)->common.type))) && "Value has
wrong type!"' failed.

I see that this was addressed here:

http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20090831/086426.html

Sorry for the noise again!

Jay.