Commit 0a4b0aa1 by Bernd Edlinger Committed by Jeff Law

typeck2.c (digest_init_r): Fix overlength strings.

	* typeck2.c (digest_init_r): Fix overlength strings.
	* vtable-class-hierarchy.c (build_key_buffer_arg): Make string literal
	NUL terminated.

From-SVN: r264286
parent 8b393e9f
2018-09-13 Bernd Edlinger <bernd.edlinger@hotmail.de>
* typeck2.c (digest_init_r): Fix overlength strings.
* vtable-class-hierarchy.c (build_key_buffer_arg): Make string literal
NUL terminated.
2018-09-13 Ville Voutilainen <ville.voutilainen@gmail.com>
PR c++/87093
......
......@@ -1112,8 +1112,13 @@ digest_init_r (tree type, tree init, int nested, int flags,
counted in the length of the constant, but in C++ this would
be invalid. */
if (size < TREE_STRING_LENGTH (init))
{
permerror (loc, "initializer-string for array "
"of chars is too long");
init = build_string (size, TREE_STRING_POINTER (init));
TREE_TYPE (init) = type;
}
}
return init;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment