shithub: scc

Download patch

ref: 3f821970c3b3572a47db68500f6081db65358298
parent: 3f387257e934ca94273c65cee09b7b61dcae1591
author: Quentin Rameau <[email protected]>
date: Wed Feb 15 06:55:24 EST 2017

[cc1] Fix valid_va_list

Directly comparing objects via pointers is too strict and the check
would fail for typedefs.

--- a/cc1/arch/amd64-sysv/arch.c
+++ b/cc1/arch/amd64-sysv/arch.c
@@ -218,5 +218,5 @@
 int
 valid_va_list(Type *tp)
 {
-	return tp->op == PTR && tp->type == va_type;
+	return tp->op == PTR && eqtype(tp->type, va_type, 1);
 }
--- a/cc1/arch/i386-sysv/arch.c
+++ b/cc1/arch/i386-sysv/arch.c
@@ -219,5 +219,5 @@
 int
 valid_va_list(Type *tp)
 {
-	return tp == va_list_type;
+	return eqtype(tp, va_list_type, 1);
 }
--- a/cc1/arch/qbe/arch.c
+++ b/cc1/arch/qbe/arch.c
@@ -218,5 +218,5 @@
 int
 valid_va_list(Type *tp)
 {
-	return tp->op == PTR && tp->type == va_type;
+	return tp->op == PTR && eqtype(tp->type, va_type, 1);
 }
--- a/cc1/arch/z80/arch.c
+++ b/cc1/arch/z80/arch.c
@@ -217,5 +217,5 @@
 int
 valid_va_list(Type *tp)
 {
-	return tp == va_list_type;
+	return eqtype(tp, va_list_type, 1);
 }