History

Fix type of cond-op

the optimization of a ternary op with two boolean operands had the same problem (as in the last commit) of loosing the type.

Michael Matz committed 3 years ago

Commit ef3eb021 parent 96b31ba2 files · +10 −7Browse files

Showing the changes to tests/tcctest.c (1 of 2 files). Show all

Unified · Split

tests/tcctest.c+1−0
@@ -1269,6 +1269,7 @@ void bool_test() · 1268 unmodified lines
12691269 t = 1;
12701270 printf("type of bool: %d\n", (int) ( (~ ((unsigned int) (t && 1))) / 2) );
12711271
1272+ printf("type of cond: %d\n", (~(t ? 0U : (unsigned int)0)) / 2 );
12721273 /* test ? : cast */
12731274 {
12741275 int aspect_on;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t