fold-const.c (fold_binary): Add missing conversions.
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 30 Mar 2008 15:54:05 +0000 (15:54 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 30 Mar 2008 15:54:05 +0000 (15:54 +0000)
* fold-const.c (fold_binary) <BIT_IOR_EXPR>: Add missing conversions.

From-SVN: r133732

gcc/ChangeLog
gcc/fold-const.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/bit_packed_array2.adb [new file with mode: 0644]

index a008d0dcfed9b8709e88bab3f5179737620fd737..4d954bf12a5385a493bb14946d928af206a6731b 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-30  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * fold-const.c (fold_binary) <BIT_IOR_EXPR>: Add missing conversions.
+
 2008-03-30  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/31023
index c420b79b75c513c3e77a85cd845e0770454ddccb..6e5d9403e706ccee69af56e63bdd1c6761b28c3e 100644 (file)
@@ -10425,8 +10425,10 @@ fold_binary (enum tree_code code, tree type, tree op0, tree op1)
        {
          return fold_build1 (BIT_NOT_EXPR, type,
                              build2 (BIT_AND_EXPR, type,
-                                     TREE_OPERAND (arg0, 0),
-                                     TREE_OPERAND (arg1, 0)));
+                                     fold_convert (type,
+                                                   TREE_OPERAND (arg0, 0)),
+                                     fold_convert (type,
+                                                   TREE_OPERAND (arg1, 0))));
        }
 
       /* See if this can be simplified into a rotate first.  If that
index 5b61aee553625563c2ee5b1218ada7dc21e02e03..3124811858d5844d7ea597700f2764040fca1aa0 100644 (file)
@@ -1,3 +1,7 @@
+2008-03-30  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/bit_packed_array2.adb: New test.
+
 2008-03-30  Paul Thomas  <pault@gcc.gnu.org>
 
        PR fortran/35740
diff --git a/gcc/testsuite/gnat.dg/bit_packed_array2.adb b/gcc/testsuite/gnat.dg/bit_packed_array2.adb
new file mode 100644 (file)
index 0000000..b403122
--- /dev/null
@@ -0,0 +1,19 @@
+-- { dg-do compile }
+-- { dg-options "-gnatws" }
+
+procedure Bit_Packed_Array2 is
+
+  type Bit_Array is array (integer range <>) of Boolean;
+  pragma Pack(Bit_Array);
+
+  b1  : Bit_Array(1..64);
+  b2  : Bit_array(1..64);
+  res : Bit_array(1..64);
+
+begin
+
+  if (not((not b1) or (not b2))) /= res then 
+    null;
+  end if;
+
+end;