081-ubnot-canonical.scm (639B)
1 ;; tests/cc-cg/81-ubnot-canonical.scm — bitwise-not on unsigned should 2 ;; leave a canonical 64-bit slot in the to-type's natural form. 3 ;; 4 ;; Models: 5 ;; unsigned int a = 0; 6 ;; return (~a) == 4294967295u; 7 ;; 8 ;; Same bug class as 80-uneg-canonical: ~0 in 64-bit is 0xFF..FF, 9 ;; spilled as u32 without re-canonicalizing causes a literal 10 ;; 4294967295u (loaded as 0x00000000FFFFFFFF) to compare unequal. 11 12 (let ((cg (cg-init))) 13 (cg-fn-begin cg "main" '() %t-i32) 14 (cg-push-imm cg %t-u32 0) 15 (cg-unop cg 'bnot) 16 (cg-push-imm cg %t-u32 4294967295) 17 (cg-binop cg 'eq) 18 (cg-return cg) 19 (cg-fn-end cg) 20 (write-bv-fd 1 (cg-finish cg)))