This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [patch] Fix a segfault in h8300 port.
- To: "'law at redhat dot com'" <law at redhat dot com>
- Subject: RE: [patch] Fix a segfault in h8300 port.
- From: Kazu Hirata <kazu at hxi dot com>
- Date: Wed, 31 Oct 2001 21:40:56 -0500
- Cc: gcc-patches at gcc dot gnu dot org
Hi Jeff,
> ie, you said you were fixing a segfault, but you really didn't
> identify how you were getting the segfault. That's really the key
> issue at hand in my mind. Why did you get the segfault?
Eventually, the NULL pointer is used as a source address of memcpy.
If you chase ggc_alloc_string, it calls obstack_grow0. Via
_obstack_memcpy, memcpy is finally called.
> ie, this is a memory consumption optimization. I would like to hope
> that the code deals with being passed an empty string or null pointer.
> But then again, maybe it doesn't.
ggc_alloc_string does not handle NULL pointer unless the length is 0.
Kazu Hirata