Fix bug in checking array ranges.
--- 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
--- 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;}
}