public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c++/100326] New: Crash with `#pragma GCC unroll` when calling value which can't be called in template function @ 2021-04-29 0:44 ryan_greenblatt at brown dot edu 2021-04-29 7:34 ` [Bug c++/100326] " rguenth at gcc dot gnu.org ` (2 more replies) 0 siblings, 3 replies; 4+ messages in thread From: ryan_greenblatt at brown dot edu @ 2021-04-29 0:44 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100326 Bug ID: 100326 Summary: Crash with `#pragma GCC unroll` when calling value which can't be called in template function Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ryan_greenblatt at brown dot edu Target Milestone: --- ``` template<typename T> void f(T v) { #pragma GCC unroll v() for (;;) { } } int main() { f(0); } ``` https://godbolt.org/z/8bEscGszK Amusingly, this gets gcc and clang. ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/100326] Crash with `#pragma GCC unroll` when calling value which can't be called in template function 2021-04-29 0:44 [Bug c++/100326] New: Crash with `#pragma GCC unroll` when calling value which can't be called in template function ryan_greenblatt at brown dot edu @ 2021-04-29 7:34 ` rguenth at gcc dot gnu.org 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: rguenth at gcc dot gnu.org @ 2021-04-29 7:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100326 Richard Biener <rguenth at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Ever confirmed|0 |1 Keywords| |ice-on-invalid-code Status|UNCONFIRMED |NEW Last reconfirmed| |2021-04-29 --- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Confirmed. #0 0x0000000000d66842 in cp_parser_pragma_unroll (parser=0x7ffff65977b8, pragma_tok=0x7ffff7f2f0c8) at /home/rguenther/src/gcc3/gcc/cp/parser.c:44896 44896 if (!INTEGRAL_TYPE_P (TREE_TYPE (expr)) (gdb) l 44891 location_t location = cp_lexer_peek_token (parser->lexer)->location; 44892 tree expr = cp_parser_constant_expression (parser); 44893 unsigned short unroll; 44894 expr = maybe_constant_value (expr); 44895 HOST_WIDE_INT lunroll = 0; 44896 if (!INTEGRAL_TYPE_P (TREE_TYPE (expr)) 44897 || TREE_CODE (expr) != INTEGER_CST 44898 || (lunroll = tree_to_shwi (expr)) < 0 44899 || lunroll >= USHRT_MAX) 44900 { (gdb) p debug_tree (expr) <call_expr 0x7ffff66dc990 fn <parm_decl 0x7ffff66de000 v type <template_type_parm 0x7ffff66ccf18 T type_0 type_6 VOID align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type 0x7ffff66ccf18 index 0 level 1 orig_level 1 chain <type_decl 0x7ffff6597850 T>> used VOID t.ii:1:31 align:8 warn_if_not_align:0 context <function_decl 0x7ffff66cde00 f>> t.ii:2:25 start: t.ii:2:24 finish: t.ii:2:26> so we parsed this to an invalid GENERIC CALL_EXPR with a NULL TREE_TYPE (gdb) p expr->typed.type $3 = <tree 0x0> it should have at least been error_mark_node (or void_type_node). ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/100326] Crash with `#pragma GCC unroll` when calling value which can't be called in template function 2021-04-29 0:44 [Bug c++/100326] New: Crash with `#pragma GCC unroll` when calling value which can't be called in template function ryan_greenblatt at brown dot edu 2021-04-29 7:34 ` [Bug c++/100326] " rguenth at gcc dot gnu.org @ 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-02-08 23:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100326 --- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> --- This seems to be fixed on the trunk. I think by r14-6193-g59be79fd596ec8 . ^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/100326] Crash with `#pragma GCC unroll` when calling value which can't be called in template function 2021-04-29 0:44 [Bug c++/100326] New: Crash with `#pragma GCC unroll` when calling value which can't be called in template function ryan_greenblatt at brown dot edu 2021-04-29 7:34 ` [Bug c++/100326] " rguenth at gcc dot gnu.org 2024-02-08 23:42 ` pinskia at gcc dot gnu.org @ 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2 siblings, 0 replies; 4+ messages in thread From: pinskia at gcc dot gnu.org @ 2024-02-08 23:42 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100326 --- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I even tried: ``` template<typename T> void f(T v) { #pragma GCC unroll v() for (int i = 0; i < 10; i++) { } } int main() { f(0); } ``` ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-02-08 23:42 UTC | newest] Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-04-29 0:44 [Bug c++/100326] New: Crash with `#pragma GCC unroll` when calling value which can't be called in template function ryan_greenblatt at brown dot edu 2021-04-29 7:34 ` [Bug c++/100326] " rguenth at gcc dot gnu.org 2024-02-08 23:42 ` pinskia at gcc dot gnu.org 2024-02-08 23:42 ` pinskia 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).