]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR target/84772 (powerpc-spe: Spurious "is used uninitialized" warning...
authorJakub Jelinek <jakub@redhat.com>
Mon, 25 Jun 2018 17:31:23 +0000 (19:31 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 25 Jun 2018 17:31:23 +0000 (19:31 +0200)
Backported from mainline
2018-03-09  Jakub Jelinek  <jakub@redhat.com>

PR target/84772
* config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Mark va_arg_tmp
temporary TREE_ADDRESSABLE before gimplification of BUILT_IN_MEMCPY.

* gcc.dg/pr84772.c: New test.

From-SVN: r262074

gcc/ChangeLog
gcc/config/rs6000/rs6000.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/pr84772.c [new file with mode: 0644]

index 2873eb9a01cccece23cff696f87b5691909859b5..6923e64fbde2e7da73c972bef03bf54989e16830 100644 (file)
@@ -3,6 +3,10 @@
        Backported from mainline
        2018-03-09  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/84772
+       * config/rs6000/rs6000.c (rs6000_gimplify_va_arg): Mark va_arg_tmp
+       temporary TREE_ADDRESSABLE before gimplification of BUILT_IN_MEMCPY.
+
        PR c++/84767
        * tree-inline.c (copy_tree_body_r): For INDIRECT_REF of a remapped
        decl, use remap_type if we want to use the type.
index ec2b32b99518874d3cc307aefeeb31fb01432a4c..04696580fa600a454324410aecd09798337e329a 100644 (file)
@@ -12897,6 +12897,7 @@ rs6000_gimplify_va_arg (tree valist, tree type, gimple_seq *pre_p,
 
       tree copy = build_call_expr (builtin_decl_implicit (BUILT_IN_MEMCPY),
                                   3, dest_addr, addr, size_int (rsize * 4));
+      TREE_ADDRESSABLE (tmp) = 1;
 
       gimplify_and_add (copy, pre_p);
       addr = dest_addr;
index 033d1458dfcb802843bb35cb37105a274e608e87..69ab82d64ca4a67b1363065d9848cece63d8a034 100644 (file)
@@ -1,6 +1,11 @@
 2018-06-25  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2018-03-09  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84772
+       * gcc.dg/pr84772.c: New test.
+
        2018-03-09  Jason Merrill  <jason@redhat.com>
                    Jakub Jelinek  <jakub@redhat.com>
 
diff --git a/gcc/testsuite/gcc.dg/pr84772.c b/gcc/testsuite/gcc.dg/pr84772.c
new file mode 100644 (file)
index 0000000..1241d21
--- /dev/null
@@ -0,0 +1,13 @@
+/* PR target/84772 */
+/* { dg-do compile } */
+/* { dg-options "-O -Wuninitialized" } */
+
+#include <stdarg.h>
+
+void
+foo (int *x, int y, va_list ap)
+{
+  __builtin_memset (x, 0, sizeof (int));
+  for (int i = 0; i < y; i++)
+    va_arg (ap, long double);                  /* { dg-bogus "uninitialized" } */  
+}