+++ to secure your transactions use the Bitcoin Mixer Service +++

 

GNU bug report logs - #66002
[PATCH] build: suppress suggest-attribute=cold warnings

Previous Next

Package: grep;

Reported by: Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>

Date: Fri, 15 Sep 2023 15:28:02 UTC

Severity: normal

Tags: patch

To reply to this bug, email your comments to 66002 AT debbugs.gnu.org.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#66002; Package grep. (Fri, 15 Sep 2023 15:28:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Fri, 15 Sep 2023 15:28:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>
To: bug-grep <at> gnu.org
Cc: Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>
Subject: [PATCH] build: suppress suggest-attribute=cold warnings
Date: Fri, 15 Sep 2023 13:45:00 +0000
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.

Tiny-change: yes
---
 configure.ac | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configure.ac b/configure.ac
index 844a259bd..b793cabde 100644
--- a/configure.ac
+++ b/configure.ac
@@ -159,6 +159,11 @@ if test $gl_gcc_warnings != no; then
   # Remove the following and save the result in GNULIB_WARN_CFLAGS.
   nw=
   nw="$nw -Wunused-macros"
+
+  # To prevent warnings in sigsegv.c if the perror function
+  # has "cold" attribute.
+  nw="$nw -Wsuggest-attribute=cold"
+
   gl_WARN_ADD([-Wno-format-nonliteral])
   gl_MANYWARN_COMPLEMENT([GNULIB_WARN_CFLAGS], [$WARN_CFLAGS], [$nw])
   AC_SUBST([GNULIB_WARN_CFLAGS])
-- 
glebfm





Information forwarded to bug-grep <at> gnu.org:
bug#66002; Package grep. (Sat, 16 Sep 2023 00:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 66002 <at> debbugs.gnu.org (full text, mbox):

From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>, 66002 <at> debbugs.gnu.org
Subject: Re: bug#66002: [PATCH] build: suppress suggest-attribute=cold warnings
Date: Fri, 15 Sep 2023 17:04:05 -0700
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.




Information forwarded to bug-grep <at> gnu.org:
bug#66002; Package grep. (Sat, 16 Sep 2023 23:06:01 GMT) Full text and rfc822 format available.

Message #11 received at 66002 <at> debbugs.gnu.org (full text, mbox):

From: Gleb Fotengauer-Malinovskiy <glebfm <at> altlinux.org>
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: 66002 <at> debbugs.gnu.org
Subject: Re: bug#66002: [PATCH] build: suppress suggest-attribute=cold warnings
Date: Sun, 17 Sep 2023 01:28:53 +0400
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




This bug report was last modified 258 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.