Ticket #15 (defect)

Opened 1 year ago

Last modified 1 year ago

pointer_to_shared.upc uses erroneous cast

Status: closed (fixed)

Reported by: bonachea@cs.berkeley.edu Assigned to: apokayi
Priority: major Milestone:
Component: component1 Version:
Keywords: Cc:

pointer_to_shared.upc includes code:

#define B       2
int *pp1, *pp2;
shared[B] int *s1, *s2;
shared[B] int D[B*THREADS];
...
        s1 = &D[B*MYTHREAD];
        s2 = &D[(B*MYTHREAD + 1)%THREADS];

        pp1 = (int*) s1;
        pp2 = (int*) s2;

s2 is not guaranteed to have affinity to the current thread (eg with THREADS==2 it does not on thread 1), therefore the second cast to a pointer-to-local is erroneous.

I believe the intended code is to remove the %THREADS.

Also the same test includes code:

shared[N] int A[N*THREADS];

shared[B] int *p, *p1;
...
        p = &A[0];

this assignment should include a cast since the block sizes (and hence the pointer referent qualifiers) do not match.

Change History

09/06/07 16:35:43: Modified by sbahra

  • owner changed from somebody to apokayi.

10/14/07 04:49:30: Modified by apokayi

  • status changed from new to closed.
  • resolution set to fixed.

typo is fixed. casting is explicitly done.