On Fri, Sep 15, 2023 at 05:04:05PM -0700, Paul Eggert wrote: > 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've encountered this warning with a version of GCC that's very similar: gcc-13 (GCC) 13.2.1 20230817 (ALT Sisyphus 13.2.1-alt2) I'm not certain what's different in our testing, but I managed to reproduce it on Fedora 38. This occurred both when I made a simple edit to the /usr/include/stdio.h header: -extern void perror (const char *__s); +extern void perror (const char *__s) __attribute__ ((__cold__)); and with glibc version 2.38.9000-8.fc40.x86_64 from Rawhide. > 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. I'm not insisting that this needs to be addressed, but I do believe that someone else might encounter this issue. -- glebfm