trouble with fixincl in gcc 3.3 as cross-compiler

James E Wilson wilson@specifixinc.com
Sat Aug 14 01:36:00 GMT 2004


Bob Frazier wrote:
>   p_cur_dir = getcwd ((char *) NULL, MAXPATHLEN + 1);

This is already fixed in gcc-3.4.x.  It defines a local array of size 
MAXPATHLEN.  Your solution leaks memory.

If you really want a fix in gcc-3.3, you could try submitting a bugzilla 
bug report, but you would have to convince someone that the patch needs 
to go in.  The 3.3.x branch is only open for regressions, and it looks 
like this has been broken since 2.95, and hence technically it doesn't 
seem to qualify as a regression.

The linux man page says getcwd with a NULL buffer is undefined, so this 
does appear appear to be a gcc problem, not an OS/library problem.  I 
can't check my POSIX docs, they aren't here in my office.
-- 
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com



More information about the Gcc mailing list