# HG changeset patch # User Mario de Sousa # Date 1346328482 -3600 # Node ID 99b45154eb2c095d579becea8f90fa9e698d77bf # Parent dd76ce4a7e22e1b9395c5eec8d6397ad0d9839b0 Fix bug in checking array ranges. diff -r dd76ce4a7e22 -r 99b45154eb2c configure --- a/configure Thu Aug 30 13:06:54 2012 +0100 +++ b/configure Thu Aug 30 13:08:02 2012 +0100 @@ -4613,7 +4613,8 @@ # Check bison version, we need a version great or equal than 2.4 to build matiec. -[[ $(bison --version) =~ ([0-9][.][0-9]*) ]] && version_bison="${BASH_REMATCH[1]}" +version_bison="$(bison --version | sed q | cut -d' ' -f4)" +version_bison=${version_bison:0:3} if awk -v ver="$version_bison" 'BEGIN { if (ver < 2.4) exit 1; }'; then : have_bison_correct=yes diff -r dd76ce4a7e22 -r 99b45154eb2c stage3/array_range_check.cc --- a/stage3/array_range_check.cc Thu Aug 30 13:06:54 2012 +0100 +++ b/stage3/array_range_check.cc Thu Aug 30 13:08:02 2012 +0100 @@ -161,7 +161,7 @@ {STAGE3_ERROR(0, symbol, symbol, "Array access out of bounds (should be <= %"PRIu64").", 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 ) + 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;} }