shithub: scc

Download patch

ref: aedd026dfd916a0f93e13530af0d7dbaef791247
parent: d90d76bddf5a29e8d393f1803cf3db3330e532bb
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Mar 12 06:36:54 EDT 2015

Fix castings

The ')' rigth part of the casting must be consumed before of calling
cast again, because in other case it will be an incorrect expresion.

--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -589,6 +589,7 @@
 		case FTN:
 			error("cast specify a function type");
 		default:
+			expect(')');
 			if ((np1 = eval(cast())) == NULL)
 				unexpected();
 			if ((np2 = convert(np1,  tp, 1)) == NULL)
@@ -597,10 +598,10 @@
 		}
 		break;
 	default:
+		expect(')');
 		np2 = expr();
 		break;
 	}
-	expect(')');
 
 	return np2;
 }