mirror of git://gcc.gnu.org/git/gcc.git
Fix issue with string options and nested gcc_jit_contexts
gcc/jit/ChangeLog: * jit-recording.c (gcc::jit::recording::context::context): When copying string options from a parent context, take a copy of the underlying buffers, rather than simply copying the pointer. From-SVN: r218972
This commit is contained in:
parent
3eb239f48b
commit
5afd44e33b
|
|
@ -1,3 +1,9 @@
|
||||||
|
2014-12-19 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
|
* jit-recording.c (gcc::jit::recording::context::context): When
|
||||||
|
copying string options from a parent context, take a copy of the
|
||||||
|
underlying buffers, rather than simply copying the pointer.
|
||||||
|
|
||||||
2014-12-19 David Malcolm <dmalcolm@redhat.com>
|
2014-12-19 David Malcolm <dmalcolm@redhat.com>
|
||||||
|
|
||||||
* jit-recording.c (gcc::jit::recording::context::set_str_option):
|
* jit-recording.c (gcc::jit::recording::context::set_str_option):
|
||||||
|
|
|
||||||
|
|
@ -181,11 +181,14 @@ recording::context::context (context *parent_ctxt)
|
||||||
{
|
{
|
||||||
if (parent_ctxt)
|
if (parent_ctxt)
|
||||||
{
|
{
|
||||||
/* Inherit options from parent.
|
/* Inherit options from parent. */
|
||||||
Note that the first memcpy means copying pointers to strings. */
|
for (unsigned i = 0;
|
||||||
memcpy (m_str_options,
|
i < sizeof (m_str_options) / sizeof (m_str_options[0]);
|
||||||
parent_ctxt->m_str_options,
|
i++)
|
||||||
sizeof (m_str_options));
|
{
|
||||||
|
const char *parent_opt = parent_ctxt->m_str_options[i];
|
||||||
|
m_str_options[i] = parent_opt ? xstrdup (parent_opt) : NULL;
|
||||||
|
}
|
||||||
memcpy (m_int_options,
|
memcpy (m_int_options,
|
||||||
parent_ctxt->m_int_options,
|
parent_ctxt->m_int_options,
|
||||||
sizeof (m_int_options));
|
sizeof (m_int_options));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue