diff mbox series

[committed,og9,openacc-gcc-9-branch] Fix segfault with plugin-gcn under libgomp

Message ID a331dec2-84d1-0312-0972-c9be049279d0@codesourcery.com
State New
Headers show
Series [committed,og9,openacc-gcc-9-branch] Fix segfault with plugin-gcn under libgomp | expand

Commit Message

Tobias Burnus Sept. 14, 2019, 10:49 a.m. UTC
Hi all,

exactly the same as for plugin-hsa on the trunk: 
https://gcc.gnu.org/ml/gcc-patches/2019-09/msg00718.html

Only a different file (which is only in this branch).

Tobias
commit 392044a8db285d9aea0a280983ce7c5014a4e99c
Author: Tobias Burnus <tobias@codesourcery.com>
Date:   Thu Sep 12 18:07:53 2019 +0200

    libgomp plugin-gcn - init string
    
    libgomp/
    2019-09-13  Tobias Burnus  <tobias@codesourcery.com>
    
            * plugin/plugin-gcn.c (hsa_warn, hsa_fatal, hsa_error): Ensure
            string is initialized.
diff mbox series

Patch

diff --git a/libgomp/ChangeLog.openacc b/libgomp/ChangeLog.openacc
index 355e406d4e3..14ed4e0ec2c 100644
--- a/libgomp/ChangeLog.openacc
+++ b/libgomp/ChangeLog.openacc
@@ -1,3 +1,8 @@ 
+2019-09-13  Tobias Burnus  <tobias@codesourcery.com>
+
+	* plugin/plugin-gcn.c (hsa_warn, hsa_fatal, hsa_error): Ensure
+	string is initialized.
+
 2019-09-10  Julian Brown  <julian@codesourcery.com>
 
 	* plugin/plugin-gcn.c (GOMP_hsa_kernel_dispatch): Remove
diff --git a/libgomp/plugin/plugin-gcn.c b/libgomp/plugin/plugin-gcn.c
index f7e3554f297..b8ec96391f7 100644
--- a/libgomp/plugin/plugin-gcn.c
+++ b/libgomp/plugin/plugin-gcn.c
@@ -489,7 +489,7 @@  hsa_warn (const char *str, hsa_status_t status)
   if (!debug)
     return;
 
-  const char *hsa_error_msg;
+  const char *hsa_error_msg = "[unknown]";
   hsa_fns.hsa_status_string_fn (status, &hsa_error_msg);
 
   fprintf (stderr, "GCN warning: %s\nRuntime message: %s\n", str,
@@ -502,7 +502,7 @@  hsa_warn (const char *str, hsa_status_t status)
 static void
 hsa_fatal (const char *str, hsa_status_t status)
 {
-  const char *hsa_error_msg;
+  const char *hsa_error_msg = "[unknown]";
   hsa_fns.hsa_status_string_fn (status, &hsa_error_msg);
   GOMP_PLUGIN_fatal ("GCN fatal error: %s\nRuntime message: %s\n", str,
 		     hsa_error_msg);
@@ -514,7 +514,7 @@  hsa_fatal (const char *str, hsa_status_t status)
 static bool
 hsa_error (const char *str, hsa_status_t status)
 {
-  const char *hsa_error_msg;
+  const char *hsa_error_msg = "[unknown]";
   hsa_fns.hsa_status_string_fn (status, &hsa_error_msg);
   GOMP_PLUGIN_error ("GCN fatal error: %s\nRuntime message: %s\n", str,
 		     hsa_error_msg);