Ticket #18 (defect)

Opened 1 year ago

Last modified 1 year ago

cast_neg should not expect a compile failure

Status: closed (duplicate)

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

cast_neg expects to receive a compile failure. cast_neg.upc includes:

shared int a;

int main()
{
        /*
         * To check that shared type qualifier objects cannot be cast to non-shared qualifier objects
         */

        size_t  thread_number;
        int     *prv_ptr;

        /* will work only for thread 0 */
        prv_ptr = (int *) &a;

This is a violation of 6.4.3 semantic 4:

If a non-null pointer-to-shared is cast11 to a pointer-to-local12 and the affinity of the pointed-to shared object is not to the current thread, the result is undefined.

However it's a semantic violation (which means no compiler diagnostic is required, and in fact in many cases the violation is statically undecidable). Furthermore the behavior is stated to be undefined, which means a runtime diagnostic is also not required.

Change History

09/06/07 16:40:45: Modified by sbahra

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

Duplicate of ticket #7.