public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/34117]  New: Please enable range checks by default (-gnato)
@ 2007-11-16 12:54 ludovic at ludovic-brenta dot org
  2007-11-16 14:27 ` [Bug ada/34117] " jeff at thecreems dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: ludovic at ludovic-brenta dot org @ 2007-11-16 12:54 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] Please enable range checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
@ 2007-11-16 14:27 ` jeff at thecreems dot com
  2007-11-16 18:07 ` niklas dot holsti at tidorum dot fi
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: jeff at thecreems dot com @ 2007-11-16 14:27 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from jeff at thecreems dot com  2007-11-16 14:27 -------
Seems like a good idea. Since we often say that correctness should come before
performance when it comes to optimization, it has always seemed odd to me that
performance was the default mode of operation.

We can complain all we want that users should read the manual before they start
using the compiler but the fact is they don't and probably never will.

I do wonder if perhaps a new flag that just disables range checking to get the
'old' behavior would be warranted?


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] Please enable range checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
  2007-11-16 14:27 ` [Bug ada/34117] " jeff at thecreems dot com
@ 2007-11-16 18:07 ` niklas dot holsti at tidorum dot fi
  2007-11-16 23:16 ` listor3 dot rombobeorn at tdcpost dot se
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: niklas dot holsti at tidorum dot fi @ 2007-11-16 18:07 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from niklas dot holsti at tidorum dot fi  2007-11-16 18:07 -------
(In reply to comment #1)
> Seems like a good idea.

I think so, too.

> I do wonder if perhaps a new flag that just disables range checking to get the
> 'old' behavior would be warranted?

Yes, that would definitely be a good help for the transition.


-- 

niklas dot holsti at tidorum dot fi changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |niklas dot holsti at tidorum
                   |                            |dot fi


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] Please enable range checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
  2007-11-16 14:27 ` [Bug ada/34117] " jeff at thecreems dot com
  2007-11-16 18:07 ` niklas dot holsti at tidorum dot fi
@ 2007-11-16 23:16 ` listor3 dot rombobeorn at tdcpost dot se
  2007-11-20 14:49 ` bauhaus at futureapps dot de
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: listor3 dot rombobeorn at tdcpost dot se @ 2007-11-16 23:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from listor3 dot rombobeorn at tdcpost dot se  2007-11-16 23:16 -------
I've never seen any numbers on just how expensive -gnato is, but provided that
the cost is moderate I think it should be on by default.


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] Please enable range checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
                   ` (2 preceding siblings ...)
  2007-11-16 23:16 ` listor3 dot rombobeorn at tdcpost dot se
@ 2007-11-20 14:49 ` bauhaus at futureapps dot de
  2007-11-21  6:55 ` [Bug ada/34117] Please enable overflow " charlet at gcc dot gnu dot org
  2009-03-08  8:58 ` [Bug ada/34117] " ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: bauhaus at futureapps dot de @ 2007-11-20 14:49 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from bauhaus at futureapps dot de  2007-11-20 14:49 -------
I can't resist pointing out that right now I am seeing an
update to widely used free software where once again an integer
overflow is creating a security hole in the system. (CVE-2007-4619)


-- 


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] Please enable overflow checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
                   ` (3 preceding siblings ...)
  2007-11-20 14:49 ` bauhaus at futureapps dot de
@ 2007-11-21  6:55 ` charlet at gcc dot gnu dot org
  2009-03-08  8:58 ` [Bug ada/34117] " ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: charlet at gcc dot gnu dot org @ 2007-11-21  6:55 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from charlet at gcc dot gnu dot org  2007-11-21 06:55 -------
This report is confused: range checking is enabled by default.

-gnato is about overflow checking, not range checking.

Arno


-- 

charlet at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Please enable range checks  |Please enable overflow
                   |by default (-gnato)         |checks by default (-gnato)


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Bug ada/34117] enable overflow checks by default (-gnato)
  2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
                   ` (4 preceding siblings ...)
  2007-11-21  6:55 ` [Bug ada/34117] Please enable overflow " charlet at gcc dot gnu dot org
@ 2009-03-08  8:58 ` ebotcazou at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2009-03-08  8:58 UTC (permalink / raw)
  To: gcc-bugs



-- 

ebotcazou at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ebotcazou at gcc dot gnu dot
                   |                            |org
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2009-03-08 08:58:26
               date|                            |
            Summary|Please enable overflow      |enable overflow checks by
                   |checks by default (-gnato)  |default (-gnato)


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


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-03-08  8:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-16 12:54 [Bug ada/34117] New: Please enable range checks by default (-gnato) ludovic at ludovic-brenta dot org
2007-11-16 14:27 ` [Bug ada/34117] " jeff at thecreems dot com
2007-11-16 18:07 ` niklas dot holsti at tidorum dot fi
2007-11-16 23:16 ` listor3 dot rombobeorn at tdcpost dot se
2007-11-20 14:49 ` bauhaus at futureapps dot de
2007-11-21  6:55 ` [Bug ada/34117] Please enable overflow " charlet at gcc dot gnu dot org
2009-03-08  8:58 ` [Bug ada/34117] " ebotcazou at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).