aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2017-02-22 21:28:42 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2017-02-22 21:28:42 +0000
commit61ac5ebe618c2cbdc591854eff96c6aa64514382 (patch)
tree2090246ed4c071179741f42c9e02e0e06912b24d /gcc/c
parent54dcd52676940090180aacd4f8538f5c67778cc0 (diff)
downloadgcc-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/c')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-typeck.c11
2 files changed, 12 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. */
;