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: [libgfortran,patch] Zero-length strings messed up in library (PR33079)


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


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