mirror of
https://github.com/byteworksinc/ORCA-C.git
synced 2024-11-05 02:07:22 +00:00
Flag that conversions may not set CPU flags usable for a subsequent comparison.
There are several conversions that do not set the necessary flags, so they must be set separately before doing a comparison. Without this fix, comparisons of a value that was just converted might be mis-evaluated. This led to bugs where the wrong side of an "if" could be followed in some cases, as in the below examples: #include <stdio.h> int g(void) {return 50;} signed char h(void) {return 50;} long lf(void) {return 50;} int main(void) { signed char sc = 50; if ((int)(signed char)g()) puts("OK1"); if ((int)h()) puts("OK2"); if ((int)sc) puts("OK3"); if ((int)lf()) puts("OK4"); }
This commit is contained in:
parent
b1d4d8d668
commit
cb99b3778e
2
Gen.pas
2
Gen.pas
@ -405,7 +405,7 @@ NeedsCondition := opcode in
|
||||
[pc_and,pc_ior,pc_cui,pc_cup,pc_lor,pc_lnd,pc_ldl,pc_lil,pc_lld,
|
||||
pc_lli,pc_gil,pc_gli,pc_gdl,pc_gld,pc_iil,pc_ili,pc_idl,pc_ild,
|
||||
pc_cop,pc_cpo,pc_cpi,pc_dvi,pc_mpi,pc_adi,pc_sbi,pc_mod,pc_bno,
|
||||
pc_udi,pc_uim,pc_umi];
|
||||
pc_udi,pc_uim,pc_umi,pc_cnv];
|
||||
end; {NeedsCondition}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user