https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105019
--- Comment #4 from Tom de Vries <vries at gcc dot gnu.org> --- OK, I think this is the pattern: ... $ cat gcc/testsuite/gcc.target/nvptx/alias-5.c /* { dg-do link } */ /* { dg-do run { target runtime_ptx_isa_version_6_3 } } */ /* { dg-options "-save-temps -malias -mptx=6.3" } */ int v; void __attribute__((noinline)) __f () { v = 1; } void f () __attribute__ ((alias ("__f"))); void g (void) { f (); } int main (void) { if (v != 0) __builtin_abort (); return 0; } ... There's a function __f: ... // BEGIN GLOBAL FUNCTION DEF: __f .visible .func __f { .reg .u32 %r22; mov.u32 %r22,1; st.global.u32 [v],%r22; ret; } ... with alias f: ... // BEGIN GLOBAL FUNCTION DECL: __f .visible .func __f; .visible .func f; .alias f,__f; ... called from g: ... // BEGIN GLOBAL FUNCTION DEF: g .visible .func g { { call f; } ret; } ... However, g is unused. So we have: ... PASS: gcc.target/nvptx/alias-5.c (test for excess errors) spawn nvptx-none-run ./alias-5.exe^M fatal : Internal error: reference to deleted section^M nvptx-run: cuLinkComplete failed: unknown error (CUDA_ERROR_UNKNOWN, 999)^M FAIL: gcc.target/nvptx/alias-5.c execution test ... Calling g from main fixes the internal error.