commit e7de88b1568b84cdd7c18b3149d7e17f8686763b
parent 65a354524234ab1bc797faadd25dc30fc02b6a9a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 30 Oct 2021 14:03:31 +0200
cc1: Fix initialization of type for 0 and 1
The constants 0 and 1 are defined to have integer type,
but the integer type was not tet initialized at that
moment, making that the type of these constants was
a null pointer.
Diffstat:
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/cmd/cc/cc1/amd64-sysv.c b/src/cmd/cc/cc1/amd64-sysv.c
@@ -200,8 +200,6 @@ amd64_sysv(void)
arch.va_list_type = *mktype(&arch.va_type, ARY, 1, NULL);
arch.pvoidtype.type = &arch.chartype;
arch.valid_va_list = local_valid_va_list;
- arch.zero.type = inttype;
- arch.one.type = inttype;
return &arch;
}
diff --git a/src/cmd/cc/cc1/arch.c b/src/cmd/cc/cc1/arch.c
@@ -80,4 +80,7 @@ iarch(void)
va_type = &arch->va_type;
zero = &arch->zero;
one = &arch->one;
+
+ zero->type = inttype;
+ one->type = inttype;
}
diff --git a/src/cmd/cc/cc1/z80-scc.c b/src/cmd/cc/cc1/z80-scc.c
@@ -205,8 +205,6 @@ z80_scc(void)
arch.valid_va_list = local_valid_va_list;
arch.pvoidtype.type = &arch.chartype;
arch.va_type.type = &arch.inttype;
- arch.zero.type = inttype;
- arch.one.type = inttype;
return &arch;
}