]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/27718 (ICE with sizeof of incomplete type)
authorVolker Reichelt <reichelt@igpm.rwth-aachen.de>
Tue, 30 May 2006 13:39:19 +0000 (13:39 +0000)
committerVolker Reichelt <reichelt@gcc.gnu.org>
Tue, 30 May 2006 13:39:19 +0000 (13:39 +0000)
PR c/27718
* c-typeck.c (c_expr_sizeof_type): Handle invalid types.

* gcc.dg/sizeof-1.c: New test.

From-SVN: r114237

gcc/ChangeLog
gcc/c-typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/sizeof-1.c [new file with mode: 0644]

index 1aad6d82eda398374a8ef680dc37e9e46437da74..aa946ca0a823544375408f0cc06c25c19214e701 100644 (file)
@@ -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-22  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/27451
index 28a6f70e5a4e36d861560b6fe31e96ca08d19ca3..bed7b9a648e6e139f8816d837ad85a9c01f82dc0 100644 (file)
@@ -1955,7 +1955,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;
 }
 
index 48a2af657d408652cbf05ec0404332741b624cee..8dc0d9740b50883666a39a4044e84edde045b8f8 100644 (file)
@@ -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-29  Volker Reichelt  <reichelt@igpm.rwth-aachen.de>
 
        PR c++/27713
diff --git a/gcc/testsuite/gcc.dg/sizeof-1.c b/gcc/testsuite/gcc.dg/sizeof-1.c
new file mode 100644 (file)
index 0000000..9541a4c
--- /dev/null
@@ -0,0 +1,4 @@
+/* PR c/27718 */
+/* { dg-do compile } */
+
+int i = sizeof(struct A[]);  /* { dg-error "incomplete" } */