https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123559
--- Comment #4 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Michal Jires <[email protected]>: https://gcc.gnu.org/g:fa20d1d7095122c7fc0e701b08ec383a60404bb0 commit r16-7332-gfa20d1d7095122c7fc0e701b08ec383a60404bb0 Author: Michal Jires <[email protected]> Date: Fri Jan 30 16:42:48 2026 +0100 c,c++: Fix incorrect warning with asm defined symbols Static symbols defined in assembly cause wrong "used but never defined" warning. static void asm_fn(); asm("%cc0:" :: ":"(&asm_fn)); This happens in C,C++ frontends before cgraph is created where the relevant flags are located. We can suppress these warnings with OPT_Wunused. C,C++ frontends and cgraphunit suppressed OPT_Wunused and OPT_Wunused_function interchangeably, so we unify suppression to only OPT_Wunused. PR testsuite/123559 gcc/c/ChangeLog: * c-decl.cc (c_write_global_declarations_1): Check and suppress OPT_Wunused. * c-typeck.cc (build_asm_expr): Suppress OPT_Wunused. gcc/ChangeLog: * cgraphunit.cc (check_global_declaration): Suppress OPT_Wunused. gcc/cp/ChangeLog: * decl.cc (wrapup_namespace_globals): Check and suppress OPT_Wunused. * semantics.cc (finish_asm_stmt): Suppress OPT_Wunused. gcc/testsuite/ChangeLog: * c-c++-common/toplevel-extended-asm-1.c: New test.
