https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105177
Bug ID: 105177 Summary: GCC should warn if pragma redefine_extname fails due to missing declaration Product: gcc Version: 11.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: timschumi at gmx dot de Target Milestone: --- The file `atomic-repro.c` compiles without warnings or errors when compiled using the following compiler invocation: $ cat atomic-repro.c #pragma redefine_extname __atomic_load_c __atomic_load void __atomic_load_c(void) { return; } $ gcc -Wall -Wextra -c atomic-repro.c However, the resulting assembly/binary ends up using the original symbol name instead of the new one. I realize that the symbol using the old name may very well be technically correct behavior (presumably due to the "linkage" restriction), but it feels like this specific case at least could benefit from a warning to prevent people from running into issues unexpectedly. GCC has been configured with the following: $ gcc -v Using built-in specs. COLLECT_GCC=/usr/bin/gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/11.2.0/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: /build/gcc/src/gcc/configure --enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++,d --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://bugs.archlinux.org/ --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror --with-build-config=bootstrap-lto --enable-link-serialization=1 gdc_include_dir=/usr/include/dlang/gdc Thread model: posix Supported LTO compression algorithms: zlib zstd gcc version 11.2.0 (GCC)