[libcxx-commits] [libcxx] [AMDGPU] Change the representation of double literals in operands (PR #68740)

Stanislav Mekhanoshin via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 12 23:32:03 PDT 2023


rampitec wrote:

> Hi @rampitec
> 
> With UBSan built binaries the MC/AMDGPU/literals.s testcase fails and triggers UB like
> 
> ```
> 07:33:04 ../lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:2246:59: runtime error: left shift of negative value -54321
> 07:33:04 SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp:2246:59 
> ```
> 
> It's this new shift that it complains on:
> 
> ```
>     Val = AMDGPU::isSISrcFPOperand(InstDesc, OpNum) ? Val << 32 : Lo_32(Val);
> ```

I am happy to fix it, but I do not understand how a LEFT shift can be a UB? Low bits will be zero, right? High bits will be disposed. I really do not understand.

https://github.com/llvm/llvm-project/pull/68740


More information about the libcxx-commits mailing list