[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-06-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

Jakub Jelinek  changed:

   What|Removed |Added

 Status|ASSIGNED|RESOLVED
 Resolution|--- |FIXED

--- Comment #11 from Jakub Jelinek  ---
Fixed.

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-06-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #10 from Jakub Jelinek  ---
Author: jakub
Date: Thu Jun 22 11:09:08 2017
New Revision: 249506

URL: https://gcc.gnu.org/viewcvs?rev=249506=gcc=rev
Log:
Backported from mainline
2017-05-22  Jakub Jelinek  

PR middle-end/80809
* omp-low.c (finish_taskreg_remap): New function.
(finish_taskreg_scan): If unit size of ctx->record_type
is non-constant, unshare the size expression and replace
decls in it with possible outer var refs.

* testsuite/libgomp.c/pr80809-2.c: New test.
* testsuite/libgomp.c/pr80809-3.c: New test.

Added:
branches/gcc-6-branch/libgomp/testsuite/libgomp.c/pr80809-2.c
branches/gcc-6-branch/libgomp/testsuite/libgomp.c/pr80809-3.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/omp-low.c
branches/gcc-6-branch/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-06-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #9 from Jakub Jelinek  ---
Author: jakub
Date: Thu Jun 22 11:08:25 2017
New Revision: 249505

URL: https://gcc.gnu.org/viewcvs?rev=249505=gcc=rev
Log:
Backported from mainline
2017-05-22  Jakub Jelinek  

PR middle-end/80809
* gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use
GOVD_SHARED rather than GOVD_PRIVATE with it.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect
GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE.

* testsuite/libgomp.c/pr80809-1.c: New test.

Added:
branches/gcc-6-branch/libgomp/testsuite/libgomp.c/pr80809-1.c
Modified:
branches/gcc-6-branch/gcc/ChangeLog
branches/gcc-6-branch/gcc/gimplify.c
branches/gcc-6-branch/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #8 from Jakub Jelinek  ---
Author: jakub
Date: Fri May 26 10:14:37 2017
New Revision: 248488

URL: https://gcc.gnu.org/viewcvs?rev=248488=gcc=rev
Log:
Backported from mainline
2017-05-22  Jakub Jelinek  

PR middle-end/80809
* omp-low.c (finish_taskreg_remap): New function.
(finish_taskreg_scan): If unit size of ctx->record_type
is non-constant, unshare the size expression and replace
decls in it with possible outer var refs.

* testsuite/libgomp.c/pr80809-2.c: New test.
* testsuite/libgomp.c/pr80809-3.c: New test.

Added:
branches/gcc-7-branch/libgomp/testsuite/libgomp.c/pr80809-2.c
branches/gcc-7-branch/libgomp/testsuite/libgomp.c/pr80809-3.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/omp-low.c
branches/gcc-7-branch/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-26 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #7 from Jakub Jelinek  ---
Author: jakub
Date: Fri May 26 10:13:34 2017
New Revision: 248487

URL: https://gcc.gnu.org/viewcvs?rev=248487=gcc=rev
Log:
Backported from mainline
2017-05-22  Jakub Jelinek  

PR middle-end/80809
* gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use
GOVD_SHARED rather than GOVD_PRIVATE with it.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect
GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE.

* testsuite/libgomp.c/pr80809-1.c: New test.

Added:
branches/gcc-7-branch/libgomp/testsuite/libgomp.c/pr80809-1.c
Modified:
branches/gcc-7-branch/gcc/ChangeLog
branches/gcc-7-branch/gcc/gimplify.c
branches/gcc-7-branch/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #6 from Jakub Jelinek  ---
Fixed on the trunk so far.

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #5 from Jakub Jelinek  ---
Author: jakub
Date: Mon May 22 18:54:54 2017
New Revision: 248346

URL: https://gcc.gnu.org/viewcvs?rev=248346=gcc=rev
Log:
PR middle-end/80809
* omp-low.c (finish_taskreg_remap): New function.
(finish_taskreg_scan): If unit size of ctx->record_type
is non-constant, unshare the size expression and replace
decls in it with possible outer var refs.

* testsuite/libgomp.c/pr80809-2.c: New test.
* testsuite/libgomp.c/pr80809-3.c: New test.

Added:
trunk/libgomp/testsuite/libgomp.c/pr80809-2.c
trunk/libgomp/testsuite/libgomp.c/pr80809-3.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/omp-low.c
trunk/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #4 from Jakub Jelinek  ---
Author: jakub
Date: Mon May 22 18:54:05 2017
New Revision: 248345

URL: https://gcc.gnu.org/viewcvs?rev=248345=gcc=rev
Log:
PR middle-end/80809
* gimplify.c (omp_add_variable): For GOVD_DEBUG_PRIVATE use
GOVD_SHARED rather than GOVD_PRIVATE with it.
(gimplify_adjust_omp_clauses_1, gimplify_adjust_omp_clauses): Expect
GOVD_SHARED rather than GOVD_PRIVATE with GOVD_DEBUG_PRIVATE.

* testsuite/libgomp.c/pr80809-1.c: New test.

Added:
trunk/libgomp/testsuite/libgomp.c/pr80809-1.c
Modified:
trunk/gcc/ChangeLog
trunk/gcc/gimplify.c
trunk/libgomp/ChangeLog

[Bug middle-end/80809] Multi-free error for variable size array used within OpenMP task

2017-05-22 Thread jakub at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80809

--- Comment #3 from Jakub Jelinek  ---
Created attachment 41400
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41400=edit
gcc8-pr80809.patch

Fix for the incorrect implicit determination.  The bug was that we turned the
(implicit in this case, but could be explicit too) shared clause on the
parallel
for the VLA into a private clause (to privatize the variable to hold debug info
in it; the actual VLA is then what a firstprivate pointer points to) too early,
we need to consider it shared while determining data sharing in inner
constructs, and only turn it into a private clause when we are done with that.

The other bug is with the incorrect VLA size, I'll work on it next.