clangupc / clang-upc

Clang UPC Front-End
https://clangupc.github.io/
Other
16 stars 5 forks source link

"#pragma upc upc_code" resets "#pragma upc strict" #77

Closed PHHargrove closed 9 years ago

PHHargrove commented 9 years ago

We have been seeing failures of clang-upc plus UPCR on gwu/VI_case1_i on PPC systems (probably for as long as we've been testing there), but not for clang-upc by itself nor for UPCR with clang-upc2c, gupc or bupc, nor on x86 or x86-64.

I finally had a chance to look at the problem today and find that instead of strict gets the generated code is producing relaxed gets. Due to the more relaxed memory model on PPC, relative to x86/x86-64, this leads to incorrect results on that test.

The following is a simple case to generate bad code from clang-upc WITHOUT use of UPCR. Compiling with "clang-upc -S -fverbose-asm" one can see the incorrect call generated:

#include <upc_strict.h>
#pragma upc upc_code
shared int x;
int foo(void) { return x; }

One can get the correct code simply by removing the second line (the pragma).

I suspect that the clang-upc code implementing "#pragma upc (strict|relaxed)" is unintentionally (and incorrectly) treating the unknown "upc_code" case as if it was "relaxed".

-Paul

PHHargrove commented 9 years ago

Fix for gwu/VI_case1_i has been confirmed in my testing on an affected Linux/PPC64 system.

Thanks, -Paul