cosmopolitan/third_party/chibicc/test/dce_test.c

27 lines
522 B
C
Raw Normal View History

2020-12-09 12:00:48 +00:00
#include "third_party/chibicc/test/test.h"
2020-12-24 07:42:56 +00:00
#define CRASH \
({ \
asm(".err"); \
666; \
})
2020-12-09 12:00:48 +00:00
int main(void) {
2020-12-24 07:42:56 +00:00
2020-12-09 12:00:48 +00:00
if (0) {
2020-12-24 07:42:56 +00:00
return CRASH;
2020-12-09 12:00:48 +00:00
}
2020-12-24 07:42:56 +00:00
if (1) {
} else {
return CRASH;
}
2020-12-09 12:00:48 +00:00
2020-12-24 07:42:56 +00:00
ASSERT(777, 777 ?: CRASH);
ASSERT(777, 1 ? 777 : CRASH);
ASSERT(777, 0 ? CRASH : 777);
ASSERT(777, __builtin_popcount(__builtin_strlen("hihi")) == 1 ? 777 : CRASH);
ASSERT(777, !__builtin_strpbrk("HELLO\n", "bxdinupo") ? 777 : CRASH);
ASSERT(777, strpbrk("hihi", "ei") ? 777 : CRASH);
2020-12-09 12:00:48 +00:00
}