# HG changeset patch # User mjsousa # Date 1419752058 0 # Node ID 4612cf723c6a9a067b9db11e8635176b99a131f4 # Parent 619a2b9f6edf7d8cba30855e95d1cc01c16bc630 Make error message more informative. diff -r 619a2b9f6edf -r 4612cf723c6a stage3/array_range_check.cc --- a/stage3/array_range_check.cc Sat Dec 27 09:41:01 2014 +0000 +++ b/stage3/array_range_check.cc Sun Dec 28 07:34:18 2014 +0000 @@ -135,36 +135,36 @@ /* Check lower limit */ if ( VALID_CVALUE( int64, l->elements[i]) && VALID_CVALUE( int64, dimension->lower_limit)) if ( GET_CVALUE( int64, l->elements[i]) < GET_CVALUE( int64, dimension->lower_limit) ) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be >= %"PRId64").", GET_CVALUE( int64, dimension->lower_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be >= %"PRId64").", GET_CVALUE( int64, l->elements[i]), GET_CVALUE( int64, dimension->lower_limit)); continue;} if ( VALID_CVALUE( int64, l->elements[i]) && VALID_CVALUE(uint64, dimension->lower_limit)) if ( cmp_unsigned_signed( GET_CVALUE(uint64, dimension->lower_limit), GET_CVALUE( int64, l->elements[i])) > 0 ) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be >= %"PRIu64").", GET_CVALUE(uint64, dimension->lower_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be >= %"PRIu64").", GET_CVALUE( int64, l->elements[i]), GET_CVALUE(uint64, dimension->lower_limit)); continue;} if ( VALID_CVALUE(uint64, l->elements[i]) && VALID_CVALUE(uint64, dimension->lower_limit)) if ( GET_CVALUE(uint64, l->elements[i]) < GET_CVALUE(uint64, dimension->lower_limit)) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be >= %"PRIu64").", GET_CVALUE(uint64, dimension->lower_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be >= %"PRIu64").", GET_CVALUE(uint64, l->elements[i]), GET_CVALUE(uint64, dimension->lower_limit)); continue;} if ( VALID_CVALUE(uint64, l->elements[i]) && VALID_CVALUE( int64, dimension->lower_limit)) if ( cmp_unsigned_signed(GET_CVALUE(uint64, l->elements[i]), GET_CVALUE( int64, dimension->lower_limit)) < 0 ) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be >= %"PRId64").", GET_CVALUE( int64, dimension->lower_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be >= %"PRId64").", GET_CVALUE(uint64, l->elements[i]), GET_CVALUE( int64, dimension->lower_limit)); continue;} /* Repeat the same check, now for upper limit */ if ( VALID_CVALUE( int64, l->elements[i]) && VALID_CVALUE( int64, dimension->upper_limit)) if ( GET_CVALUE( int64, l->elements[i]) > GET_CVALUE( int64, dimension->upper_limit)) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be <= %"PRId64").", GET_CVALUE( int64, dimension->upper_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be <= %"PRId64").", GET_CVALUE( int64, l->elements[i]), GET_CVALUE( int64, dimension->upper_limit)); continue;} if ( VALID_CVALUE( int64, l->elements[i]) && VALID_CVALUE(uint64, dimension->upper_limit)) if ( cmp_unsigned_signed( GET_CVALUE(uint64, dimension->upper_limit), GET_CVALUE( int64, l->elements[i])) < 0 ) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be <= %"PRIu64").", GET_CVALUE(uint64, dimension->upper_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRId64", should be <= %"PRIu64").", GET_CVALUE( int64, l->elements[i]), GET_CVALUE(uint64, dimension->upper_limit)); continue;} if ( VALID_CVALUE(uint64, l->elements[i]) && VALID_CVALUE(uint64, dimension->upper_limit)) if ( GET_CVALUE(uint64, l->elements[i]) > GET_CVALUE(uint64, dimension->upper_limit)) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be <= %"PRIu64").", GET_CVALUE(uint64, dimension->upper_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be <= %"PRIu64").", GET_CVALUE(uint64, l->elements[i]), GET_CVALUE(uint64, dimension->upper_limit)); continue;} if ( VALID_CVALUE(uint64, l->elements[i]) && VALID_CVALUE( int64, dimension->upper_limit)) if ( cmp_unsigned_signed(GET_CVALUE(uint64, l->elements[i]), GET_CVALUE( int64, dimension->upper_limit)) > 0 ) - {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be <= %"PRId64").", GET_CVALUE( int64, dimension->upper_limit)); continue;} + {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (using constant value of %"PRIu64", should be <= %"PRId64").", GET_CVALUE(uint64, l->elements[i]), GET_CVALUE( int64, dimension->upper_limit)); continue;} } }