llvm / llvm/llvm-project

[AMDGPU] HIP miscompilation bug (struct assignments nested inside comma expressions)

Open
#198,606 2 comments 0 reactions 3 assignees Claimed by @kzhuravl View on GitHub
backend:AMDGPU miscompilation
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

The following HIP program triggers a miscompilation bug. The output should be a deterministic value as it's UB free. The bug manifests by enabling optimisations which cause a divergence in the printed value.

Test File:
[HIPProg.hip](https://gist.github.com/ElliotBLabs/7b9844e0883d1cb2427276ee053bb390)

How to reproduce:

1. `clang++ -O0 -x hip HIPProg.hip --offload-arch=native -o O0.out`
2. `clang++ -O1 -x hip HIPProg.hip --offload-arch=native -o O1.out`
3. `./O0.out `
4. `./O1.out`

Compare output values:
Bug (-O1): 65536
Ref (-O0): 0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.