Miscompilation bug
andrewchambers opened this issue · comments
andrewchambers commented
Following code aborts with 8cc at runtime, works with gcc 4.9.2 and tcc 0.9.26.
void abort(void);
void exit(int status);
struct {
unsigned x2 : 2;
unsigned x3 : 3;
} a = {2, 3} , *b = &a;
int main() {
b->x3 += b->x2;
if (b->x3 != 5)
abort();
exit(0);
}
Sandeep Polisetty commented
Hi
I am a beginner looking to learn compiler theory side by side while working on real projects . I am backend developer with no experience here yet . Can I pick this bug for a beginner or could you suggest some other issue . Thanks
andrewchambers commented
The backend for 8cc is not too complicated, though @rui314 doesn't seem to be maintaining this project actively at the moment.