Porting GCC 6.4.0: Null pointeur dereference in et_forest.c

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Haoud
Member
Member
Posts: 31
Joined: Wed Aug 10, 2016 3:07 am
Libera.chat IRC: Haoud

Porting GCC 6.4.0: Null pointeur dereference in et_forest.c

Post 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.
awesomekling
Posts: 3
Joined: Mon Mar 25, 2019 8:08 pm

Re: Porting GCC 6.4.0: Null pointeur dereference in et_fores

Post 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.
Haoud
Member
Member
Posts: 31
Joined: Wed Aug 10, 2016 3:07 am
Libera.chat IRC: Haoud

Re: Porting GCC 6.4.0: Null pointeur dereference in et_fores

Post by Haoud »

It was indeed exactly that
Post Reply