clangupc / clang-upc

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

warning on void * - discrad qualifiers #84

Closed nenadv closed 8 years ago

nenadv commented 8 years ago

I noticed few warnings from the runtime barrier code. It boils down to this example:

void
test (void *argi, strict shared void *arg)
{
  *(strict shared int *)arg = 1;
  *(int *)argi = 1;
}

shared strict int x;
int y;

void
test_call ()
{
  test(&y, &x);
}
------
[nenad@dev bin]$ ./clang-upc -c t.upc
t.upc:14:12: warning: passing 'shared strict int *' to parameter of type 'shared strict void *' discards qualifiers
      [-Wincompatible-pointer-types-discards-qualifiers]
  test(&y, &x);
           ^~
t.upc:2:39: note: passing argument to parameter 'arg' here
test (void *argi, strict shared void *arg)

There should be no warning here and GUPC does not produce any warning.

Also, the barrier warning is a bit different as it has '[0]' in the warning for the type:

smp/upc_barrier.upc:181:36: warning: passing 'shared [0] strict int *' to
      parameter of type 'shared strict void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
  int wait_cnt = __upc_atomic_inc (&__upc_btree[thread].wait);
swatanabe commented 8 years ago

AMDG

On 11/06/2015 02:57 PM, Nenad Vukicevic wrote:

[nenad@dev bin]$ ./clang-upc -c t.upc t.upc:14:12: warning: passing 'shared strict int ' to parameter of type 'shared strict void ' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] test(&y, &x);

I'm guessing that a check was accidentally dropped or moved in the last merge. It should be pretty easy to fix.

In Christ, Steven Watanabe