diff options
author | Marek Polacek <polacek@redhat.com> | 2017-02-22 21:28:42 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-02-22 21:28:42 +0000 |
commit | 61ac5ebe618c2cbdc591854eff96c6aa64514382 (patch) | |
tree | 2090246ed4c071179741f42c9e02e0e06912b24d /gcc | |
parent | 54dcd52676940090180aacd4f8538f5c67778cc0 (diff) | |
download | gcc-61ac5ebe618c2cbdc591854eff96c6aa64514382.zip gcc-61ac5ebe618c2cbdc591854eff96c6aa64514382.tar.gz gcc-61ac5ebe618c2cbdc591854eff96c6aa64514382.tar.bz2 |
re PR c/79662 (ICE on invalid code in convert_arguments in c/c-typeck.c:3452)
PR c/79662
* c-typeck.c (convert_arguments): Handle error_mark_node.
* gcc.dg/enum-incomplete-4.c: New test.
From-SVN: r245660
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/c/c-typeck.c | 11 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/enum-incomplete-4.c | 11 |
4 files changed, 26 insertions, 4 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5cff63a..8283c82 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-02-22 Marek Polacek <polacek@redhat.com> + + PR c/79662 + * c-typeck.c (convert_arguments): Handle error_mark_node. + 2017-02-19 Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org> * gimple-parser.c (c_parser_gimple_postfix_expression): Check return diff --git a/gcc/c/c-typeck.c b/gcc/c/c-typeck.c index ed8ffe4..8c2c561 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3437,15 +3437,18 @@ convert_arguments (location_t loc, vec<location_t> arg_loc, tree typelist, /* Detect integer changing in width or signedness. These warnings are only activated with -Wtraditional-conversion, not with -Wtraditional. */ - else if (warn_traditional_conversion && INTEGRAL_TYPE_P (type) + else if (warn_traditional_conversion + && INTEGRAL_TYPE_P (type) && INTEGRAL_TYPE_P (valtype)) { tree would_have_been = default_conversion (val); tree type1 = TREE_TYPE (would_have_been); - if (TREE_CODE (type) == ENUMERAL_TYPE - && (TYPE_MAIN_VARIANT (type) - == TYPE_MAIN_VARIANT (valtype))) + if (val == error_mark_node) + /* VAL could have been of incomplete type. */; + else if (TREE_CODE (type) == ENUMERAL_TYPE + && (TYPE_MAIN_VARIANT (type) + == TYPE_MAIN_VARIANT (valtype))) /* No warning if function asks for enum and the actual arg is that enum type. */ ; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 31e7b4f..6fae11a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -7,6 +7,9 @@ PR c++/79657 * g++.dg/ext/underlying_type12.C: New test. + PR c/79662 + * gcc.dg/enum-incomplete-4.c: New test. + 2017-02-22 Jakub Jelinek <jakub@redhat.com> PR target/70465 diff --git a/gcc/testsuite/gcc.dg/enum-incomplete-4.c b/gcc/testsuite/gcc.dg/enum-incomplete-4.c new file mode 100644 index 0000000..03fb9f4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/enum-incomplete-4.c @@ -0,0 +1,11 @@ +/* PR c/79662 */ +/* { dg-do compile } */ +/* { dg-options "" } */ + +extern enum e ve; + +int +f0 (int i) +{ + f0 (ve); /* { dg-error "incomplete" } */ +} |