This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fortran, Patch] Memory sync after coarray image control statements and assignment


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]