diff options
author | Marek Polacek <polacek@redhat.com> | 2017-03-03 22:19:24 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2017-03-03 22:19:24 +0000 |
commit | 7f5a7d78481678019409d47198f82a90f12882c2 (patch) | |
tree | 827531c703f0c2c38c647daaab22b648eed4cee0 /gcc | |
parent | 79c9b7a84f15938037fd209af24bbfa77ae02cbe (diff) | |
download | gcc-7f5a7d78481678019409d47198f82a90f12882c2.zip gcc-7f5a7d78481678019409d47198f82a90f12882c2.tar.gz gcc-7f5a7d78481678019409d47198f82a90f12882c2.tar.bz2 |
re PR c/79758 (ICE: tree check: expected class 'type', have 'exceptional' (error_mark) in store_parm_decls_oldstyle, at c/c-decl.c:8973)
PR c/79758
* c-decl.c (store_parm_decls_oldstyle): Check if the element of
current_function_prototype_arg_types is error_mark_node. Fix
formatting. Use TREE_VALUE instead of TREE_TYPE.
* gcc.dg/noncompile/pr79758.c: New test.
From-SVN: r245886
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/c/c-decl.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/noncompile/pr79758.c | 6 |
4 files changed, 28 insertions, 7 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 92be3e1..8ff0ccc 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2017-03-03 Marek Polacek <polacek@redhat.com> + + PR c/79758 + * c-decl.c (store_parm_decls_oldstyle): Check if the element of + current_function_prototype_arg_types is error_mark_node. Fix + formatting. Use TREE_VALUE instead of TREE_TYPE. + 2017-03-03 Jakub Jelinek <jakub@redhat.com> PR c/79837 diff --git a/gcc/c/c-decl.c b/gcc/c/c-decl.c index 32edacc..f46ca11 100644 --- a/gcc/c/c-decl.c +++ b/gcc/c/c-decl.c @@ -8965,12 +8965,15 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) tree type; for (parm = DECL_ARGUMENTS (fndecl), type = current_function_prototype_arg_types; - parm || (type && TREE_VALUE (type) != error_mark_node - && (TYPE_MAIN_VARIANT (TREE_VALUE (type)) != void_type_node)); + parm || (type != NULL_TREE + && TREE_VALUE (type) != error_mark_node + && TYPE_MAIN_VARIANT (TREE_VALUE (type)) != void_type_node); parm = DECL_CHAIN (parm), type = TREE_CHAIN (type)) { - if (parm == 0 || type == 0 - || TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node) + if (parm == NULL_TREE + || type == NULL_TREE + || (TREE_VALUE (type) != error_mark_node + && TYPE_MAIN_VARIANT (TREE_VALUE (type)) == void_type_node)) { if (current_function_prototype_built_in) warning_at (DECL_SOURCE_LOCATION (fndecl), @@ -8996,7 +8999,7 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) declared for the arg. ISO C says we take the unqualified type for parameters declared with qualified type. */ if (TREE_TYPE (parm) != error_mark_node - && TREE_TYPE (type) != error_mark_node + && TREE_VALUE (type) != error_mark_node && ((TYPE_ATOMIC (DECL_ARG_TYPE (parm)) != TYPE_ATOMIC (TREE_VALUE (type))) || !comptypes (TYPE_MAIN_VARIANT (DECL_ARG_TYPE (parm)), @@ -9016,8 +9019,8 @@ store_parm_decls_oldstyle (tree fndecl, const struct c_arg_info *arg_info) if (targetm.calls.promote_prototypes (TREE_TYPE (current_function_decl)) && INTEGRAL_TYPE_P (TREE_TYPE (parm)) - && TYPE_PRECISION (TREE_TYPE (parm)) - < TYPE_PRECISION (integer_type_node)) + && (TYPE_PRECISION (TREE_TYPE (parm)) + < TYPE_PRECISION (integer_type_node))) DECL_ARG_TYPE (parm) = c_type_promotes_to (TREE_TYPE (parm)); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 522af63..adb9eba 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-03-03 Marek Polacek <polacek@redhat.com> + + PR c/79758 + * gcc.dg/noncompile/pr79758.c: New test. + 2017-03-03 Jakub Jelinek <jakub@redhat.com> PR middle-end/79805 diff --git a/gcc/testsuite/gcc.dg/noncompile/pr79758.c b/gcc/testsuite/gcc.dg/noncompile/pr79758.c new file mode 100644 index 0000000..aeaf7c7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/noncompile/pr79758.c @@ -0,0 +1,6 @@ +/* PR c/79758 */ +/* { dg-do compile } */ + +void fn1 (int[a]) { }; /* { dg-error "undeclared here|parameter name omitted" } */ +void fn1 (b) { }; /* { dg-error "redefinition" } */ +/* { dg-warning "defaults to 'int'" "" { target *-*-* } .-1 } */ |