From: Marek Polacek Date: Wed, 22 Feb 2017 21:28:42 +0000 (+0000) Subject: re PR c/79662 (ICE on invalid code in convert_arguments in c/c-typeck.c:3452) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=61ac5ebe618c2cbdc591854eff96c6aa64514382;p=gcc.git 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 --- diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 5cff63a24d1..8283c827d87 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,8 @@ +2017-02-22 Marek Polacek + + PR c/79662 + * c-typeck.c (convert_arguments): Handle error_mark_node. + 2017-02-19 Prathamesh Kulkarni * 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 ed8ffe4c2e7..8c2c561eb72 100644 --- a/gcc/c/c-typeck.c +++ b/gcc/c/c-typeck.c @@ -3437,15 +3437,18 @@ convert_arguments (location_t loc, vec 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 31e7b4fb79e..6fae11a52e5 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 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 00000000000..03fb9f49233 --- /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" } */ +}