This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: porting problem: segfault when compiling programs that call malloc
- From: Ian Lance Taylor <iant at google dot com>
- To: "Tomas Svensson" <idulus at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: 13 Sep 2007 13:45:21 -0700
- Subject: Re: porting problem: segfault when compiling programs that call malloc
- References: <9850f5010709130756l10504ebwad56ea28b40dc376@mail.gmail.com>
"Tomas Svensson" <idulus@gmail.com> writes:
> I am porting gcc to a new architecture, and have yet another problem
> that I've been staring at for far too long now.
>
> Whenever I compile a program that calls malloc, GCC crashes with:
>
> /cygdrive/c/home/risc/src/gcc-4.1.2/gcc/unwind-dw2-fde.c: In function
> '__register_frame':
> /cygdrive/c/home/risc/src/gcc-4.1.2/gcc/unwind-dw2-fde.c:119: internal
> compiler error: Segmentation fault
> Please submit a full bug report,
> with preprocessed source if appropriate.
> See <URL:http://gcc.gnu.org/bugs.html> for instructions.
> make[3]: *** [libgcc/./unwind-dw2-fde.o] Error 1
>
> (this example is from compiling libgcc, but the exact same thing
> happens for any file that calls malloc).
>
> I've looked at it in gdb and the error occurs in expand_call() in
> gcc/calls.c, at line 2787:
>
> rtx temp = gen_reg_rtx (GET_MODE (valreg));
>
> where valreg is a null pointer. I've looked at the source, but I
> really can't see why it would be anything other than zero at that
> point, so I don't understand what is causing this.
valreg is set around line 2564 of calls.c. It shouldn't be zero at
line 2787. Unless you have an malloc function with a return type of
void, which seems dubious.
Ian