Subject: Re: toolchain/22118: make won't compile with -Wcast-qual -Wstrict-prototypes and more
To: NetBSD Toolchain Technical Discussion List <tech-toolchain@NetBSD.ORG>
From: Ignatios Souvatzis <email@example.com>
Date: 07/17/2003 22:48:50
Content-Type: text/plain; charset=us-ascii
On Thu, Jul 17, 2003 at 09:34:07PM +0100, David Laight wrote:
> > My own experience with analyzing runtime bugs that I have found and
> > fixed in code which mis-used string constants shows that if the compiler
> > implements read-only and/or shared storage for string constants (as GCC
> > does by default) then the only way to catch these bugs at compile time
> > is to use "const char *" as the default implied type for string
> > constants (except, it seems, when they are used as array initializers).
> Just be glad you aren't using the old IBM (IIRC) system which had the
> constants 0, 1, 2 at 'well known' addresses. This system ran FORTRAN
> and all arguments are passed by reference. If a routine accidentally
> changed a (supposedly) constant 1 that was passed to it, then the
> value of 1 changed for the entire OS.
Still works with NetBSD f77.
okok - you have to pass -N to the linker for this to work.
Demo code available upon request.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)
-----END PGP SIGNATURE-----