https://bugs.llvm.org/show_bug.cgi?id=51320

            Bug ID: 51320
           Summary: __constant__ variable in anonymous namespace is
                    optimized as if it could not be modified
           Product: clang
           Version: 12.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: CUDA
          Assignee: unassignedclangb...@nondot.org
          Reporter: kiw...@outlook.com
                CC: llvm-bugs@lists.llvm.org

Created attachment 25102
  --> https://bugs.llvm.org/attachment.cgi?id=25102&action=edit
code sample showcasing the issue

The best way to understand it is by looking at the attached code sample.

I tested it with: clang++ -L/usr/local/cuda/lib64 -lcudart
--cuda-gpu-arch=sm_30 -O3 main.cu && ./a.out

It works without `-O3`.

Expected output:
good = 10
bad = 20
good = 110
bad = 120

Bad output:
good = 10
bad = 20
good = 110
bad = 20

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to