Ticket #17 (defect)

Opened 1 year ago

Last modified 1 year ago

blocksizeof2_neg, elemsizeof2_neg do not work as intended

Status: closed (duplicate)

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

blocksizeof2_neg.upc includes code:

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

int main()
{
        /*
         * To check that the type of the result from upc_blocksizeof operator is size_t 
         */

        /* 
         * upc_blocksizeof function returns size_t type but array_block_size was defined as long type 
         * So compiler MUST raise an ERROR accordingly
         */

        long array_block_size;
        array_block_size = upc_blocksizeof(A);

This negative test relies upon the assumption that long and size_t happen to not be assignment compatible, where in fact on most systems they are. Even if they were not, C specifies rules for assignment conversion of base types such that the above code should still compile without diagnostics, although it might generate undefined results.

Change History

09/06/07 12:18:07: Modified by bonachea@cs.berkeley.edu

  • summary changed from blocksizeof2_neg.upc does not work as intended to blocksizeof2_neg, elemsizeof2_neg do not work as intended.

elemsizeof2_neg is broken for the same reason.

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

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

Duplicate of ticket #6, ticket #8.