summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>2006-05-30 13:33:17 +0000
committerVolker Reichelt <reichelt@gcc.gnu.org>2006-05-30 13:33:17 +0000
commit16464cc1bba0fd0befabcb90bad7d28b3e229c93 (patch)
treee7c9695a52b0a71525c8ba2bc639cee7578958bc /gcc
parentd91d2db759502aceabdc93e0fb0f5c02370953aa (diff)
downloadgcc-16464cc1bba0fd0befabcb90bad7d28b3e229c93.tar.gz
re PR c/27718 (ICE with sizeof of incomplete type)
PR c/27718 * c-typeck.c (c_expr_sizeof_type): Handle invalid types. * gcc.dg/sizeof-1.c: New test. From-SVN: r114234
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/c-typeck.c3
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/gcc.dg/sizeof-1.c4
4 files changed, 16 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 482f4a5d543..c5470be129a 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c/27718
+ * c-typeck.c (c_expr_sizeof_type): Handle invalid types.
+
2006-05-30 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/27779
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index 7a8cdc40e23..2c5736cf769 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2153,7 +2153,8 @@ c_expr_sizeof_type (struct c_type_name *t)
type = groktypename (t);
ret.value = c_sizeof (type);
ret.original_code = ERROR_MARK;
- pop_maybe_used (C_TYPE_VARIABLE_SIZE (type));
+ pop_maybe_used (type != error_mark_node
+ ? C_TYPE_VARIABLE_SIZE (type) : false);
return ret;
}
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index eedd466c2ca..dc0ec7cf698 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-05-30 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c/27718
+ * gcc.dg/sizeof-1.c: New test.
+
2006-05-30 Uros Bizjak <uros@kss-loka.si>
PR target/27790
diff --git a/gcc/testsuite/gcc.dg/sizeof-1.c b/gcc/testsuite/gcc.dg/sizeof-1.c
new file mode 100644
index 00000000000..9541a4c273a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/sizeof-1.c
@@ -0,0 +1,4 @@
+/* PR c/27718 */
+/* { dg-do compile } */
+
+int i = sizeof(struct A[]); /* { dg-error "incomplete" } */