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
1269 t = 1;1269 t = 1;
1270 printf("type of bool: %d\n", (int) ( (~ ((unsigned int) (t && 1))) / 2) );1270 printf("type of bool: %d\n", (int) ( (~ ((unsigned int) (t && 1))) / 2) );
1271 1271
1272 printf("type of cond: %d\n", (~(t ? 0U : (unsigned int)0)) / 2 );
1272 /* test ? : cast */1273 /* test ? : cast */
1273 {1274 {
1274 int aspect_on;1275 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