Project

General

Profile

Actions

Bug #328

open

Short logic when calling functions in conditions should be implemented correctly

Added by Pavel Shved over 14 years ago. Updated about 10 years ago.

Status:
Open
Priority:
Low
Assignee:
-
Category:
CIL
Target version:
-
Start date:
08/03/2010
Due date:
% Done:

0%

Estimated time:
Detected in build:
pre-ldv
Platform:
Published in build:

Description

Given the code snippet

if (f() || g()) {...}

CIL transforms it into the following code:

tmp1 = f();
tmp2 = g();
if (tmp1 || tmp2) {...}

That is obviously not correct (and one mutex_lock driver even fails because of it); programmers do rely on short logic. Note that in other cases short logic is correctly processed with CIL, it's just for function calls (which are transformed into assignments of temporary variables) where it happens.

Letting the program through Aspectator solves it (LLVM has more correct short logic transformation).

Actions

Also available in: Atom PDF