This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch, libfortran] Some path handling fixes


On Fri, Apr 29, 2011 at 06:20:17PM +0300, Janne Blomqvist wrote:
> 
> since about a decade or so ago, POSIX specifies that PATH_MAX includes
> the trailing null byte (previously it was undefined). However,
> libgfortran has incorrectly assumed the opposite, and has thus created
> temporary buffers of length PATH_MAX + 1 for holding paths when
> converting from Fortran to C style strings. Secondly, these buffers
> are allocated on the stack, and on Linux PATH_MAX is 4096 (presumably
> other targets use something similar), which is quite a large object to
> put on the stack. This can however be easily avoided in the common
> case by using VLA's or alloca() as most paths are quite short, and we
> know the size of the Fortran string to convert.
> 
> The attached patch fixes the problems discussed above. Regtested on
> x86_64-unknown-linux-gnu, Ok for trunk?
> 

OK.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]