This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Fortran, Patch] Memory sync after coarray image control statements and assignment
- From: Tobias Burnus <burnus at net-b dot de>
- To: Alessandro Fanfarillo <fanfarillo dot gcc at gmail dot com>, gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, opencoarrays at googlegroups dot com
- Date: Mon, 7 Dec 2015 08:20:04 +0100
- Subject: Re: [Fortran, Patch] Memory sync after coarray image control statements and assignment
- Authentication-results: sourceware.org; auth=none
- References: <CAHqFgjUBb5k7tvU8NnyKW99aa7iT4=Q0KboN21eqeUmYeNh-dQ at mail dot gmail dot com>
Dear Alessandro, dear all,
Alessandro Fanfarillo wrote:
currently, a coarray assignment in a program composed by a single
segment (without any sync statements) produces wrong results.
Always - or only with optimization?
Furthermore, a coarray code
compiled with an optimization flag higher that -O0 may produce wrong
results. The patch (re)introduces a __sync_synchronize() after coarray
image control statements (sync all, sync images, critical, locks and
events) and get/put.
I wonder whether using
__asm__ __volatile__ ("":::"memory");
would be sufficient as it has a way lower overhead than
__sync_synchronize().
That would be something like:
r = build_stmt (input_location, ASM_EXPR, string,
output_operands, input_operands,
clobbers, labels);
ASM_VOLATILE_P (r) = 1;
with string = "", output_operands = NULL_TREE, input_operands =
NULL_TREE, clobbers = "memory" and labels = NULL_TREE. (Except that
string+clobbers are trees and not char[].)
Cheers,
Tobias