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

Paul Eggert <eggert at cs dot ucla.edu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|14.1.1                      |15.2.1

--- Comment #4 from Paul Eggert <eggert at cs dot ucla.edu> ---
For the coreutils/Gnulib case the function that GCC misdiagnosed was:

  static void *
  check_nonnull (void *p)
  {
    if (!p)
      xalloc_die ();
    return p;
  }

where xalloc_die was declared via '_Noreturn void xalloc_die (void);'. In 2021,
GCC incorrectly warned me that the function should be marked pure, I foolishly
did so, and this serious-but-rare out-of-memory bug has been lurking in
coreutils for five years.

If a function calls an external function where GCC does not know the behavior,
it is obvious that GCC should not suggest __attribute__((const)) or
__attribute__((pure)). Any such suggestions are recipes for trouble.

Reply via email to