tree-sra.c (try_instantiate_multiple_fields): Early return if field has POINTER_TYPE.
authorOlivier Hainque <hainque@adacore.com>
Tue, 6 May 2008 12:13:07 +0000 (12:13 +0000)
committerOlivier Hainque <hainque@gcc.gnu.org>
Tue, 6 May 2008 12:13:07 +0000 (12:13 +0000)
        * tree-sra.c (try_instantiate_multiple_fields): Early return
        if field has POINTER_TYPE.

        testsuite/
        * gnat.dg/fatp_sra.adb: New test.

From-SVN: r134982

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/fatp_sra.adb [new file with mode: 0644]
gcc/tree-sra.c

index b8e97904198516df85f3418680fbf483a2c5cff1..1fe2793b4b36f4927397124b895120c33b625557 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-06  Olivier Hainque  <hainque@adacore.com>
+
+       * tree-sra.c (try_instantiate_multiple_fields): Early return
+       if field has POINTER_TYPE.
+
 2008-05-06  Kai Tietz  <kai.tietz@onevision.com>
 
        * config/i386/i386.c (output_set_got): Fix for x86_64 output_emit_asm
index ecae39579e6b978f1661a566408065653fb31416..25e806f37fb1e04c46ca0d9eb35a5bb8d35aa288 100644 (file)
@@ -1,3 +1,7 @@
+2008-05-06  Olivier Hainque  <hainque@adacore.com>
+
+       * gnat.dg/fatp_sra.adb: New test.
+       
 2008-05-05  Andrew Pinski  <andrew_pinski@playstation.sony.com>
 
        PR middle-end/36141
diff --git a/gcc/testsuite/gnat.dg/fatp_sra.adb b/gcc/testsuite/gnat.dg/fatp_sra.adb
new file mode 100644 (file)
index 0000000..a964737
--- /dev/null
@@ -0,0 +1,17 @@
+--  { dg-do compile }
+--  { dg-options "-gnatp -O1" }
+
+procedure Fatp_Sra is
+
+   function X return String is
+   begin
+      return "X";
+   end;
+
+   function Letter return String is
+   begin
+      return X;
+   end;
+begin
+   null;
+end;
index 78a100f38d756fb29af44486f70581e48b0915ef..9e15f928bf3824f743af7229d935b639cb92f39e 100644 (file)
@@ -1472,6 +1472,10 @@ try_instantiate_multiple_fields (struct sra_elt *elt, tree f)
   tree type, var;
   struct sra_elt *block;
 
+  /* Point fields are typically best handled as standalone entities.  */
+  if (POINTER_TYPE_P (TREE_TYPE (f)))
+    return f;
+    
   if (!is_sra_scalar_type (TREE_TYPE (f))
       || !host_integerp (DECL_FIELD_OFFSET (f), 1)
       || !host_integerp (DECL_FIELD_BIT_OFFSET (f), 1)