* gcc-interface/trans.c (addressable_p): Handle bitwise operations.
authorEric Botcazou <ebotcazou@adacore.com>
Sat, 17 Oct 2009 10:39:11 +0000 (10:39 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sat, 17 Oct 2009 10:39:11 +0000 (10:39 +0000)
From-SVN: r152932

gcc/ada/ChangeLog
gcc/ada/gcc-interface/trans.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/unchecked_convert4.adb [new file with mode: 0644]

index 219193f82c5b3dda6f3b4e6e523736459ce72cda..d74fccebda6650a6cdac4db5d4d47c85fa564ece 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-17  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/trans.c (addressable_p): Handle bitwise operations.
+
 2009-10-16  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/ada-tree.h (TYPE_FAT_POINTER_P): Swap with...
index ffcc72aac0fb188d4fc3c42d14a35db15fbcac2a..271581a65e83161736fa6bff7d75edc91d4c97b8 100644 (file)
@@ -6949,6 +6949,10 @@ addressable_p (tree gnu_expr, tree gnu_type)
     case CALL_EXPR:
     case PLUS_EXPR:
     case MINUS_EXPR:
+    case BIT_IOR_EXPR:
+    case BIT_XOR_EXPR:
+    case BIT_AND_EXPR:
+    case BIT_NOT_EXPR:
       /* All rvalues are deemed addressable since taking their address will
         force a temporary to be created by the middle-end.  */
       return true;
index 8970e1c8ebb134c76fad0acb52a6e6f9966a40f1..217c0d718617f5c9a175f9a51de54fe6aa66ff61 100644 (file)
@@ -1,3 +1,7 @@
+2009-10-17  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gnat.dg/unchecked_convert4.adb: New test.
+
 2009-10-15  Jason Merrill  <jason@redhat.com>
 
        PR c++/38798
diff --git a/gcc/testsuite/gnat.dg/unchecked_convert4.adb b/gcc/testsuite/gnat.dg/unchecked_convert4.adb
new file mode 100644 (file)
index 0000000..4f766ae
--- /dev/null
@@ -0,0 +1,23 @@
+-- { dg-do compile }
+
+with Unchecked_Conversion;
+
+procedure Unchecked_Convert4 is
+
+  type Uint32 is mod 2**32;
+
+  type Rec is record
+    I : Uint32;
+  end record;
+  pragma Atomic (Rec);
+
+  function Conv is new Unchecked_Conversion (Uint32, Rec);
+
+  function F return Uint32;
+  pragma Import (Ada, F);
+
+  procedure Proc (R : Rec) is begin null; end;
+
+begin
+  Proc (Conv (F or 1));
+end;