Closed bonachea closed 10 years ago
AMDG
On 04/04/2014 01:26 AM, bonachea wrote:
The problem is UPC2C has promoted the two block-scoped static shared variables (I) to global scope (in order to allow allocation from a different function at startup), but has not mangled the names to ensure uniqueness.
On it.
In Christ, Steven Watanabe
From https://upc-bugs.lbl.gov/bugzilla/show_bug.cgi?id=3216 :
UPC2C is miscompiling atomic_test on all platforms. The core problem is demonstrated in the following test program:
trans_bupc passes the test. UPC2C fails:
{freebsd9-amd64 ~/UPC/code} /home/phargrov/upcnightly/cupc2c/runtime/inst/dbg_cupc2c/bin/upcc -save-temps staticbug.upc {freebsd9-amd64 ~/UPC/code} ./staticbug UPCR: UPC thread 0 of 1 on freebsd9-amd64.qemu (pshm node 0 of 1, process 0 of 1, pid=31352) ERROR 25: Assert pI1 != pI2 ERROR 26: Assert pI1 != pI3 ERROR 27: Assert pI2 != pI3 ERROR 28: Assert pI1 == 1 ERROR 29: Assert pI2 == 2 done.
The relevant generated code:
The problem is UPC2C has promoted the two block-scoped static shared variables (I) to global scope (in order to allow allocation from a different function at startup), but has not mangled the names to ensure uniqueness. Consequently, the shared variables which were separate in UPC now name-collide with each other and a similarly-named variable at global scope, resulting in all three variables aliased to the same shared space. Small changes to the declarations in the test (eg adding a definite blocksize to one of the I declarations) results in backend type mismatch errors from the duplicate declarations.
This miscompilation and resulting incorrect aliasing leads to interference between most of the test modules in atomic_test and memory corruption due to accessing beyond the end of differently-sized objects.
I don't know the release schedule for UPC2C, but this seems like a blocker.