re PR c/35748 (ICE with cast to invalid union)
PR c/35748 * c-typeck.c (build_c_cast): Skip invalid fields in unions. * gcc.dg/union-cast-4.c: New test. From-SVN: r133737
This commit is contained in:
parent
23594c97b3
commit
39ffbac911
4 changed files with 21 additions and 2 deletions
|
@ -1,3 +1,8 @@
|
|||
2008-03-30 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
PR c/35748
|
||||
* c-typeck.c (build_c_cast): Skip invalid fields in unions.
|
||||
|
||||
2008-03-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR target/35757
|
||||
|
|
|
@ -3628,8 +3628,9 @@ build_c_cast (tree type, tree expr)
|
|||
tree field;
|
||||
|
||||
for (field = TYPE_FIELDS (type); field; field = TREE_CHAIN (field))
|
||||
if (comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)),
|
||||
TYPE_MAIN_VARIANT (TREE_TYPE (value))))
|
||||
if (TREE_TYPE (field) != error_mark_node
|
||||
&& comptypes (TYPE_MAIN_VARIANT (TREE_TYPE (field)),
|
||||
TYPE_MAIN_VARIANT (TREE_TYPE (value))))
|
||||
break;
|
||||
|
||||
if (field)
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
2008-03-30 Volker Reichelt <v.reichelt@netcologne.de>
|
||||
|
||||
PR c/35748
|
||||
* gcc.dg/union-cast-4.c: New test.
|
||||
|
||||
2008-03-30 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR target/35757
|
||||
|
|
8
gcc/testsuite/gcc.dg/union-cast-4.c
Normal file
8
gcc/testsuite/gcc.dg/union-cast-4.c
Normal file
|
@ -0,0 +1,8 @@
|
|||
/* PR c/35748 */
|
||||
|
||||
union U { void x[1]; }; /* { dg-error "array of voids" } */
|
||||
|
||||
void foo()
|
||||
{
|
||||
(union U)0; /* { dg-error "type not present" } */
|
||||
}
|
Loading…
Add table
Reference in a new issue