]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 10:08:49 +0000 (10:08 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 10:08:49 +0000 (10:08 +0000)
2012-03-13  Jakub Jelinek  <jakub@redhat.com>

PR c/52577
* c-parser.c (c_parser_postfix_expression)
<case RID_BUILTIN_SHUFFLE>: Call mark_exp_read on argument values.

* gcc.dg/Wunused-var-3.c: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@185682 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/c-parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/Wunused-var-3.c [new file with mode: 0644]

index 36db8f889e33ee75b307be36b7cd57c5a15eab47..1295053165cfa5b35519c9237c54611ea0f897bb 100644 (file)
@@ -1,7 +1,11 @@
 2012-03-22  Jakub Jelinek  <jakub@redhat.com>
 
-       Backported from trunk
+       Backported from mainline
        2012-03-13  Jakub Jelinek  <jakub@redhat.com>
+       PR c/52577
+       * c-parser.c (c_parser_postfix_expression)
+       <case RID_BUILTIN_SHUFFLE>: Call mark_exp_read on argument values.
 
        * config/i386/smmintrin.h: Avoid /* within a comment.
        * config/i386/nmmintrin.h: Likewise.
index 867ab4183ad3bac5ee223ffff46f4a94b8f4ca18..56134c24e50a27d3ad47ade5c919d24b0fe25d3e 100644 (file)
@@ -1,7 +1,7 @@
 /* Parser for C and Objective-C.
    Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011
-   Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008, 2009, 2010, 2011,
+   2012 Free Software Foundation, Inc.
 
    Parser actions based on the old Bison parser; structure somewhat
    influenced by and fragments based on the C++ parser.
@@ -6647,6 +6647,8 @@ c_parser_postfix_expression (c_parser *parser)
        case RID_BUILTIN_SHUFFLE:
          {
            VEC(c_expr_t,gc) *cexpr_list;
+           unsigned int i;
+           c_expr_t *p;
 
            c_parser_consume_token (parser);
            if (!c_parser_get_builtin_args (parser,
@@ -6657,6 +6659,9 @@ c_parser_postfix_expression (c_parser *parser)
                break;
              }
 
+           FOR_EACH_VEC_ELT (c_expr_t, cexpr_list, i, p)
+             mark_exp_read (p->value);
+
            if (VEC_length (c_expr_t, cexpr_list) == 2)
              expr.value =
                c_build_vec_perm_expr
index 21a6cae0e82c590b18676eccd7e77ca0b6e12121..96226fa35d95321ec5f21c4281e71336de782146 100644 (file)
@@ -1,3 +1,11 @@
+2012-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-03-13  Jakub Jelinek  <jakub@redhat.com>
+       PR c/52577
+       * gcc.dg/Wunused-var-3.c: New test.
+
 2012-03-22  Release Manager
 
        * GCC 4.7.0 released.
diff --git a/gcc/testsuite/gcc.dg/Wunused-var-3.c b/gcc/testsuite/gcc.dg/Wunused-var-3.c
new file mode 100644 (file)
index 0000000..5954c3b
--- /dev/null
@@ -0,0 +1,34 @@
+/* PR c/52577 */
+/* { dg-do compile } */
+/* { dg-options "-Wunused" } */
+
+typedef int V __attribute__((vector_size (sizeof (int) * 4)));
+
+void
+f1 (V *p)
+{
+  V mask = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (*p, mask);
+}
+
+void
+f2 (V *p, V *q)
+{
+  V mask = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (*p, *q, mask);
+}
+
+void
+f3 (V *p, V *mask)
+{
+  V a = { 1, 2, 3, 0 };
+  *p = __builtin_shuffle (a, *mask);
+}
+
+void
+f4 (V *p, V *mask)
+{
+  V a = { 1, 2, 3, 0 };
+  V b = { 2, 3, 4, 1 };
+  *p = __builtin_shuffle (a, b, *mask);
+}