Subject: Re: port-xen/29887: sysctl kern.consdev coredumps
To: Bill Studenmund <>
From: Jason Thorpe <>
List: tech-userlevel
Date: 06/21/2005 09:59:28
On Jun 20, 2005, at 8:48 PM, Bill Studenmund wrote:

> Uhm, I don't remember saying I don't want core dumps. They can be VERY
> valuable. However I don't want a core dump to tell me I had a crash  
> in an
> error-handling log message. A core telling me I had a crash in code
> handling a case I _should_ be handling (or should be protecting  
> against),
> that's fine.

Then perhaps your code should be more careful in general.

In any case, it occurred to me that in the case you're talking about,  
you're probably not using printf(), but rather syslog().  This  
transformation would never be performed on syslog(), so you don't  
have anything to worry about.

> I'm still not getting how printf() or puts() not coring is incorrect
> behavior. The strongest I've heard so far is that the behavior is
> undefined and up to the implementation. I have not heard a requirement
> that the implementation has to crash.

Yes, it's up to the implementation.  You're right, it doesn't have to  
crash, but it doesn't have to no crash, either.

BTW, try taking the return value of printf() -- GCC won't transform  
the call in that case, because the return value semantics of printf()  
and puts() are different.

> Yes, I do agree that a program
> operating in a standardized environment (-std=<foo> or -ansi or such)
> should not ASSUME that it can do it, but I haven't heard someone quote
> that we MUST crash.

Well, GCC defaults to -std=gnu89 which includes c89 hosted  
environment semantics.

-- thorpej