By default, GCC is not an Ada compiler and has not been one for years, because
range checks are disabled by default and require an explicit switch (-gnato). 
The rationale, as I understand it, was that range checks were expensive in
terms of CPU usage.

However, the rationale is much less valid now that CPUs are more powerful and,
more importantly, thanks to improvements in GCC's range checks elimination.

The drawback of the current situation is that almost every new user of Ada, at
some point, is surprised because they don't get the expected Constraint_Error. 
In other words, GCC fails the Law of Least Astonishment.

Range checks can always be disabled explicitly with -gnatp or pragma Suppress.

Therefore: please enable range checks by default.

I'm going to file a separate bug report for stack checking, which is also
required by the Ada Reference Manual.


-- 
           Summary: Please enable range checks by default (-gnato)
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ludovic at ludovic-brenta dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34117

Reply via email to