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: Trivial C++ PATCH to cp_fname_init


On 10/30/2009 06:16 PM, Richard Guenther wrote:
On Fri, Oct 30, 2009 at 7:45 PM, Jason Merrill<jason@redhat.com> wrote:
On 10/28/2009 03:02 PM, Jason Merrill wrote:

I noticed that the call to build_string was unnecessarily adding 1 to the length argument for build_string.

Reverted, the 1 wasn't so unnecessary after all.

I think it was unnecessary. build_string allocates space for the terminating '\0' already, so build_string (strlen (str), str) is the correct way of building a STRING_CST.

That's what I thought. But then the problem with Jerry Quinn's type_info name change led me to notice that removing the +1 changes .string to .ascii in the assembly output, losing the terminal null, because output_constant only emits TREE_STRING_LENGTH characters, not TREE_STRING_LENGTH+1.


Jason


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