shithub: scc

Download patch

ref: 248d4be51443e4c1a6137f285bdde1a027120bb6
parent: 0e120abe46b29d6c3f3d00d6fda467a3f8949d37
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Aug 27 12:07:25 EDT 2015

Disallow sizeof of incomplete type

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -961,6 +961,8 @@
 	case SIZEOF:
 		next();
 		tp = (yytoken == '(') ? sizeexp() : typeof(unary());
+		if (!tp->defined)
+			errorp("sizeof applied to an incomplete type");
 		return sizeofnode(tp);
 	case INC:
 	case DEC: