anthropics / anthropics/claudes-c-compiler

Result from fuzzing with `csmith` and `yarpgen`

Đang mở
#227 30 bình luận 3 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
2.8k
Fork
247
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

`csmith` and `yarpgen` are random C program generators, here we simply iterate though random seed `0` to `100` and compare the random program's output with GCC, ideally they should be identical.

Done in Debian 13 VM, minimal reproduce script provided.

---

csmith from Debian pacakge
Script:

```bash
TESTCC=~/claudes-c-compiler/target/release/ccc-x86

for seed in {0..100}; do
csmith --seed $seed --output csmith_gen.c

gcc csmith_gen.c -I /usr/include/csmith -lm -o ref.exe 2>/dev/null

timeout 5 ./ref.exe > ref.txt
if [ $? -ne 0 ]; then
continue
fi

$TESTCC csmith_gen.c -I /usr/include/csmith -lm -o tst.exe 2>/dev/null
if [ $? -ne 0 ]; then
echo "test compiler failed at $seed"
continue
fi

timeout 5 ./tst.exe > tst.txt

cmp -s ref.txt tst.txt
if [ $? -ne 0 ]; then
echo "differ at $seed"
continue
fi
done
```

Result:
```
differ at 2
differ at 4
differ at 8
differ at 10
differ at 11
differ at 35
differ at 51
differ at 55
differ at 56
differ at 90
differ at 91
differ at 94
differ at 95
differ at 98
```

---

yarpgen built from source https://github.com/intel/yarpgen
Script:

```bash
YARPGEN=~/yarpgen/build/yarpgen

TESTCC=~/claudes-c-compiler/target/release/ccc-x86

for seed in {10..100}; do
$YARPGEN --std=c --emit-pragmas=none --seed=$seed 1>/dev/null

gcc driver.c func.c -o ref.exe 2>/dev/null
if [ $? -ne 0 ]; then
continue
fi

./ref.exe > ./ref.txt

gcc driver.c -c 2>/dev/null
$TESTCC driver.o func.c -o tst.exe 2>/dev/null
if [ $? -ne 0 ]; then
echo "test compiler failed at $seed"
continue
fi

./tst.exe > ./tst.txt

cmp -s ref.txt tst.txt
if [ $? -ne 0 ]; then
echo "differ at $seed"
continue
fi
done
```

Result:
```
differ at 16
differ at 49
differ at 75
differ at 87
differ at 96
```

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.