[llvm-commits] ARMCodeEmitter endianness problem

Gabor Greif ggreif at gmail.com
Wed Oct 20 07:20:34 PDT 2010


Following fragment of ARMCodeEmitter.cpp seems to be endian-dependent:

    } else if (const ConstantInt *CI = dyn_cast<ConstantInt>(CV)) {
      uint32_t Val = *(uint32_t*)CI->getValue().getRawData();
      emitWordLE(Val);


I get this GCC warning:

/home/ggreif/llvm/lib/Target/ARM/ARMCodeEmitter.cpp:506: warning: cast
from `const uint64_t*' to `uint32_t*' discards qualifiers from pointer
target type

I suppose the raw value should be dereferenced first to obtain an
uint64_t and then truncated:

      uint32_t Val = uint32_t(*CI->getValue().getRawData());

Somebody should fix this :-)

Cheers,

    Gabor



More information about the llvm-commits mailing list