2012-06-28  Richard Guenther  <rguenther@suse.de>
	PR middle-end/53790
	* expr.c (expand_expr_real_1): Verify if the type is complete
	before inspecting its size.
	* gcc.dg/torture/pr53790.c: New testcase.
From-SVN: r189045
+2012-06-28  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/53790
+       * expr.c (expand_expr_real_1): Verify if the type is complete
+       before inspecting its size.
+
 2012-06-28  Andreas Schwab  <schwab@linux-m68k.org>
 
        * doc/include/gpl.texi: Remove.
 
        orig_op0 = op0
          = expand_expr (tem,
                         (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
+                         && COMPLETE_TYPE_P (TREE_TYPE (tem))
                          && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem)))
                              != INTEGER_CST)
                          && modifier != EXPAND_STACK_PARM
 
+2012-06-28  Richard Guenther  <rguenther@suse.de>
+
+       PR middle-end/53790
+       * gcc.dg/torture/pr53790.c: New testcase.
+
 2012-06-28  Jakub Jelinek  <jakub@redhat.com>
 
        PR tree-optimization/53645
 
--- /dev/null
+/* { dg-do compile } */
+
+typedef struct s {
+    int value;
+} s_t;
+
+static inline int 
+read(s_t const *var)
+{
+  return var->value;
+}
+
+int main()
+{
+  extern union u extern_var;
+  return read((s_t *)&extern_var);
+}