public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/114772] New: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) @ 2024-04-18 15:36 mjires at gcc dot gnu.org 2024-04-18 15:40 ` [Bug c++/114772] " pinskia at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: mjires at gcc dot gnu.org @ 2024-04-18 15:36 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114772 Bug ID: 114772 Summary: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mjires at gcc dot gnu.org CC: jamborm at gcc dot gnu.org Target Milestone: --- Following minimized testcase fails depending on warn_unused_result attribute. Fails at least since GCC 10. $ cat simdjson.cpp template<typename V, bool STREAMING> inline __attribute__((always_inline)) #ifdef FAIL __attribute__((warn_unused_result)) #endif int walk_document(V visitor) {return 0;} template<bool STREAMING> void parse_document() { int r = walk_document<bool, STREAMING>(false); } void stage2_next() { parse_document<true>(); } #pragma GCC target("pclmul") $ gcc simdjson.cpp -DFAIL simdjson.cpp: In function ‘void parse_document() [with bool STREAMING = true]’: simdjson.cpp:6:5: error: inlining failed in call to ‘always_inline’ ‘int walk_document(V) [with V = bool; bool STREAMING = true]’: target specific option mismatch 6 | int walk_document(V visitor) {return 0;} | ^~~~~~~~~~~~~ simdjson.cpp:10:43: note: called from here 10 | int r = walk_document<bool, STREAMING>(false); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ Without __attribute__((warn_unused_result)) it compiles without problems. Inlining is denied in ix86_can_inline_p, because: caller: void parse_document() [with bool STREAMING = true]/1 callee: int walk_document(V) [with V = bool; bool STREAMING = true]/2 caller_opts->x_ix86_isa_flags: 000c001100000012 callee_opts->x_ix86_isa_flags: 000c009100000012 So they differ by OPTION_MASK_ISA_PCLMUL Source of this difference seems to be attribs.cc:decl_attributes, which is called during template instantiation, but uses global_options. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/114772] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) 2024-04-18 15:36 [Bug c++/114772] New: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) mjires at gcc dot gnu.org @ 2024-04-18 15:40 ` pinskia at gcc dot gnu.org 2024-04-19 12:50 ` [Bug c++/114772] [13/14 Regression] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) since r12-6904 jakub at gcc dot gnu.org 2024-05-21 9:20 ` [Bug c++/114772] [13/14/15 " jakub at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-04-18 15:40 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114772 Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://gcc.gnu.org/bugzill | |a/show_bug.cgi?id=109753 --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I suspect this and pr 109753 have the same underlying issue. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/114772] [13/14 Regression] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) since r12-6904 2024-04-18 15:36 [Bug c++/114772] New: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) mjires at gcc dot gnu.org 2024-04-18 15:40 ` [Bug c++/114772] " pinskia at gcc dot gnu.org @ 2024-04-19 12:50 ` jakub at gcc dot gnu.org 2024-05-21 9:20 ` [Bug c++/114772] [13/14/15 " jakub at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: jakub at gcc dot gnu.org @ 2024-04-19 12:50 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114772 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P3 |P2 CC| |jakub at gcc dot gnu.org Ever confirmed|0 |1 Target Milestone|--- |13.3 Status|UNCONFIRMED |NEW Last reconfirmed| |2024-04-19 Summary|pragma GCC target applied |[13/14 Regression] pragma |to earlier template |GCC target applied to |function with |earlier template function |__attribute__((warn_unused_ |with |result)) |__attribute__((warn_unused_ | |result)) since r12-6904 --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Started with r12-6904-g66b86171188dcb61d2d0e0a4a98a7467e58a84a7 ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/114772] [13/14/15 Regression] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) since r12-6904 2024-04-18 15:36 [Bug c++/114772] New: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) mjires at gcc dot gnu.org 2024-04-18 15:40 ` [Bug c++/114772] " pinskia at gcc dot gnu.org 2024-04-19 12:50 ` [Bug c++/114772] [13/14 Regression] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) since r12-6904 jakub at gcc dot gnu.org @ 2024-05-21 9:20 ` jakub at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: jakub at gcc dot gnu.org @ 2024-05-21 9:20 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114772 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|13.3 |13.4 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- GCC 13.3 is being released, retargeting bugs to GCC 13.4. ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-05-21 9:20 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-04-18 15:36 [Bug c++/114772] New: pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) mjires at gcc dot gnu.org 2024-04-18 15:40 ` [Bug c++/114772] " pinskia at gcc dot gnu.org 2024-04-19 12:50 ` [Bug c++/114772] [13/14 Regression] pragma GCC target applied to earlier template function with __attribute__((warn_unused_result)) since r12-6904 jakub at gcc dot gnu.org 2024-05-21 9:20 ` [Bug c++/114772] [13/14/15 " jakub at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).