public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/109792] New: RFE: Warn about misuse of "pure" attribute
@ 2023-05-09 18:05 xry111 at gcc dot gnu.org
  2023-05-09 18:05 ` [Bug c/109792] " xry111 at gcc dot gnu.org
  2023-05-09 18:07 ` pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-05-09 18:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109792

            Bug ID: 109792
           Summary: RFE: Warn about misuse of "pure" attribute
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: xry111 at gcc dot gnu.org
  Target Milestone: ---

I've spent several hours on https://github.com/systemd/systemd/pull/27595,
which fixes a wrong use of the "pure" attribute.  Consider the following:

$ cat t.c
extern int t(const char *, int *);

int t(const char *a, int *b)
{
  if (!a)
    return 114;

  *b = __builtin_strlen(a);
  return 0;
}

$ gcc t.c -S -Wall -Wextra -Werror && echo "no warning"
no warning
$ gcc t.c -S -Wall -Wextra -Werror -O1 && echo "no warning"
no warning
$ gcc t.c -S -Wall -Wextra -Werror -O2 && echo "no warning"
no warning
$ gcc t.c -S -Wall -Wextra -Werror -O3 && echo "no warning"
no warning
$ gcc t.c -S -Wall -Wextra -Werror -O3 -fanalyzer && echo "no warning"
no warning

If we had a warning here, it would have saved me several hours :).

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/109792] RFE: Warn about misuse of "pure" attribute
  2023-05-09 18:05 [Bug c/109792] New: RFE: Warn about misuse of "pure" attribute xry111 at gcc dot gnu.org
@ 2023-05-09 18:05 ` xry111 at gcc dot gnu.org
  2023-05-09 18:07 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: xry111 at gcc dot gnu.org @ 2023-05-09 18:05 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109792

Xi Ruoyao <xry111 at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
           Keywords|                            |diagnostic

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/109792] RFE: Warn about misuse of "pure" attribute
  2023-05-09 18:05 [Bug c/109792] New: RFE: Warn about misuse of "pure" attribute xry111 at gcc dot gnu.org
  2023-05-09 18:05 ` [Bug c/109792] " xry111 at gcc dot gnu.org
@ 2023-05-09 18:07 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-09 18:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109792

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |DUPLICATE
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Dup of bug 18487.

*** This bug has been marked as a duplicate of bug 18487 ***

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-09 18:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-09 18:05 [Bug c/109792] New: RFE: Warn about misuse of "pure" attribute xry111 at gcc dot gnu.org
2023-05-09 18:05 ` [Bug c/109792] " xry111 at gcc dot gnu.org
2023-05-09 18:07 ` pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).