https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108080
Nathaniel Shead <nshead at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |nshead at gcc dot gnu.org --- Comment #20 from Nathaniel Shead <nshead at gcc dot gnu.org> --- I have a fix for this in progress, though I've been delayed by a number of real-life issues that have cropped up. I did have this patch I'd been playing with to submit for 15.1 but I'd run out of time to submit for at least give a 'sorry' message instead, because I note that the only places these trees can exist are on the 'function_specific_{optimization,target}' members: commit a7732d9a119f8d8b442b57c25ad8e493a89e5095 (pr108080_sorry) Author: Nathaniel Shead <nathanielosh...@gmail.com> Date: Thu Jan 16 22:49:10 2025 +1100 Say 'sorry' for unimplemented features diff --git a/gcc/cp/module.cc b/gcc/cp/module.cc index 61116fe7669..c96fb2cdd41 100644 --- a/gcc/cp/module.cc +++ b/gcc/cp/module.cc @@ -6366,8 +6366,16 @@ trees_out::core_vals (tree t) } WT (t->function_decl.personality); - WT (t->function_decl.function_specific_target); - WT (t->function_decl.function_specific_optimization); + //WT (t->function_decl.function_specific_target); + if (streaming_p () && t->function_decl.function_specific_target) + sorry_at (DECL_SOURCE_LOCATION (t), + "%<target%> attribute not supported in modules"); + WT (NULL_TREE); + //WT (t->function_decl.function_specific_optimization); + if (streaming_p () && t->function_decl.function_specific_optimization) + sorry_at (DECL_SOURCE_LOCATION (t), + "%<optimize%> attribute not supported in modules"); + WT (NULL_TREE); WT (t->function_decl.vindex); if (DECL_HAS_DEPENDENT_EXPLICIT_SPEC_P (t)) diff --git a/gcc/testsuite/g++.dg/modules/pr108080.H b/gcc/testsuite/g++.dg/modules/pr108080.H new file mode 100644 index 00000000000..7f765126b20 --- /dev/null +++ b/gcc/testsuite/g++.dg/modules/pr108080.H @@ -0,0 +1,5 @@ +// PR c++/108080 +// { dg-additional-options "-fmodules" } +// Give a diagnostic message rather than a crash for unsupported features. + +[[gnu::optimize("-O3")]] void foo(); // { dg-message "sorry, unimplemented: .optimize." }