public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub 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: Fri, 23 Sep 2022 08:59:27 +0000 [thread overview] Message-ID: <bug-106981-4-Imt6vFKld5@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 --- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Slightly more reduced: void foo (int a, double *b, double *c, double *d, long long e) { #pragma omp atomic capture c[a] = d[((int) (e / 10 + 1))] = b[a] + d[((int) e / 10 + 1)]; } The fix could be either partially backport what C++ FE did in --- gcc/c/c-typeck.cc.jj 2022-09-23 09:02:56.525318361 +0200 +++ gcc/c/c-typeck.cc 2022-09-23 10:33:06.596467788 +0200 @@ -16069,6 +16069,9 @@ c_tree_equal (tree t1, tree t2) if (code1 != code2) return false; + if (CONSTANT_CLASS_P (t1) && !comptypes (TREE_TYPE (t1), TREE_TYPE (t2))) + return false; + switch (code1) { case INTEGER_CST: Or we could --- gcc/c/c-typeck.cc.jj 2022-09-23 09:02:56.525318361 +0200 +++ gcc/c/c-typeck.cc 2022-09-23 10:33:06.596467788 +0200 @@ -16072,7 +16070,7 @@ c_tree_equal (tree t1, tree t2) switch (code1) { case INTEGER_CST: - return wi::to_wide (t1) == wi::to_wide (t2); + return wi::to_widest (t1) == wi::to_widest (t2); case REAL_CST: return real_equal (&TREE_REAL_CST (t1), &TREE_REAL_CST (t2)); but then it is accepted instead of rejected unlike C++. I'm afraid even the for (code1 = TREE_CODE (t1); CONVERT_EXPR_CODE_P (code1) || code1 == NON_LVALUE_EXPR; code1 = TREE_CODE (t1)) t1 = TREE_OPERAND (t1, 0); for (code2 = TREE_CODE (t2); CONVERT_EXPR_CODE_P (code2) || code2 == NON_LVALUE_EXPR; code2 = TREE_CODE (t2)) t2 = TREE_OPERAND (t2, 0); stuff is dangerous, I guess one could construct a valid OpenMP testcase like: void bar (int *a) { unsigned int b = 0x100; #pragma omp atomic update a[(unsigned char) b] = a[(unsigned short) b] + a[(unsigned char) b]; #pragma omp atomic update a[(unsigned char) b] = a[(unsigned char) b] + a[(unsigned short) b]; } where for C++ I think we do the right thing in both cases, atomic increment of a[0] by a[0x100], but in C we do atomic increment of a[0] by a[0] in the first case. Now, wonder what will break if I just strip same type casts and for others like in C++ require same type.
next prev parent reply other threads:[~2022-09-23 8:59 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 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 [this message] 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-Imt6vFKld5@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).