All of the range checks can in theory be eliminated, except for the first one (a call to __gnat_rcheck_04, unlike the others which are calls to __gnat_rcheck_04), but they are not:
$ gcc -c -O2 -fdump-tree-all j.ads $ grep __gnat_rcheck_12 j.ads.118t.final_cleanup __gnat_rcheck_12 ("join_equal.adb", 14); __gnat_rcheck_12 ("join_equal.adb", 14); __gnat_rcheck_12 ("join_equal.adb", 29); __gnat_rcheck_12 ("join_equal.adb", 29); __gnat_rcheck_12 ("join_equal.adb", 39); __gnat_rcheck_12 ("join_equal.adb", 39); -- Summary: VRP fails to eliminate range checks in Ada code Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: baldrick at gcc dot gnu dot org GCC host triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30911