* [PATCH] Don't ICE on invalid array types (PR middle-end/59827)
@ 2014-01-15 15:53 Marek Polacek
2014-01-16 11:27 ` Richard Biener
0 siblings, 1 reply; 2+ messages in thread
From: Marek Polacek @ 2014-01-15 15:53 UTC (permalink / raw)
To: GCC Patches
We ICE on the following (invalid) testcase, because the DECL_ARG_TYPE
is error_mark_node and useless_type_conversion_p doesn't check that
it operates on a type.
Regtested/bootstrapped on x86_64-linux, ok for trunk/4.8/4.7?
2014-01-15 Marek Polacek <polacek@redhat.com>
PR middle-end/59827
* cgraph.c (gimple_check_call_args): Don't use DECL_ARG_TYPE if
it is error_mark_node.
testsuite/
* gcc.dg/pr59827.c: New test.
--- gcc/cgraph.c.mp2 2014-01-15 14:24:53.235255954 +0100
+++ gcc/cgraph.c 2014-01-15 14:52:28.818244290 +0100
@@ -3035,6 +3035,7 @@ gimple_check_call_args (gimple stmt, tre
break;
arg = gimple_call_arg (stmt, i);
if (p == error_mark_node
+ || DECL_ARG_TYPE (p) == error_mark_node
|| arg == error_mark_node
|| (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg))
&& !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
--- gcc/testsuite/gcc.dg/pr59827.c.mp2 2014-01-15 15:06:47.129210564 +0100
+++ gcc/testsuite/gcc.dg/pr59827.c 2014-01-15 15:09:17.295843068 +0100
@@ -0,0 +1,15 @@
+/* PR middle-end/59827 */
+/* { dg-do compile } */
+
+int
+foo (int p[2][]) /* { dg-error "array type has incomplete element type" } */
+{
+ return p[0][0];
+}
+
+void
+bar (void)
+{
+ int p[2][1];
+ foo (p); /* { dg-error "type of formal parameter 1 is incomplete" } */
+}
Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] Don't ICE on invalid array types (PR middle-end/59827)
2014-01-15 15:53 [PATCH] Don't ICE on invalid array types (PR middle-end/59827) Marek Polacek
@ 2014-01-16 11:27 ` Richard Biener
0 siblings, 0 replies; 2+ messages in thread
From: Richard Biener @ 2014-01-16 11:27 UTC (permalink / raw)
To: Marek Polacek; +Cc: GCC Patches
On Wed, Jan 15, 2014 at 4:53 PM, Marek Polacek <polacek@redhat.com> wrote:
> We ICE on the following (invalid) testcase, because the DECL_ARG_TYPE
> is error_mark_node and useless_type_conversion_p doesn't check that
> it operates on a type.
>
> Regtested/bootstrapped on x86_64-linux, ok for trunk/4.8/4.7?
Ok.
Thanks,
Richard.
> 2014-01-15 Marek Polacek <polacek@redhat.com>
>
> PR middle-end/59827
> * cgraph.c (gimple_check_call_args): Don't use DECL_ARG_TYPE if
> it is error_mark_node.
> testsuite/
> * gcc.dg/pr59827.c: New test.
>
> --- gcc/cgraph.c.mp2 2014-01-15 14:24:53.235255954 +0100
> +++ gcc/cgraph.c 2014-01-15 14:52:28.818244290 +0100
> @@ -3035,6 +3035,7 @@ gimple_check_call_args (gimple stmt, tre
> break;
> arg = gimple_call_arg (stmt, i);
> if (p == error_mark_node
> + || DECL_ARG_TYPE (p) == error_mark_node
> || arg == error_mark_node
> || (!types_compatible_p (DECL_ARG_TYPE (p), TREE_TYPE (arg))
> && !fold_convertible_p (DECL_ARG_TYPE (p), arg)))
> --- gcc/testsuite/gcc.dg/pr59827.c.mp2 2014-01-15 15:06:47.129210564 +0100
> +++ gcc/testsuite/gcc.dg/pr59827.c 2014-01-15 15:09:17.295843068 +0100
> @@ -0,0 +1,15 @@
> +/* PR middle-end/59827 */
> +/* { dg-do compile } */
> +
> +int
> +foo (int p[2][]) /* { dg-error "array type has incomplete element type" } */
> +{
> + return p[0][0];
> +}
> +
> +void
> +bar (void)
> +{
> + int p[2][1];
> + foo (p); /* { dg-error "type of formal parameter 1 is incomplete" } */
> +}
>
> Marek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-16 11:27 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-15 15:53 [PATCH] Don't ICE on invalid array types (PR middle-end/59827) Marek Polacek
2014-01-16 11:27 ` Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).