stage3/array_range_check.cc
changeset 970 0ede7ca157e2
parent 965 c9eeb67ba939
child 975 3604464aa80e
equal deleted inserted replaced
969:706a152731ab 970:0ede7ca157e2
   214 			lower_ull  = -GET_CVALUE( int64, symbol->lower_limit);
   214 			lower_ull  = -GET_CVALUE( int64, symbol->lower_limit);
   215 			dimension  =  GET_CVALUE(uint64, symbol->upper_limit) + lower_ull;     
   215 			dimension  =  GET_CVALUE(uint64, symbol->upper_limit) + lower_ull;     
   216 			if (dimension < lower_ull)
   216 			if (dimension < lower_ull)
   217 				STAGE3_ERROR(0, symbol, symbol, "Number of elements in array subrange exceeds maximum number of elements (%llu).", std::numeric_limits< unsigned long long int >::max());
   217 				STAGE3_ERROR(0, symbol, symbol, "Number of elements in array subrange exceeds maximum number of elements (%llu).", std::numeric_limits< unsigned long long int >::max());
   218 		}
   218 		}
   219 	} else {debug_c::print_ast(symbol);ERROR;}
   219 	} else {ERROR;}
   220 
   220 
   221 	/* correct value for dimension is actually ---> dimension = upper_limit - lower_limit + 1
   221 	/* correct value for dimension is actually ---> dimension = upper_limit - lower_limit + 1
   222 	 * Up to now, we have only determined dimension = upper_limit - lower_limit
   222 	 * Up to now, we have only determined dimension = upper_limit - lower_limit
   223 	 * We must first check whether this last increment will cause an overflow!
   223 	 * We must first check whether this last increment will cause an overflow!
   224 	 */
   224 	 */