[Date Prev][Date Next] [Chronological] [Thread] [Top]

Solaris gcc weirdness

This is just a note to let you know about a strange situation that I've
encountered. Using gcc 2.95.1 on Solaris 7, compiling back-ldbm with
"-g -O2" causes a segfault at runtime when initializing libperl.so. The
problem doesn't occur using just "-O" or no optimization at all. The weird
thing is, I tried tracking down which part of the code is tripping this
optimization bug, and it seems to be dependent on more than one source file.
The files id2entry.c, idl.c, index.c, and init.c all seem to contribute to
the problem. But turning off optimization for any one of these files is
insufficient to eliminate the bug. This is really odd since my configuration
isn't even using back-ldbm when things fail. (I.e., I don't have any ldbm
backends configured in my slapd.conf file, and the crash happens during
initialization of back-perl.) The crash actually occurs inside malloc,
invoked by libperl. This makes me suspect that something in back-ldbm's
initialization code has overwritten some malloc'd memory, except that I
haven't been able to detect any problem using the Solaris watchmalloc
library. Also, I'd suspect that plenty of mallocs have happened already
between ldbm's initialization and perl's init. (back-perl is loaded
dynamically, back-ldbm is static.) Anyway, I've probably spent too much time
looking at this already. Building back-ldbm with "-O" will have to suffice
for now.

  -- Howard Chu
  Chief Architect, Symas Corp.       Director, Highland Sun
  http://www.symas.com               http://highlandsun.com/hyc