llvm / llvm/llvm-project

[AMDGPU] HIP miscompilation bug (aggregate assignment of nested unions)

Open
#198,613 4 comments 0 reactions 1 assignee Claimed by @mgcarrasco 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/e29fa8bb31c09268321e482de9cbdd2e)

How to reproduce:

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

Compare output values:
Bug (-O1): 589824
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.