Array equality is typically expanded into a loop, but for small arrays such loops are inefficient (and the code generator might fail to turn them into linear code, especially when the array contains records). We optimize equality of 2-element arrays into an AND THEN expression, but only for array types whose bounds are given by a range expression. Now we do this for all 2-element arrays with compile-time known bounds, regardless of how their bounds are given, e.g. for array types declared like: type A1 is array (Integer range 1 .. 2) of ...; type A2 is array (Boolean) of ...; Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Expand_Array_Equality): Remove check of the array bound being an N_Range node; use Type_High_Bound/Type_Low_Bound, which handle all kinds of array bounds.