shithub: scc

Download patch

ref: 6aa7b3d7682554b843e0a5d2b1d29c26ef68535f
parent: e6a65a5026180565762dbbe8ec0300ba1ec4d86c
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri May 20 11:29:54 EDT 2016

[cc1] Add abort() calls in type switches

We have seen that this defensive technique is very good in a
program like a compiler, where we have dozen of different
conditions and code paths.

--- a/cc1/types.c
+++ b/cc1/types.c
@@ -284,6 +284,8 @@
 	case UNION:
 		type.prop |= TAGGREG;
 		break;
+	default:
+		abort();
 	}
 
 	t = (op ^ (uintptr_t) tp >> 3) & NR_TYPE_HASH-1;
@@ -342,5 +344,7 @@
 	case INT:
 	case FLOAT:
 		return tp1->letter == tp2->letter;
+	default:
+		abort();
 	}
 }