Simplify commit 97a43fc4dbc5cfb1174a13313dda7637c838d110
"OpenMP: Handle 'device_type(nohost)' on 'target'".

        gcc/
        * gimplify.cc (gimplify_omp_workshare)
        [OMP_TARGET && OMP_CLAUSE_DEVICE_TYPE_NOHOST]: Use
        'build_string_literal'.  Use 'build_int_cst'.
        libgomp/
        * testsuite/libgomp.c/target-device-type-1.c: Adjust.
        * testsuite/libgomp.c/target-device-type-2.c: Likewise.
---
 gcc/gimplify.cc                                    | 11 ++---------
 libgomp/testsuite/libgomp.c/target-device-type-1.c |  2 +-
 libgomp/testsuite/libgomp.c/target-device-type-2.c |  2 +-
 3 files changed, 4 insertions(+), 11 deletions(-)

diff --git a/gcc/gimplify.cc b/gcc/gimplify.cc
index ee88a3cd662..174995e2e87 100644
--- a/gcc/gimplify.cc
+++ b/gcc/gimplify.cc
@@ -19025,15 +19025,8 @@ gimplify_omp_workshare (tree *expr_p, gimple_seq 
*pre_p)
            tree err = builtin_decl_explicit (BUILT_IN_GOMP_ERROR);
            const char *str = "Executing device-type 'nohost' target region "
                              "on the host";
-           const int len = strlen (str) + 1;
-           tree msg = build_string (len, str);
-           TREE_TYPE (msg) = build_array_type_nelts (char_type_node, len);
-           TREE_READONLY (msg) = 1;
-           TREE_STATIC (msg) = 1;
-           msg = build_fold_addr_expr (msg);
-           tree msglen = fold_build2 (MINUS_EXPR, size_type_node,
-                                      build_all_ones_cst (size_type_node),
-                                      size_one_node);
+           tree msg = build_string_literal (strlen (str) + 1, str);
+           tree msglen = build_int_cst (size_type_node, -2);
            err = build_call_expr_loc (loc, err, 2, msg, msglen);
            tree l1 = create_artificial_label (UNKNOWN_LOCATION);
            tree l2 = create_artificial_label (UNKNOWN_LOCATION);
diff --git a/libgomp/testsuite/libgomp.c/target-device-type-1.c 
b/libgomp/testsuite/libgomp.c/target-device-type-1.c
index d8d964e7fe5..0a7f169193b 100644
--- a/libgomp/testsuite/libgomp.c/target-device-type-1.c
+++ b/libgomp/testsuite/libgomp.c/target-device-type-1.c
@@ -18,4 +18,4 @@ main ()
 }
 
 /* { dg-final { scan-tree-dump "= __builtin_omp_is_initial_device \\(\\);" 
"gimple" } } */
-/* { dg-final { scan-tree-dump "__builtin_GOMP_error \\(\"Executing 
device-type ..nohost.. target region on the host\"," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_error \\(&\"Executing 
device-type ..nohost.. target region on the host\"\\\[0\\\]," "gimple" } } */
diff --git a/libgomp/testsuite/libgomp.c/target-device-type-2.c 
b/libgomp/testsuite/libgomp.c/target-device-type-2.c
index 54550422032..df6f39235cc 100644
--- a/libgomp/testsuite/libgomp.c/target-device-type-2.c
+++ b/libgomp/testsuite/libgomp.c/target-device-type-2.c
@@ -21,7 +21,7 @@ main ()
 }
 
 /* { dg-final { scan-tree-dump "= __builtin_omp_is_initial_device \\(\\);" 
"gimple" } } */
-/* { dg-final { scan-tree-dump "__builtin_GOMP_error \\(\"Executing 
device-type ..nohost.. target region on the host\"," "gimple" } } */
+/* { dg-final { scan-tree-dump "__builtin_GOMP_error \\(&\"Executing 
device-type ..nohost.. target region on the host\"\\\[0\\\]," "gimple" } } */
 
 /* { dg-output "libgomp: fatal error: Executing device-type 'nohost' target 
region on the host" } */
 /* { dg-shouldfail "'nohost' target region on the host" } */
-- 
2.34.1

Reply via email to