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

--- Comment #8 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by David Malcolm <dmalc...@gcc.gnu.org>:

https://gcc.gnu.org/g:a6fdb1a2a2906103afd70fa68cf7c45e896b8fbb

commit r15-1845-ga6fdb1a2a2906103afd70fa68cf7c45e896b8fbb
Author: David Malcolm <dmalc...@redhat.com>
Date:   Thu Jul 4 14:44:51 2024 -0400

    analyzer: handle <error.h> at -O0 [PR115724]

    At -O0, glibc's:

    __extern_always_inline void
    error (int __status, int __errnum, const char *__format, ...)
    {
      if (__builtin_constant_p (__status) && __status != 0)
        __error_noreturn (__status, __errnum, __format, __builtin_va_arg_pack
());
      else
        __error_alias (__status, __errnum, __format, __builtin_va_arg_pack ());
    }

    becomes just:

    __extern_always_inline void
    error (int __status, int __errnum, const char *__format, ...)
    {
      if (0)
        __error_noreturn (__status, __errnum, __format, __builtin_va_arg_pack
());
      else
        __error_alias (__status, __errnum, __format, __builtin_va_arg_pack ());
    }

    and thus calls to "error" are calls to "__error_alias" by the
    time -fanalyzer "sees" them.

    Handle them with more special-casing in kf.cc.

    gcc/analyzer/ChangeLog:
            PR analyzer/115724
            * kf.cc (register_known_functions): Add __error_alias and
            __error_at_line_alias.

    gcc/testsuite/ChangeLog:
            PR analyzer/115724
            * c-c++-common/analyzer/error-pr115724.c: New test.

    Signed-off-by: David Malcolm <dmalc...@redhat.com>

Reply via email to