Syslog fixes a bug?

John Love-Jensen eljay@adobe.com
Thu May 8 15:51:00 GMT 2008


Hi Michael,

> I have a program that dies mysteriously.

I hate it when that happens.

> If I use syslog() to attempt to write data and see where it dies, it
> lives and works perfectly.

Sounds like your program has a bug.

> If I comment out the syslog() function call, the program crashes every time.

What do you see with a debugger, such as gdb?

> This is entirely reliable, have tested it 10 times commented +
> uncommented.  It is a line of static text, ie:
> syslog(LOG_INFO,"hello");

I was not able to reproduce your issue in a small toy program.

Do you have any short, sample source code that reproduces the problem?

> Why / how would this affect my program's execution?

Most often for such kinds of "heisenbugs" (bugs that go away when you look
for them), the instrumentation of the code changes the codes layout such
that the bug is then bollixing up something innocuous instead of bollixing
up something critical.

The bug is still there, it's just in stealth mode.

Usually such bugs are due to cavalier casting or buffer overruns.  (Although
on one occasion about 23 years ago, I discovered a bug in the compiler
itself, where it conflated double and long double, but they weren't the same
size on Intel 80286/287 / MS-DOS architecture.  Not GCC.)

HTH,
--Eljay



More information about the Gcc-help mailing list