OSDN Git Service

PR tree-optimizations/52891
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Apr 2012 10:16:57 +0000 (10:16 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 23 Apr 2012 10:16:57 +0000 (10:16 +0000)
* tree-vect-patterns.c (adjust_bool_pattern): Use
build_nonstandard_type even if rhs1 has unsigned INTEGER_TYPE,
but with non-standard precision.

* gcc.c-torture/compile/pr52891-1.c: New test.
* gcc.c-torture/compile/pr52891-2.c: New test.

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

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr52891-1.c [new file with mode: 0644]
gcc/testsuite/gcc.c-torture/compile/pr52891-2.c [new file with mode: 0644]
gcc/tree-vect-patterns.c

index 2c820ac..c43ff91 100644 (file)
@@ -1,3 +1,10 @@
+2012-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimizations/52891
+       * tree-vect-patterns.c (adjust_bool_pattern): Use
+       build_nonstandard_type even if rhs1 has unsigned INTEGER_TYPE,
+       but with non-standard precision.
+
 2012-04-22  Ian Lance Taylor  <iant@google.com>
 
        * godump.c (go_output_typedef): Dump size of structs.
index 36cd73b..b8ad25e 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR tree-optimizations/52891
+       * gcc.c-torture/compile/pr52891-1.c: New test.  
+       * gcc.c-torture/compile/pr52891-2.c: New test.
+
 2012-04-20  Ian Lance Taylor  <iant@google.com>
 
        * go.test/go-test.exp (go-set-goarch): Recognize powerpc*-*-*.
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52891-1.c b/gcc/testsuite/gcc.c-torture/compile/pr52891-1.c
new file mode 100644 (file)
index 0000000..e695d1c
--- /dev/null
@@ -0,0 +1,20 @@
+/* PR tree-optimizations/52891 */
+
+struct S
+{
+  int a;
+  struct T { unsigned c : 10; } b;
+} s;
+
+void
+bar (short x, short y, int **p)
+{
+  if ((x && y) + **p)
+    while (1);
+}
+
+void
+foo (int **p)
+{
+  bar (s.a, s.b.c, p);
+}
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr52891-2.c b/gcc/testsuite/gcc.c-torture/compile/pr52891-2.c
new file mode 100644 (file)
index 0000000..d9fcbd6
--- /dev/null
@@ -0,0 +1,12 @@
+/* PR tree-optimizations/52891 */
+
+struct __attribute__((packed)) S { unsigned s : 22; };
+struct __attribute__((packed)) T { struct S t; } c;
+int a, b, d;
+
+void
+foo (void)
+{
+  if (1 ? (!c.t.s & (d < 0)) < a : 0)
+    b = 0;
+}
index d955021..a676a24 100644 (file)
@@ -2178,7 +2178,9 @@ adjust_bool_pattern (tree var, tree out_type, tree trueval,
     default:
       gcc_assert (TREE_CODE_CLASS (rhs_code) == tcc_comparison);
       if (TREE_CODE (TREE_TYPE (rhs1)) != INTEGER_TYPE
-         || !TYPE_UNSIGNED (TREE_TYPE (rhs1)))
+         || !TYPE_UNSIGNED (TREE_TYPE (rhs1))
+         || (TYPE_PRECISION (TREE_TYPE (rhs1))
+             != GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (rhs1)))))
        {
          enum machine_mode mode = TYPE_MODE (TREE_TYPE (rhs1));
          itype