This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug ada/34118] Please enable stack checking (-fstack-check) by default
- From: "ebotcazou at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Nov 2007 18:35:15 -0000
- Subject: [Bug ada/34118] Please enable stack checking (-fstack-check) by default
- References: <bug-34118-286@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #2 from ebotcazou at gcc dot gnu dot org 2007-11-16 18:35 -------
> GCC supports two ways to implement stack overflow checks: using guard pages
> called "probes", and inserting stack checking code into every subprogram.
That's confused. Probes are not "guard pages" and you always need to insert
stack checking code into every subprogram to do stack checking.
> The probes require support from the both OS and hardware, so are not
> suitable for all targets.
Correct, but it's nevertheless the preferred method.
> Moreover, they can miss stack overflows if a subprogram writes to a page
> *after* the guard page (rather that into it).
That's not true of probes in general, only of the generic implementation of
the probing method in GCC. The implementation on Alpha/Tru64 doesn't suffer
from this defect for example.
> GCC has a warning about this situation. Therefore, I suggest a new
> command-line switch to force insertion of stack checking code (rather than
> guard pages) for those programs that trigger the warning.
That's even more confused. The warning is independent of the checking method,
it is issued with the other method (stack checking routine) too, for example
on x86/Linux. You cannot get rid of it without changing the program, with
the current implementation of stack checking. That's one of the reasons why
stack checking is not enabled by default.
--
ebotcazou at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34118