On 9/15/23 08:45, Gleb Fotengauer-Malinovskiy wrote:
Following the glibc commit glibc-2.38~298 ("Mark various cold functions
as __COLD"), GNU grep build with -flto flag triggers a GCC warning:
sigsegv.c: In function ‘stackoverflow_deinstall_handler.part.0’:
sigsegv.c:1441:1: error: function might be candidate for attribute ‘cold’
[-Werror=suggest-attribute=cold]
* configure.ac (GNULIB_WARN_CFLAGS): Suppress -Wsuggest-attribute=cold.
I'm not seeing this problem on Fedora 38 when I manually mark error,
error_at_line, and perror with _GL_ATTRIBUTE_COLD. I am compiling with
gcc (GCC) 13.2.1 20230728 (Red Hat 13.2.1-1) and configuring with
"./configure --enable-gcc-warnings 'CC=gcc -flto'". This is grep commit
102be2bfa571355ff44db39348438a0def1ab382.
If you're using an older GCC, I wouldn't worry about the false alarm,
whatever it's about (it's not clear from the diagnostic). The
attribute-cold diagnostics are occasionally helpful for minor
performance tuning, and are harmless if ignored.