[libgfortran,patch] Zero-length strings messed up in library (PR33079)

Tobias Schlüter Tobias.Schlueter@physik.uni-muenchen.de
Thu Aug 16 14:02:00 GMT 2007


François-Xavier Coudert wrote:
> -  if (*len > 0)
> +  if (*len == 0)
> +    {
> +      /* A zero-length Fortran string is "".  */
> +      char * tmp = internal_malloc_size (1);
> +      tmp[0] = '\0';
> +      *dest = tmp;
> +    }
> +  else

Do you zero-terminate the string because you don't want to allocate zero 
memory?  I don't know if allocating a pointer to zero memory would work, 
though.

- Tobi



More information about the Fortran mailing list