Page 1 of 1

Porting GCC 6.4.0: Null pointeur dereference in et_forest.c

Posted: Sun Nov 26, 2017 5:18 am
by Haoud
Hello everyone, I'm trying to port GCC since 1 month to my operating system right now. The binary I compiled is running correctly under my operating system (gcc - version works) but when I try to run a real compilation, gcc crash with a page error (0x0000000004) in the function et_splay: the passed argument (struct et_occ *) is a NULL pointer.
I'm using Newlib as a C library and sbrk seems to function correctly.

Thank you in advance for your help
If you need more information, don't hesitate to ask me.

Re: Porting GCC 6.4.0: Null pointeur dereference in et_fores

Posted: Mon Mar 25, 2019 8:14 pm
by awesomekling
Maybe you already figured this out, but I thought I would respond since I found this thread after running into the exact same problem.

The problem was that I wasn't invoking global constructors on process start. This caused the pool_allocator used in GCC's et-forest.c to be initialized with garbage values, which in turn led to et_new_tree() allocating too little memory for new et_nodes, causing them to overlap.

Re: Porting GCC 6.4.0: Null pointeur dereference in et_fores

Posted: Sat Mar 21, 2020 4:20 pm
by Haoud
It was indeed exactly that