When one passes -fupc-pts=struct to clang-upc, the value of UPC_MAX_BLOCK_SIZE is correctly set to 4294967295 (aka 2^32-1 or 0xFFFFFFFF). The problem I am seeing is with the following, based on the test guts_main/blocksize_neg.upc:
shared [-3] int *p;
This code is accepted by clang-upc!
Use of clang-upc2c renders -3 as as its 32-bit twos-complement equivalent 0xFFFFFFFD. So, I assume that clang-upc has accepted the blocksize of -3 after checking 0xFFFFFFFD <= 0xFFFFFFFF. This is consistent with the behavior with the default packed pts rep:
It would appear that some additional logic is needed to protect against negative block size in the pts=struct case, which the pts=packed is detecting for the wrong reason. The additional check would/could also improve the error message for the pts=packed case.
RFE: while somebody is looking at this, I think it would be helpful to the end-user to include the value of UPC_MAX_BLOCK_SIZE in the error message for block-size-too-large.
Would it be acceptable to cap the supported UPC_MAX_BLOCK_SIZE at 0x7FFFFFFF (by limiting UPCPhaseBits to at most 31)? If so, then this issue resolves almost trivially.
This is the first "child" issue of upc2c issue #74.
When one passes
-fupc-pts=struct
to clang-upc, the value of UPC_MAX_BLOCK_SIZE is correctly set to 4294967295 (aka 2^32-1 or 0xFFFFFFFF). The problem I am seeing is with the following, based on the test guts_main/blocksize_neg.upc:This code is accepted by clang-upc! Use of clang-upc2c renders -3 as as its 32-bit twos-complement equivalent 0xFFFFFFFD. So, I assume that clang-upc has accepted the blocksize of -3 after checking 0xFFFFFFFD <= 0xFFFFFFFF. This is consistent with the behavior with the default packed pts rep:
It would appear that some additional logic is needed to protect against negative block size in the pts=struct case, which the pts=packed is detecting for the wrong reason. The additional check would/could also improve the error message for the pts=packed case.
RFE: while somebody is looking at this, I think it would be helpful to the end-user to include the value of UPC_MAX_BLOCK_SIZE in the error message for block-size-too-large.