https://gcc.gnu.org/bugzilla/show_bug.cgi?id=124985
--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-16 branch has been updated by Martin Uecker <[email protected]>: https://gcc.gnu.org/g:5aedc2ee5a58f74825347f0040c35b4a26e72390 commit r16-9088-g5aedc2ee5a58f74825347f0040c35b4a26e72390 Author: Martin Uecker <[email protected]> Date: Sat Apr 25 20:14:13 2026 +0200 c: Fix use of variably-modified structure/union types in nested context [PR124985] If a nested function uses a variably-modified structure or union type that depends on the enclosing context, it needs the static chain. My recent change missed this, because in this case no decl was used. To address this, we now call mark_decl_used also on TYPE_STUB_DECLs. PR c/124985 gcc/c/ChangeLog: * c-decl.cc (pushtag): Update comment. (declspecs_add_type): Mark TYPE_STUB_DECL as used. * c-typeck.cc (function_to_pointer_conversion): Fix grammar in comment. gcc/testsuite/ChangeLog: * gcc.dg/Wreturn-nested-3.c: New test. * gcc.dg/pr124985.c: New test. (cherry picked from commit 67bc28c6c0c68a22280fd0942df598f20e339431)
