public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/101167] New: Miscompilation of task_reduction
@ 2021-06-22 17:41 jakub at gcc dot gnu.org
  2021-06-22 17:41 ` [Bug middle-end/101167] " jakub at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-06-22 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

            Bug ID: 101167
           Summary: Miscompilation of task_reduction
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: jakub at gcc dot gnu.org
          Reporter: jakub at gcc dot gnu.org
  Target Milestone: ---

struct S { int a, b, c[2]; };

void
init (struct S *x)
{
  x->a = 0;
  x->b = 0;
  x->c[0] = 0;
  x->c[1] = 0;
}

void
merge (struct S *x, struct S *y)
{
  x->a += y->a;
  x->b += y->b;
}

#pragma omp declare reduction (+: struct S : merge (&omp_out, &omp_in))
initializer (init (&omp_priv))

void
foo (struct S x)
{
  #pragma omp taskgroup task_reduction (+: x)
  {
    #pragma omp task in_reduction (+: x)
    {
      x.a++;
      x.b++;
    }
    #pragma omp task in_reduction (+: x)
    {
      x.a += 4;
      x.b += 14;
    }
    #pragma omp task in_reduction (+: x)
    {
      x.a += 9;
      x.b += 19;
    }
  }
  if (x.a != 56 || x.b != 86)
    __builtin_abort ();
}

int
main ()
{
  struct S x = { 42, 52 };
  #pragma omp parallel master
  foo (x);
  return 0;
}

is miscompiled, merge is called with the same argument twice instead of merging
from the task privatized variable(s) into the PARM_DECL.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
@ 2021-06-22 17:41 ` jakub at gcc dot gnu.org
  2021-06-23  8:06 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-06-22 17:41 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |openmp, wrong-code
   Last reconfirmed|                            |2021-06-22
             Status|UNCONFIRMED                 |ASSIGNED

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
  2021-06-22 17:41 ` [Bug middle-end/101167] " jakub at gcc dot gnu.org
@ 2021-06-23  8:06 ` cvs-commit at gcc dot gnu.org
  2021-06-23 13:19 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-23  8:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:679506c3830ea1a93c755413609bfac3538e2cbd

commit r12-1740-g679506c3830ea1a93c755413609bfac3538e2cbd
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 23 10:03:28 2021 +0200

    openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs
[PR101167]

    The following testcase FAILs, because the UDR combiner is invoked
incorrectly.
    lower_omp_rec_clauses expects that when it sets
    DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
    for both the placeholder and the var that everything will be properly
    regimplified, but as the variable in question is a PARM_DECL rather than
    VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
    and so it is not.

    2021-06-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/101167
            * omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
            and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

            * testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
  2021-06-22 17:41 ` [Bug middle-end/101167] " jakub at gcc dot gnu.org
  2021-06-23  8:06 ` cvs-commit at gcc dot gnu.org
@ 2021-06-23 13:19 ` cvs-commit at gcc dot gnu.org
  2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-23 13:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:f50a222dffb448ef5c69a64b6945acafc6b16e12

commit r11-8643-gf50a222dffb448ef5c69a64b6945acafc6b16e12
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 23 10:03:28 2021 +0200

    openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs
[PR101167]

    The following testcase FAILs, because the UDR combiner is invoked
incorrectly.
    lower_omp_rec_clauses expects that when it sets
    DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
    for both the placeholder and the var that everything will be properly
    regimplified, but as the variable in question is a PARM_DECL rather than
    VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
    and so it is not.

    2021-06-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/101167
            * omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
            and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

            * testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

    (cherry picked from commit 679506c3830ea1a93c755413609bfac3538e2cbd)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-06-23 13:19 ` cvs-commit at gcc dot gnu.org
@ 2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:36 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-10  8:19 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:6a2724b37766b612e5b7695ed39042a5e707c971

commit r10-10625-g6a2724b37766b612e5b7695ed39042a5e707c971
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 23 10:03:28 2021 +0200

    openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs
[PR101167]

    The following testcase FAILs, because the UDR combiner is invoked
incorrectly.
    lower_omp_rec_clauses expects that when it sets
    DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
    for both the placeholder and the var that everything will be properly
    regimplified, but as the variable in question is a PARM_DECL rather than
    VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
    and so it is not.

    2021-06-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/101167
            * omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
            and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

            * testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

    (cherry picked from commit 679506c3830ea1a93c755413609bfac3538e2cbd)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
@ 2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
  2022-05-11  6:36 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-05-11  6:20 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:7ce8cb98ef1b6a8de2918b963d225eeee52dae9c

commit r9-10082-g7ce8cb98ef1b6a8de2918b963d225eeee52dae9c
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Jun 23 10:03:28 2021 +0200

    openmp: Fix up *_reduction clause handling with UDRs on PARM_DECLs
[PR101167]

    The following testcase FAILs, because the UDR combiner is invoked
incorrectly.
    lower_omp_rec_clauses expects that when it sets
    DECL_VALUE_EXPR/DECL_HAS_VALUE_EXPR_P
    for both the placeholder and the var that everything will be properly
    regimplified, but as the variable in question is a PARM_DECL rather than
    VAR_DECL, lower_omp_regimplify_p doesn't say that it should be regimplified
    and so it is not.

    2021-06-23  Jakub Jelinek  <jakub@redhat.com>

            PR middle-end/101167
            * omp-low.c (lower_omp_regimplify_p): Regimplify also PARM_DECLs
            and RESULT_DECLs that have DECL_HAS_VALUE_EXPR_P set.

            * testsuite/libgomp.c-c++-common/task-reduction-15.c: New test.

    (cherry picked from commit 679506c3830ea1a93c755413609bfac3538e2cbd)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug middle-end/101167] Miscompilation of task_reduction
  2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
@ 2022-05-11  6:36 ` jakub at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-05-11  6:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101167

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-11  6:36 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 17:41 [Bug middle-end/101167] New: Miscompilation of task_reduction jakub at gcc dot gnu.org
2021-06-22 17:41 ` [Bug middle-end/101167] " jakub at gcc dot gnu.org
2021-06-23  8:06 ` cvs-commit at gcc dot gnu.org
2021-06-23 13:19 ` cvs-commit at gcc dot gnu.org
2022-05-10  8:19 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:20 ` cvs-commit at gcc dot gnu.org
2022-05-11  6:36 ` 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).