OSDN Git Service

* tree-sra.c (try_instantiate_multiple_fields): Early return
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 May 2008 12:13:07 +0000 (12:13 +0000)
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 May 2008 12:13:07 +0000 (12:13 +0000)
        if field has POINTER_TYPE.

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

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@134982 138bc75d-0d04-0410-961f-82ee72b054a4

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

index b8e9790..1fe2793 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 ecae395..25e806f 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 78a100f..9e15f92 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)