The GCC compiler driver (cc1) crashes with a segfault when trying to compile any simple program #43

Closed
opened 2023-10-15 11:20:31 +00:00 by apio · 2 comments
Owner

I'm pretty sure this is some bug/incompatibility somewhere in our libc/kernel/ABI, that is making cc1 behave weirdly. Leaving this open so I can investigate it later.

The actual error (call trace obtained through objdump):
Segfault, null dereference (trying to access 0x8) in et_splay(et_occ* et) when trying to access et->parent, implying that et is NULL.

  • called from calculate_dominance_info(cdi_direction) through et_set_parent()
  • called from cleanup_tree_cfg(unsigned int)
  • called from (anonymous namespace)::pass_build_cfg::execute(function*)
  • called from execute_one_pass(opt_pass*) as a function pointer, after accessing in_gimple_form, global_options and cfun
  • called from execute_pass_list_1(opt_pass*)
  • called from execute_pass_list(function*, opt_pass*)
  • called from cgraph_node::analyze()
  • called from analyze_functions(bool)
  • called from symbol_table::finalize_compilation_unit()
  • called from compile_file()
  • called from toplev::main(int, char**)
  • called from main
I'm pretty sure this is some bug/incompatibility somewhere in our libc/kernel/ABI, that is making cc1 behave weirdly. Leaving this open so I can investigate it later. The actual error (call trace obtained through objdump): Segfault, null dereference (trying to access 0x8) in `et_splay(et_occ* et)` when trying to access `et->parent`, implying that et is NULL. - called from `calculate_dominance_info(cdi_direction)` through `et_set_parent()` - called from `cleanup_tree_cfg(unsigned int)` - called from `(anonymous namespace)::pass_build_cfg::execute(function*)` - called from `execute_one_pass(opt_pass*)` as a function pointer, after accessing `in_gimple_form`, `global_options` and `cfun` - called from `execute_pass_list_1(opt_pass*)` - called from `execute_pass_list(function*, opt_pass*)` - called from `cgraph_node::analyze()` - called from `analyze_functions(bool)` - called from `symbol_table::finalize_compilation_unit()` - called from `compile_file()` - called from `toplev::main(int, char**)` - called from `main`
apio added the
bug
label 2023-10-15 11:20:31 +00:00
apio self-assigned this 2023-10-15 11:20:31 +00:00
Author
Owner

Crash was due to global constructors not being called, that issue is fixed now. GCC still doesn't work as it apparently hits the top of the stack (not the bottom, this is not a stack overflow, but maybe a buffer overflow) while optimizing SSA passes. At least it gets through a couple of stages now.

Crash was due to global constructors not being called, that issue is fixed now. GCC still doesn't work as it apparently hits the top of the stack (not the bottom, this is not a stack overflow, but maybe a buffer overflow) while optimizing SSA passes. At least it gets through a couple of stages now.
Author
Owner

GCC works

Fixed in 644614cdd8. =D

Of course this was not an incompatibility with GCC at all, but a fatal bug in memmove which literally made it work only half of the time and segfault the other half. Glad to see this finally fixed, and GCC finally working on Luna :)

![GCC works](/attachments/ac36acf4-e3c9-4fba-ae23-4dbd52a7756e) Fixed in 644614cdd8f63727adb1e5acc98784e7a0e6b4f0. =D Of course this was not an incompatibility with GCC at all, but a fatal bug in memmove which literally made it work only half of the time and segfault the other half. Glad to see this finally fixed, and GCC finally working on Luna :)
apio closed this issue 2024-02-11 17:38:24 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: apio/Luna#43
No description provided.