Commit 2db8b0c2 authored by Virgile Prevosto's avatar Virgile Prevosto Committed by Andre Maroneze
Browse files

[typing] don't forget to cast result of conditional if needed

parent acef103f
......@@ -7233,9 +7233,11 @@ and doExp local_env
clean_up_chunk_locals se2;
let loc = e2.expr_loc in
let e2' = match e2'o with None -> Cil.one ~loc | Some e -> e in
let _,e2' = castTo t2 tresult e2' in
finishExp [] empty e2' tresult;
end else if asconst <> CNoConst && is_true_cond = `CFalse then begin
clean_up_chunk_locals se3;
let _,e3' = castTo t3 tresult e3' in
finishExp [] empty e3' tresult
end else begin
if not (isEmpty se2) then
......
#define M0(x) (x)*(x)<4.0?0.0:1.0
char pixels[] = {M0(0.0), M0(1), M0(2.0f)};
/* tests below should evaluate to 2. */
char test_neg = { (-0.) ? 1. : 2. };
char test_ge = { ((-1.) >= 0.) ? 1. : 2. };
char test_cast = { 1 >= (0?1U:(-1)) ? 1. : 2. };
char test_cast[] = { 1 >= (0?1U:(-1)) ? 1. : 2.,
((double)1) >= (0?1U:(-1)) ? 1. : 2. };
extern int f(void);
/* no call should be evaluated. */
char no_call[] = { 1 ? 1 : f(), 0?f():2 };
......@@ -3,6 +3,6 @@
char pixels[3] = {(char)0.0, (char)0.0, (char)1.0};
char test_neg = (char)2.;
char test_ge = (char)2.;
char test_cast = (char)2.;
char test_cast[2] = {(char)2., (char)2.};
char no_call[2] = {(char)1, (char)2};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment