[Bug analyzer/115737] __builtin_printf fools analyzer's -Wanalyzer-unsafe-call-within-signal-handler
pinskia at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Jul 1 21:53:26 GMT 2024
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115737
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-07-01
Ever confirmed|0 |1
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The list is definitely limited:
```
static function_set
get_async_signal_unsafe_fns ()
{
// TODO: populate this list more fully
static const char * const async_signal_unsafe_fns[] = {
/* This array must be kept sorted. */
"exit",
"fprintf",
"free",
"malloc",
"printf",
"snprintf",
"sprintf",
"vfprintf",
"vprintf",
"vsnprintf",
"vsprintf"
};
const size_t count = ARRAY_SIZE (async_signal_unsafe_fns);
function_set fs (async_signal_unsafe_fns, count);
return fs;
}
```
Oh it is not using ASM name either but rather identifier name:
```
static bool
signal_unsafe_p (tree fndecl)
{
function_set fs = get_async_signal_unsafe_fns ();
if (fs.contains_decl_p (fndecl))
return true;
if (is_std_function_p (fndecl)
&& fs.contains_name_p (IDENTIFIER_POINTER (DECL_NAME (fndecl))))
return true;
return false;
}
```
Maybe it should check both.
Confirmed.
More information about the Gcc-bugs
mailing list