This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
RE: tmpnam() core dumping
- To: "'law at cygnus dot com'" <law at cygnus dot com>
- Subject: RE: tmpnam() core dumping
- From: Bill Ahlbrandt <bahlbr at icdata dot com>
- Date: Fri, 12 Dec 1997 10:07:58 -0600
- Cc: "'egcs at cygnus dot com'" <egcs at cygnus dot com>
- Reply-To: egcs at cygnus dot com
Yes, using -fwritable-strings fixes the problem.
I wonder why these functions want to modify the string that is passed to them :-)?
Thanks much...
-----Original Message-----
From: Jeffrey A Law [SMTP:law@hurl.cygnus.com]
Sent: Friday, December 12, 1997 10:05 AM
To: Bill Ahlbrandt
Cc: egcs@cygnus.com
Subject: Re: tmpnam() core dumping
In message <01BD06D5.E1EF50C0@bill.icdata.com>you write:
> This probably has nothing to do with egcs, but being extremely new this env
> ironment and compiler, any assistance will be much appreciated.
>
> Note that the tempnam function works just fine.
Does -fwritable-strings fix the problem.
>From the GCC manual:
@itemize @bullet
@cindex string constants
@cindex read-only strings
@cindex shared strings
@item
GNU CC normally makes string constants read-only. If several
identical-looking string constants are used, GNU CC stores only one
copy of the string.
@cindex @code{mktemp}, and constant strings
One consequence is that you cannot call @code{mktemp} with a string
constant argument. The function @code{mktemp} always alters the
string its argument points to.
This may also apply to tempnam.
jeff