From 0ffa4bc2c5bcda57245cba94579ee3e1152830e2 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Tue, 27 Nov 2018 17:30:27 +0100 Subject: [PATCH] gcov: do not ICE on NULL string in JSON export. 2018-11-27 Martin Liska * gcov.c (generate_results): Append current_working_directory only when exists. From-SVN: r266521 --- gcc/ChangeLog | 5 +++++ gcc/gcov.c | 4 +++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ca260ec47c..c2eea0dcb0a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2018-11-27 Martin Liska + + * gcov.c (generate_results): Append current_working_directory + only when exists. + 2018-11-27 Mike Gulick PR preprocessor/83173 diff --git a/gcc/gcov.c b/gcc/gcov.c index 361b696ea78..7e39f9bd57e 100644 --- a/gcc/gcov.c +++ b/gcc/gcov.c @@ -1377,7 +1377,9 @@ generate_results (const char *file_name) json::object *root = new json::object (); root->set ("format_version", new json::string ("1")); root->set ("gcc_version", new json::string (version_string)); - root->set ("current_working_directory", new json::string (bbg_cwd)); + + if (bbg_cwd != NULL) + root->set ("current_working_directory", new json::string (bbg_cwd)); json::array *json_files = new json::array (); root->set ("files", json_files); -- 2.30.2