This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: porting problem: segfault when compiling programs that call malloc


"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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]