r218617 broke test-error-pr63969-missing-driver.c.

The commit added an xstrdup of new string option values on a
gcc_jit_context, but string option values are allowed to be NULL.

Handle the NULL case.

Committed to trunk as r218969.

gcc/jit/ChangeLog:
        * jit-recording.c (gcc::jit::recording::context::set_str_option):
        Handle NULL.
---
 gcc/jit/jit-recording.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/jit/jit-recording.c b/gcc/jit/jit-recording.c
index 1f80001..400a047 100644
--- a/gcc/jit/jit-recording.c
+++ b/gcc/jit/jit-recording.c
@@ -845,7 +845,7 @@ recording::context::set_str_option (enum gcc_jit_str_option 
opt,
       return;
     }
   free (m_str_options[opt]);
-  m_str_options[opt] = xstrdup (value);
+  m_str_options[opt] = value ? xstrdup (value) : NULL;
 }
 
 /* Set the given integer option for this context, or add an error if
-- 
1.8.5.3

Reply via email to