[Bug c++/122786] [modules] section attribute in interface modules are silently dropped
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122786 Nathaniel Shead changed: What|Removed |Added Resolution|--- |FIXED Status|NEW |RESOLVED Target Milestone|--- |16.0 --- Comment #4 from Nathaniel Shead --- I ran out of time to implement my full attributes fix for GCC16, so I've just pushed a minimal change to get section attributes to propagate correctly. Thanks for the report!
[Bug c++/122786] [modules] section attribute in interface modules are silently dropped
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122786 --- Comment #3 from GCC Commits --- The master branch has been updated by Nathaniel Shead : https://gcc.gnu.org/g:8e3c5ce5e802225a7416a32a9d9a3c2bb2380874 commit r16-8242-g8e3c5ce5e802225a7416a32a9d9a3c2bb2380874 Author: Nathaniel Shead Date: Thu Mar 19 22:58:11 2026 +1100 c++/modules: Support section attributes [PR122786] This is a minimal fix to not just silently drop the section attribute on stream-in. Ideally we should be using cplus_decl_attributes for this, but it's not yet ready for modules (many attributes behave weirdly when applied not during parsing). We should also be checking for incompatible sections on stream-in in is_matching_decl, but that would also be better handled more generally so I'm leaving that out of this patch. Instead this minimally fixes the issue by just re-applying the section name from the attributes we've streamed in. PR c++/122786 gcc/cp/ChangeLog: * module.cc (trees_in::decl_value): Set section name from attribute. gcc/testsuite/ChangeLog: * g++.dg/modules/attrib-5_a.C: New test. * g++.dg/modules/attrib-5_b.C: New test. Signed-off-by: Nathaniel Shead Reviewed-by: Jason Merrill
[Bug c++/122786] [modules] section attribute in interface modules are silently dropped
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122786 --- Comment #2 from Thomas Berger --- Since your proposed patch, at least TLS was fixed in 15.2.0. After all, it was the hint i needed to fix section attributes for me. As mentioned, i am new to the GCC code base. But i may find some time in the next 2-3 weeks to dive deeper with some guidance, and may be able to help here. Feel free to reach out.
[Bug c++/122786] [modules] section attribute in interface modules are silently dropped
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122786 Nathaniel Shead changed: What|Removed |Added Assignee|unassigned at gcc dot gnu.org |nshead at gcc dot gnu.org CC||nshead at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed||2025-11-21 Status|UNCONFIRMED |NEW --- Comment #1 from Nathaniel Shead --- Confirmed, thanks for the report. I actually had a patch to fix this back at the start of the year, see https://gcc.gnu.org/pipermail/gcc-patches/2025-March/677188.html, but it got dropped in preference of fixing this properly for all attributes. Unfortunately I've not had nearly enough time to do this properly but maybe I'll be able to get something ready in the next month or so.
