re PR middle-end/53790 (ICE on dereferencing a extern union in asm statement)

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: r189047
This commit is contained in:
Richard Guenther 2012-06-28 11:52:49 +00:00 committed by Richard Biener
parent 7158e42b0d
commit f89585af67
4 changed files with 29 additions and 0 deletions

View File

@ -1,3 +1,9 @@
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-27 Nick Clifton <nickc@redhat.com>
* config/rx/rx.md (comparesi3_extend): Remove = modifier from

View File

@ -9657,6 +9657,7 @@ expand_expr_real_1 (tree exp, rtx target, enum machine_mode tmode,
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

View File

@ -1,3 +1,8 @@
2012-06-28 Richard Guenther <rguenther@suse.de>
PR middle-end/53790
* gcc.dg/torture/pr53790.c: New testcase.
2012-06-27 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/51214

View File

@ -0,0 +1,17 @@
/* { 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);
}