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 <is@netbsd.org>
List: tech-toolchain
Date: 07/17/2003 22:48:50
--IS0zKkzwUGydFO0o
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

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).
>=20
> 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.
	-is

--IS0zKkzwUGydFO0o
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (NetBSD)

iD8DBQE/FwuyPCRcZ/VMtk4RAsclAJ0Z3o+XiWr9v31jFAaf9AGWR29lRwCdGFmd
cwIJ5NjzF5XqcmwIcmso+D8=
=wK9o
-----END PGP SIGNATURE-----

--IS0zKkzwUGydFO0o--