public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/106981] [10/11/12/13 Regression][OpenACC][OpenMP] ICE in decompose, at wide-int.h:984 with '#pragma omp/acc atomic capture' Date: Wed, 21 Sep 2022 13:20:24 +0000 [thread overview] Message-ID: <bug-106981-4-15C1EWyGJA@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-106981-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106981 Tobias Burnus <burnus at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords|ice-on-valid-code |ice-on-invalid-code --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- Fails in c_parser_binary_expression's POP for the second c_type_equal, which is probably: stack[sp].expr \ = convert_lvalue_to_rvalue (stack[sp].loc, \ stack[sp].expr, true, true); \ there: c_tree_equal (t1=0x7ffff710dce0, t2=0x7ffff710dba0) at ../../repos/gcc-trunk-commit/gcc/c/c-typeck.cc:16039 (gdb) p debug((tree)0x7ffff710dce0) *(totals + (sizetype) ((long unsigned int) (x % ((int) n / 10 + 1)) * 8)) (gdb) p debug((tree)0x7ffff710dba0) *(totals + (sizetype) ((long unsigned int) (x % (int) ((unsigned int) (n / 10) + 1)) * 8)) where 'n' is 'long long' and 'x' and the digits are 'int' - the expr right of '%' differs in terms of casts. The ICE can be prevented with: ------------------------ --- a/gcc/c/c-typeck.cc +++ b/gcc/c/c-typeck.cc @@ -16216,6 +16216,9 @@ c_tree_equal (tree t1, tree t2) && n != TREE_OPERAND_LENGTH (t2)) return false; + if (n >= TREE_OPERAND_LENGTH (t2)) + return false; + for (i = 0; i < n; ++i) if (!c_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i))) return false; ------------------------ With this patch, the code fails – but C++ and C have different messages. * gcc – points to tailing ';': input5.i:7:86: error: invalid form of ‘#pragma omp atomic’ before ‘;’ token 7 | c[x] = totals[x%((int)(n/10 + 1))] = (a[x] + b[x]) + totals[x%((int) n/10 + 1)]; | ^ * g++ - points to '(' in '... = (a[x ...': input5.i:7:44: error: invalid form of ‘#pragma omp atomic’ before ‘(’ token 7 | c[x] = totals[x%((int)(n/10 + 1))] = (a[x] + b[x]) + totals[x%((int) n/10 + 1)]; | ^ ************** Open... specification view. The expression is in the source code: __v_ = __x________________________ = ____expr_____ + ________x'________________ c[x] = totals[x%((int)(n/10 + 1))] = (a[x] + b[x]) + totals[x%((int) n/10 + 1)]; and, obviously, x != x' due to the cast differences. Looking at the OpenACC 3.2 spec, he last expr fits, except that x != x': --------- If the atomic-clause is capture: v = x++; v = x--; v = ++x; v = --x; v = x binop= expr; v = x = x binop expr; v = x = expr binop x; --------- Likewise in OpenMP 5.2: --------- An update-atomic structured block is update-expr-stmt, an update expression statement that has one of the following forms: ... x = x binop expr; x = expr binop x; ... A capture-atomic structured block is capture-stmt, a capture statement that has one of the following forms: v = expr-stmt ... ---------
next prev parent reply other threads:[~2022-09-21 13:20 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-09-20 16:40 [Bug c/106981] New: [OpenMP] ICE in decompose, at wide-int.h:984 with '#pragma acc " burnus at gcc dot gnu.org 2022-09-20 16:46 ` [Bug c/106981] [OpenACC][OpenMP] ICE in decompose, at wide-int.h:984 with '#pragma omp/acc " burnus at gcc dot gnu.org 2022-09-21 7:49 ` [Bug c/106981] [10/11/12/13 Regression][OpenACC][OpenMP] " rguenth at gcc dot gnu.org 2022-09-21 13:20 ` burnus at gcc dot gnu.org [this message] 2022-09-21 13:36 ` jakub at gcc dot gnu.org 2022-09-21 14:10 ` burnus at gcc dot gnu.org 2022-09-23 8:59 ` jakub at gcc dot gnu.org 2022-09-23 9:08 ` burnus at gcc dot gnu.org 2022-09-23 9:15 ` jakub at gcc dot gnu.org 2022-09-23 9:44 ` jakub at gcc dot gnu.org 2022-09-24 7:31 ` cvs-commit at gcc dot gnu.org 2022-10-18 8:43 ` [Bug c/106981] [10/11/12 " rguenth at gcc dot gnu.org 2022-11-03 0:23 ` cvs-commit at gcc dot gnu.org 2022-11-04 8:31 ` cvs-commit at gcc dot gnu.org 2022-11-04 11:01 ` [Bug c/106981] [10 " jakub at gcc dot gnu.org 2023-05-03 15:19 ` cvs-commit at gcc dot gnu.org 2023-05-04 7:19 ` jakub at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-106981-4-15C1EWyGJA@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).