diff options
author | Richard Guenther <rguenther@suse.de> | 2012-06-28 11:45:14 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2012-06-28 11:45:14 +0000 |
commit | 4519d7458855f282a510a6da8f7c9e7e3d925b22 (patch) | |
tree | 0feb4042fea4a18558cbd0b1ca50e4ec4759e3c6 /gcc | |
parent | 7db2226d074092cb701cdbc8e82ff49530a751cd (diff) | |
download | gcc-4519d7458855f282a510a6da8f7c9e7e3d925b22.zip gcc-4519d7458855f282a510a6da8f7c9e7e3d925b22.tar.gz gcc-4519d7458855f282a510a6da8f7c9e7e3d925b22.tar.bz2 |
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: r189045
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/expr.c | 1 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/torture/pr53790.c | 17 |
4 files changed, 29 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8b9f9cb..76e8913 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -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-28 Andreas Schwab <schwab@linux-m68k.org> * doc/include/gpl.texi: Remove. @@ -9832,6 +9832,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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index f7ca830..406bd1f 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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-28 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/53645 diff --git a/gcc/testsuite/gcc.dg/torture/pr53790.c b/gcc/testsuite/gcc.dg/torture/pr53790.c new file mode 100644 index 0000000..0abd3dd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr53790.c @@ -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); +} |