ref: 68b4a8e6ef5ca0d26bc026f69acddb76600197ac
parent: 12ad6dffeb56a2ac3b63c13528534767d57d03e7
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Jun 17 16:31:01 EDT 2024
cc: logical operations (& | ^) operate on integers only (thanks sigrid) void main(void) { uchar a[3]; float f = a[2] | a[1] | (a[0]/1.2); USED(f); } the code above used to generate impossible code in the linker like: main: doasm: notfound from=34 to=35 (872) ORL X0,X1 main: doasm: notfound from=34 to=35 (872) ORL X0,X1 main: doasm: notfound from=34 to=35 (872) ORL X0,X1 with the change, the compiler correctly rejects it: incompatible types: "UINT" and "DOUBLE" for op "OR" i assume the BNUMBER in the type matrix must have been a oversight.
--- a/sys/src/cmd/cc/sub.c
+++ b/sys/src/cmd/cc/sub.c
@@ -1796,8 +1796,8 @@
TUCHAR, BINTEGER, 0,
TSHORT, BINTEGER, 0,
TUSHORT, BINTEGER, 0,
- TINT, BNUMBER, 0,
- TUINT, BNUMBER, 0,
+ TINT, BINTEGER, 0,
+ TUINT, BINTEGER, 0,
TLONG, BINTEGER, 0,
TULONG, BINTEGER, 0,
TVLONG, BINTEGER, 0,
--
⑨