diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bd51a3c8945ecfa59866727b17287648a6fbfb64..d9eca8eefa10d339f28aeb361e293923f73c39a7 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-05-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gimplify.c (gimplify_decl_expr): For a TYPE_DECL, also gimplify the
+	DECL_ORIGINAL_TYPE if it is present.
+
 2012-05-10  Nick Clifton  <nickc@redhat.com>
 
 	PR target/53120
diff --git a/gcc/gimplify.c b/gcc/gimplify.c
index 811fa221fec36a0c911468b6ea9f33e0d2977489..ca38a0e267599e96885aa048fd44cd75bc6ba119 100644
--- a/gcc/gimplify.c
+++ b/gcc/gimplify.c
@@ -1441,6 +1441,13 @@ gimplify_decl_expr (tree *stmt_p, gimple_seq *seq_p)
       && !TYPE_SIZES_GIMPLIFIED (TREE_TYPE (decl)))
     gimplify_type_sizes (TREE_TYPE (decl), seq_p);
 
+  /* ??? DECL_ORIGINAL_TYPE is streamed for LTO so it needs to be gimplified
+     in case its size expressions contain problematic nodes like CALL_EXPR.  */
+  if (TREE_CODE (decl) == TYPE_DECL
+      && DECL_ORIGINAL_TYPE (decl)
+      && !TYPE_SIZES_GIMPLIFIED (DECL_ORIGINAL_TYPE (decl)))
+    gimplify_type_sizes (DECL_ORIGINAL_TYPE (decl), seq_p);
+
   if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
     {
       tree init = DECL_INITIAL (decl);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 7cdad4a6aaa07d9f50d15e9c6b610cc7ae02dfaf..7162e4e0ec872e511c479b4f48d356c39c5e8381 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2012-05-10  Eric Botcazou  <ebotcazou@adacore.com>
+
+	* gnat.dg/lto11.ad[sb]: New test.
+
 2012-05-09  Uros Bizjak  <ubizjak@gmail.com>
 
 	PR target/52908
diff --git a/gcc/testsuite/gnat.dg/lto11.adb b/gcc/testsuite/gnat.dg/lto11.adb
new file mode 100644
index 0000000000000000000000000000000000000000..ad0b8db30a3034bcd87129a48c888a7ebdf1b113
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto11.adb
@@ -0,0 +1,20 @@
+-- { dg-do compile }
+-- { dg-options "-flto" { target lto } }
+
+with Ada.Streams; use Ada.Streams;
+
+package body Lto11 is
+
+   procedure Write
+     (S : not null access Root_Stream_Type'Class;
+      V : Vector)
+   is
+      subtype M_SEA is Stream_Element_Array (1 .. V'Size / Stream_Element'Size);
+      Bytes : M_SEA;
+      for Bytes'Address use V'Address;
+      pragma Import (Ada, Bytes);
+   begin
+      Ada.Streams.Write (S.all, Bytes);
+   end;
+
+end Lto11;
diff --git a/gcc/testsuite/gnat.dg/lto11.ads b/gcc/testsuite/gnat.dg/lto11.ads
new file mode 100644
index 0000000000000000000000000000000000000000..386d5ac4620a23eb1b9a064e33802e705ea3e4cf
--- /dev/null
+++ b/gcc/testsuite/gnat.dg/lto11.ads
@@ -0,0 +1,9 @@
+with Ada.Streams; use Ada.Streams;
+
+package Lto11 is
+
+   type Vector is array (Positive range <>) of Float;
+
+   procedure Write (S : not null access Root_Stream_Type'Class; V : Vector);
+
+end Lto11;