PATCH : free(NULL) in cpphash.c

Philippe De Muyter phdm@macqel.be
Wed Apr 5 02:41:00 GMT 2000


> > No, free(NULL) can crash the program with many old malloc implementations.
> > That is also valid for realloc(NULL, ).
> 
> That possibility occurred to me about five seconds after I sent the
> previous message.  I will definitely apply the patch, but can you
> please send me a piece of sample input that triggers the bug?  I don't
> have an old malloc implementation around to test with.

It was triggered as shown below, but currently my bootstrap doesn't even go
that far, so I cannot replay it with -v or save-temps.

Philippe

for name in _muldi3 _divdi3 _moddi3 _udivdi3 _umoddi3 _negdi2 _lshrdi3 _ashldi3
_ashrdi3 _ffsdi2 _udiv_w_sdiv _udivmoddi4 _cmpdi2 _ucmpdi2 _floatdidf _floatdisf
 _fixunsdfsi _fixunssfsi _fixunsdfdi _fixdfdi _fixunssfdi _fixsfdi _fixxfdi _fix
unsxfdi _floatdixf _fixunsxfsi _fixtfdi _fixunstfdi _floatditf __gcc_bcmp _varar
gs __dummy _eprintf _bb _shtab _clear_cache _trampoline __main _exit _ctors _pur
e; \
do \
  echo ${name}; \
  ./xgcc -B/usr/local/m68k-motorola-sysv/bin/ -B./ -I/usr/local/m68k-motorola-sy
sv/include -O2   -DIN_GCC    -g  -I./include   -g1  -DIN_LIBGCC2 -D__GCC_FLOAT_N
OT_NEEDED   -I. -I/share/src/gnu/gccdev/egcs/gcc -I/share/src/gnu/gccdev/egcs/gc
c/config -I/share/src/gnu/gccdev/egcs/gcc/../include -c -DL${name} \
      -DUSE_COLLECT2 /share/src/gnu/gccdev/egcs/gcc/libgcc2.c -o ${name}.o; \
  if [ $? -eq 0 ] ; then true; else exit 1; fi; \
  ar  rc tmplibgcc2.a ${name}.o; \
  rm -f ${name}.o; \
done
_muldi3
xgcc: Internal compiler error: program cpp got fatal signal 11


More information about the Gcc-patches mailing list