------- Comment #3 from dave at hiauly1 dot hia dot nrc dot ca 2008-02-27 17:49 ------- Subject: Re: Cannot bootstrap Ada with host gnatmake-4.2
> ------- Comment #2 from charles dot w dot lambert at gmail dot com > 2008-02-27 16:32 ------- > I can confirm this bug against gcc 4.2.3 and gcc 4.3.0 on os x (10.5.2). > Apparently apple has changed the way that putenv is handled. From the `man 3 > getenv` page i quote: > "COMPATIBILITY > putenv() no longer copies its input buffer. This often appears in crash > logs as a > crash in getenv(). Avoid passing local buffers or freeing the memory > that > is passed > to putenv(). Use setenv(), which still makes an internal copy of its > buffers." > > I have examined the source code and found the error to be in the file > <base_path>/gcc/ada/env.c near line 179 in __gnat_setenv() with the following > code: > 179: putenv (expression); > 180: #if (defined (__FreeBSD__) && (__FreeBSD__ < 7)) \ > 181: || defined (__APPLE__) || defined (__MINGW32__) \ > 182: ||(defined (__vxworks) && ! defined (__RTP__)) > 183: /* On some systems like FreeBSD 6.x and earlier, MacOS X and Windows, > 184: putenv is making a copy of the expression string so we can free > 185: it after the call to putenv */ > 186: free (expression); > 187:#endif It looks like setenv should be used, as in previous hunk for vxworks: #elif defined (__vxworks) && defined (__RTP__) setenv (name, value, 1); Dave -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33857