public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 @ 2014-04-10 4:51 andi-gcc at firstfloor dot org 2014-04-10 10:54 ` [Bug c/60804] " jakub at gcc dot gnu.org ` (11 more replies) 0 siblings, 12 replies; 13+ messages in thread From: andi-gcc at firstfloor dot org @ 2014-04-10 4:51 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Bug ID: 60804 Summary: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: andi-gcc at firstfloor dot org Created attachment 32577 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32577&action=edit test case from csmith I hacked csmith to add some _Cilk_spawn keywords and let it run for a bit. The only new ICE that turned up was this (in various incarnations) Here's the unreduced file from csmith. x.c:178:35: internal compiler error: in gimplify_expr, at gimplify.c:8335 if ((safe_div_func_uint8_t_u_u(_Cilk_spawn func_4(((--(*l_9)) , g_10), (((( void*)0 != g_13) , (&g_14[1][0] == ((safe_add_func_uint32_t_u_u(g_14[1][0], (g_1 9 || (((*l_2079) = _Cilk_spawn func_20(((safe_rshift_func_uint16_t_u_s((~((*l_39 ) = ((safe_rshift_func_int16_t_s_u(((*l_37) = (safe_add_func_int8_t_s_s((_Cilk_s pawn func_28(g_31, g_32) <= g_19), 0x5FL))), 11)) , 0xC254L))), 5)) & g_19))) != (void*)0)))) , &g_33))) | l_2080), g_420[4][0][1], g_847), l_2080))) ^ 0x79bad0 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_ba se**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:8335 0x799d38 gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_ba se**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7715 0x7a0ed3 gimplify_call_expr ../../gcc/gcc/gimplify.c:2354 0x79b1fc gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_ba se**, bool (*)(tree_node*), int) ../../gcc/gcc/gimplify.c:7402 0x79aacc gimplify_expr(tree_node**, gimple_statement_base**, gimple_statement_ba ... ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org @ 2014-04-10 10:54 ` jakub at gcc dot gnu.org 2014-04-10 14:53 ` andi-gcc at firstfloor dot org ` (10 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: jakub at gcc dot gnu.org @ 2014-04-10 10:54 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2014-04-10 CC| |jakub at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Can't reproduce this, supposedly starting with r208382 when this is rejected as invalid use of _Cilk_spawn. So, do you have any testcases that ICE even with current trunk? ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org 2014-04-10 10:54 ` [Bug c/60804] " jakub at gcc dot gnu.org @ 2014-04-10 14:53 ` andi-gcc at firstfloor dot org 2014-04-11 6:55 ` jakub at gcc dot gnu.org ` (9 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: andi-gcc at firstfloor dot org @ 2014-04-10 14:53 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Andi Kleen <andi-gcc at firstfloor dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #32577|0 |1 is obsolete| | --- Comment #2 from Andi Kleen <andi-gcc at firstfloor dot org> --- Created attachment 32580 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32580&action=edit this one still fails with current trunk ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org 2014-04-10 10:54 ` [Bug c/60804] " jakub at gcc dot gnu.org 2014-04-10 14:53 ` andi-gcc at firstfloor dot org @ 2014-04-11 6:55 ` jakub at gcc dot gnu.org 2014-04-11 7:39 ` jakub at gcc dot gnu.org ` (8 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: jakub at gcc dot gnu.org @ 2014-04-11 6:55 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|WAITING |NEW --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Reduced testcase: int bar (void); int foo () { if (_Cilk_spawn bar ()) return 5; return 0; } Whether this is valid Cilk+ or not, no idea. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (2 preceding siblings ...) 2014-04-11 6:55 ` jakub at gcc dot gnu.org @ 2014-04-11 7:39 ` jakub at gcc dot gnu.org 2014-04-11 13:08 ` evstupac at gmail dot com ` (7 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: jakub at gcc dot gnu.org @ 2014-04-11 7:39 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> --- According to http://software.intel.com/sites/products/documentation/doclib/stdxe/2013/composerxe/compiler/cpp-win/index.htm as well as http://www.cilkplus.org/sites/default/files/open_specifications/cilk_plus_language_specification_0_9.pdf this isn't valid (but we should then diagnose it), but whether these two (and which one of them) are the latest Cilk+ spec is unclear to me. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (3 preceding siblings ...) 2014-04-11 7:39 ` jakub at gcc dot gnu.org @ 2014-04-11 13:08 ` evstupac at gmail dot com 2014-04-11 13:10 ` mpolacek at gcc dot gnu.org ` (6 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: evstupac at gmail dot com @ 2014-04-11 13:08 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Stupachenko Evgeny <evstupac at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |evstupac at gmail dot com --- Comment #5 from Stupachenko Evgeny <evstupac at gmail dot com> --- Yes it is not valid. Please find latest spec at: https://www.cilkplus.org/sites/default/files/open_specifications/Intel_Cilk_plus_lang_spec_1.2.htm ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (4 preceding siblings ...) 2014-04-11 13:08 ` evstupac at gmail dot com @ 2014-04-11 13:10 ` mpolacek at gcc dot gnu.org 2014-04-11 14:15 ` jakub at gcc dot gnu.org ` (5 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: mpolacek at gcc dot gnu.org @ 2014-04-11 13:10 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> --- The following should disallow this in the C FE. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 5653e49..cbbb272 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -5153,6 +5153,9 @@ c_parser_if_statement (c_parser *parser) /* If the if statement contains array notations, then we expand them. */ if (flag_cilkplus && contains_array_notation_expr (if_stmt)) if_stmt = fix_conditional_array_notations (if_stmt); + /* But Cilk_spawn in controlling expression is invalid. */ + if (flag_cilkplus && contains_cilk_spawn_stmt (cond)) + error_at (loc, "%<_Cilk_spawn%> in if statement is not permitted"); add_stmt (if_stmt); } ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (5 preceding siblings ...) 2014-04-11 13:10 ` mpolacek at gcc dot gnu.org @ 2014-04-11 14:15 ` jakub at gcc dot gnu.org 2014-04-11 20:24 ` andi-gcc at firstfloor dot org ` (4 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: jakub at gcc dot gnu.org @ 2014-04-11 14:15 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- But then it is not valid in many other places (for/while/do condition, etc.). Perhaps if _Cilk_spawn is allowed in the grammer only in 3 specific cases it might be better to disallow it everywhere and check for it only in the 3 listed cases (whole statement, var initializer and rhs of assignment (but for the last one it has to be only toplevel assignment I guess, a = b = _Cilk_spawn foo (); is presumably also invalid, ditto a + (b = _Cilk_spawn foo ()); etc. ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (6 preceding siblings ...) 2014-04-11 14:15 ` jakub at gcc dot gnu.org @ 2014-04-11 20:24 ` andi-gcc at firstfloor dot org 2014-09-28 14:34 ` ak at gcc dot gnu.org ` (3 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: andi-gcc at firstfloor dot org @ 2014-04-11 20:24 UTC (permalink / raw) To: gcc-bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #8 from Andi Kleen <andi-gcc at firstfloor dot org> --- I went through my collection of gimplify:8335 from the generator. Not all of them are special statements. So some more general check would be needed. Some examples: (*l_11) = (g_9 = _Cilk_spawn func_2(l_4)); (*g_682) = _Cilk_spawn func_2(g_5, (((((g_5 | ((safe_add_func_int32_t_s_s((((*g_682) = _Cilk_spawn func_8(g_5, _Cilk_spawn func_12(g_5), (l_2841 = l_2841))) != (g_3060 = l_3057)), (safe_mod_func_uint16_t_u_u(g_868.f0, g_2089.f3)))) && 1UL)) , l_3063) & g_88) | (*l_3057)) , l_3064)); l_1679 ^= _Cilk_spawn func_10((((safe_lshift_func_int8_t_s_u(((((*l_1669) ^= (0x4BAFC8D6799626DALL || (((~((*l_1668) = (safe_rshift_func_uint16_t_u_u(((g_3 == (safe_mul_func_int16_t_s_s((safe_rshift_func_uint16_t_u_s(g_3, 2)), ((safe_mul_func_uint8_t_u_u(_Cilk_spawn func_24(&g_3, ((*l_32) &= (safe_rshift_func_int8_t_s_s(g_7, g_6[8][1][3]))), ((((_Cilk_spawn func_34(_Cilk_spawn func_37(((-1L) > (*l_2)), ((*l_925) = _Cilk_spawn func_43(g_6[7][3][2])), &g_198[1][1][7], l_2, (*l_2)), l_5[2][0][1]) && 0x43L) , g_317) ^ l_1665[0]) < g_604), l_2, l_5[4][8][2]), 1UL)) < 0xF63AL)))) <= l_1667), (*l_2))))) | 2L) , 1L))) > (-1L)) | l_1671[0][4]), 2)) , 1UL) > 0x8FL), l_5[4][3][1], (*l_2)); l_3901 |= (safe_sub_func_int16_t_s_s(((((safe_div_func_uint64_t_u_u(_Cilk_spawn func_6(l_12[0][3], (safe_add_func_uint64_t_u_u(((safe_sub_func_int32_t_s_s(_Cilk_spawn func_17(g_20[0], (safe_lshift_func_int8_t_s_u(((_Cilk_spawn func_23(((safe_add_func_uint32_t_u_u(((l_12[0][3] | l_12[8][2]) , (((safe_mod_func_int32_t_s_s(_Cilk_spawn func_30(g_20[0], (0x6E31BB00L >= (l_34 & 0L)), (((safe_div_func_uint64_t_u_u(g_20[0], l_12[5][2])) , l_12[0][3]) , l_12[0][3])), l_2523)) , l_12[0][3]) , 0xFC5A8F50L)), l_2523)) < l_12[0][3]), (*g_1492)) > (-1L)) ^ (*g_1492)), l_2690))), l_2690)) | 0xBE8DAE3C6AAFCCBCLL), l_2523)), l_2523, l_12[8][3], l_2523), l_3900)) != (*g_1492)) && l_12[8][4]) , (**g_3267)), l_12[0][3])); (*g_20) = _Cilk_spawn func_2(g_7, l_8, ((*l_3296) = _Cilk_spawn func_9(g_7, ((**g_2525) = (((g_15 = g_7) | (((((safe_rshift_func_int16_t_s_u(_Cilk_spawn func_18(g_20), 7)) >= (safe_mod_func_int64_t_s_s((safe_mod_func_uint64_t_u_u(l_3288, ((*l_3296) &= ((l_3289 || (safe_mul_func_int16_t_s_s(((((safe_unary_minus_func_int8_t_s(((((**g_2282) ^= (&g_528[0][0][1] != l_3293)) , l_3294[3][1][1]) & (***l_3293)))) , (***g_243)) > (*g_2850)) > (*g_242)), l_3295))) > (***l_3293))))), (***l_3293)))) , l_3297) , 1L) > 0x65L)) ^ l_3298)), (*g_242), (***l_3293))), l_3324); (**g_388) = _Cilk_spawn func_8((_Cilk_spawn func_10((g_12 , g_13)) | ((0x439DL || 0L) ^ (((*l_1983) = g_5[g_4]) , (((~((safe_mul_func_uint16_t_u_u(g_5[g_4], g_1613.f6)) , (((((g_161.f1 , &g_291) == l_1986) , (*l_1983)) != (*l_1983)) || (*g_379)))) ^ l_1987) | l_1987))))); ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (7 preceding siblings ...) 2014-04-11 20:24 ` andi-gcc at firstfloor dot org @ 2014-09-28 14:34 ` ak at gcc dot gnu.org 2014-09-28 14:38 ` ak at gcc dot gnu.org ` (2 subsequent siblings) 11 siblings, 0 replies; 13+ messages in thread From: ak at gcc dot gnu.org @ 2014-09-28 14:34 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 ak at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ak at gcc dot gnu.org --- Comment #9 from ak at gcc dot gnu.org --- This still ICEs with gcc version 5.0.0 20140926 (experimental) (GCC) ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (8 preceding siblings ...) 2014-09-28 14:34 ` ak at gcc dot gnu.org @ 2014-09-28 14:38 ` ak at gcc dot gnu.org 2014-11-11 5:11 ` ak at gcc dot gnu.org 2014-11-11 17:56 ` andi-gcc at firstfloor dot org 11 siblings, 0 replies; 13+ messages in thread From: ak at gcc dot gnu.org @ 2014-09-28 14:38 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #10 from ak at gcc dot gnu.org --- Reduced test case. It's probably invalid cilk, but gcc shouldn't ICE: fn1() { if (_Cilk_spawn func_2()) ; } ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (9 preceding siblings ...) 2014-09-28 14:38 ` ak at gcc dot gnu.org @ 2014-11-11 5:11 ` ak at gcc dot gnu.org 2014-11-11 17:56 ` andi-gcc at firstfloor dot org 11 siblings, 0 replies; 13+ messages in thread From: ak at gcc dot gnu.org @ 2014-11-11 5:11 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 --- Comment #11 from ak at gcc dot gnu.org --- Author: ak Date: Tue Nov 11 05:10:58 2014 New Revision: 217336 URL: https://gcc.gnu.org/viewcvs?rev=217336&root=gcc&view=rev Log: Error out for Cilk_spawn or array expression in forbidden places _Cilk_spawn or Cilk array expressions are only allowed on their own, but not in for(), if(), switch, do, while, goto, etc. The C parser didn't always check for that, which lead to ICEs earlier for invalid code. Add a generic helper that checks this and call it where needed in the C frontend. I chose to allow spawn/array for for init and increment expressions. While the Cilk spec could be interpreted to forbid it there too there didn't seem any reason to not allow it. One dark corner is spawn, array in statement expressions not at the end. Right now that's forbidden too. gcc/c-family/: 2014-11-10 Andi Kleen <ak@linux.intel.com> PR c/60804 * c-common.h (check_no_cilk): Declare. * cilk.c (get_error_location): New function. (check_no_cilk): Dito. gcc/c/: 2014-11-10 Andi Kleen <ak@linux.intel.com> PR c/60804 * c-parser.c (c_parser_statement_after_labels): Call check_no_cilk. (c_parser_if_statement): Dito. (c_parser_switch_statement): Dito. (c_parser_while_statement): Dito. (c_parser_do_statement): Dito. (c_parser_for_statement): Dito. * c-typeck.c (c_finish_loop): Dito. Modified: trunk/gcc/c-family/ChangeLog trunk/gcc/c-family/c-common.h trunk/gcc/c-family/cilk.c trunk/gcc/c/ChangeLog trunk/gcc/c/c-parser.c trunk/gcc/c/c-typeck.c ^ permalink raw reply [flat|nested] 13+ messages in thread
* [Bug c/60804] Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org ` (10 preceding siblings ...) 2014-11-11 5:11 ` ak at gcc dot gnu.org @ 2014-11-11 17:56 ` andi-gcc at firstfloor dot org 11 siblings, 0 replies; 13+ messages in thread From: andi-gcc at firstfloor dot org @ 2014-11-11 17:56 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=60804 Andi Kleen <andi-gcc at firstfloor dot org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #12 from Andi Kleen <andi-gcc at firstfloor dot org> --- Should be all fixed now in mainline. ^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2014-11-11 17:56 UTC | newest] Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2014-04-10 4:51 [Bug c/60804] New: Another CilkPlus ICE in gimplify_expr, at gimplify.c:8335 andi-gcc at firstfloor dot org 2014-04-10 10:54 ` [Bug c/60804] " jakub at gcc dot gnu.org 2014-04-10 14:53 ` andi-gcc at firstfloor dot org 2014-04-11 6:55 ` jakub at gcc dot gnu.org 2014-04-11 7:39 ` jakub at gcc dot gnu.org 2014-04-11 13:08 ` evstupac at gmail dot com 2014-04-11 13:10 ` mpolacek at gcc dot gnu.org 2014-04-11 14:15 ` jakub at gcc dot gnu.org 2014-04-11 20:24 ` andi-gcc at firstfloor dot org 2014-09-28 14:34 ` ak at gcc dot gnu.org 2014-09-28 14:38 ` ak at gcc dot gnu.org 2014-11-11 5:11 ` ak at gcc dot gnu.org 2014-11-11 17:56 ` andi-gcc at firstfloor dot 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).