GNU bug report logs - #68267
[PATCH] maint: add attributes to two functions without side effects

Previous Next

Package: coreutils;

Reported by: Samuel Tardieu <sam <at> rfc1149.net>

Date: Fri, 5 Jan 2024 16:45:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 68267-done <at> debbugs.gnu.org (full text, mbox):

From: Pádraig Brady <P <at> draigBrady.com>
To: Samuel Tardieu <sam <at> rfc1149.net>, 68267-done <at> debbugs.gnu.org
Subject: Re: bug#68267: [PATCH] maint: add attributes to two functions without
 side effects
Date: Sat, 6 Jan 2024 15:34:07 +0000
On 05/01/2024 16:44, Samuel Tardieu wrote:
> * src/date.c (res_width): This function computes its result solely
> from the value of its parameter and qualifies for the const attribute.
> * src/tee.c (get_next_out): This function has no side effect and
> qualifies for the pure attribute.
> 
> Those two functions were flagged by GCC 12.3.0.

I'm guessing GCC 12 needs help here as it can't determine the loops are finite.
(as per: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109914 )

Though I'm not seeing this suggestion with GCC 13.2.1,
so perhaps GCC 12 can determine the loops are finite?

I'll apply this since GCC 13 is less that a year old,
but in general we try to avoid littering code like this.

thanks,
Pádraig




This bug report was last modified 1 year and 170 days ago.

Previous Next


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