Feature request, warnings for non safe calls within signal handlers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm assuming this doesn't already happen, i've not seen it before, the
newest gcc I use is 4.3.2 

Would it be possible to add a warning to gcc C when code in an signal
handler (alarm) uses non thread safe calls.

My documentation for linux is old enough it has zero warning other than
a possible interaction between alarm() and sleep().

I've found the information I need in the signal man page from an updated
debian, but this is largely news to me :-(

I filed this report:
http://sourceware.org/bugzilla/show_bug.cgi?id=13845


Gcc's own documentation is incomplete on the subject

The example here risks not just printing incorrect values but stopping
completely waiting in a futex forever.
http://www.gnu.org/software/libc/manual/html_node/Non_002datomic-Example.html#Non_002datomic-Example

No warning here
http://www.gnu.org/software/libc/manual/html_node/Setting-an-Alarm.html

Typical alarm example, also not safe
http://www.ccplusplus.com/2011/10/alarm-function-example-in-c.html


http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04

"unspecified" is a very vague warning.  Its sometimes acceptable for
something to give the wrong answer for its output but its never
acceptable for a process to stall and never resume.  If this kind of
thing is the outcome then gcc needs to babysit me more :-)

Thanks,
Jon





[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux