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]

RE: [patch] Fix a segfault in h8300 port.


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


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