Ticket #16 (defect)

Opened 1 year ago

Last modified 1 year ago

barrier_neg and barrier2_neg should not expect compile failure

Status: closed (duplicate)

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

barrier_neg and barrier2_neg currently report failure on BUPC because compilation passes, however compilation should not be expected to fail.

barrier2_neg includes code:

        /*
         * To check that upc_notify and upc_wait statements should be 
         * called in alternating sequence, starting with a upc_notify 
         * and ending with a upc_wait statement
         * so the compiler must raise an ERROR here !!!
         */

        upc_notify 1; upc_notify 2; upc_notify 3;

        upc_wait 1; upc_wait 2; upc_wait 3;

which is a violation of UPC 6.6 Semantics 3: Each thread shall execute an alternating sequence of upc notify and upc wait statements, starting with a upc notify and ending with a upc wait statement.

Because it's a semantic violation (and not a constraint violation) the compiler is not obliged to detect it, and furthermore as it's a violation of a "shall" restriction, program behavior is undefined (ie the implementation is not obligated to catch the error at runtime either).

barrier_neg has a similar mistake:

        /*
         * To check that the expressions used as operands to upc_notify, 
         * upc_wait, upc_barrier and upc_fence must be integer expressions 
         * so the compiler must raise an ERROR here !!!
         */

        char A, B;

        upc_notify A;

        upc_wait B;

ignoring the fact that A and B are both uninitialized data (and assuming they differ), this falls under semantics 7:

The upc wait statement shall interrupt the execution of the program in an implementation defined manner if the value of its expression differs from the value of the expression on the upc notify statement issued by any thread in the current synchronization phase.

which indicates the implementation must generate a runtime error, not a compile error.

Change History

09/06/07 16:38:08: Modified by sbahra

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

Duplicate of ticket #4 of ticket #5.