public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/97111] New: Support for exception-handling within -fanalyzer
@ 2020-09-18 14:08 dmalcolm at gcc dot gnu.org
  2020-09-25 18:56 ` [Bug analyzer/97111] " dmalcolm at gcc dot gnu.org
  2024-05-03 13:12 ` cvs-commit at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-18 14:08 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97111
           Summary: Support for exception-handling within -fanalyzer
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: analyzer
          Assignee: dmalcolm at gcc dot gnu.org
          Reporter: dmalcolm at gcc dot gnu.org
            Blocks: 97110
  Target Milestone: ---

-fanalyzer does not yet understand exception-handling, and, in particular, C++
exception-handling.

(Filing this as part of the -fanalyzer C++ tracker bug)


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=97110
[Bug 97110] [meta-bug] tracker bug for supporting C++ in -fanalyzer

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

* [Bug analyzer/97111] Support for exception-handling within -fanalyzer
  2020-09-18 14:08 [Bug analyzer/97111] New: Support for exception-handling within -fanalyzer dmalcolm at gcc dot gnu.org
@ 2020-09-25 18:56 ` dmalcolm at gcc dot gnu.org
  2024-05-03 13:12 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-09-25 18:56 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
References:

https://en.cppreference.com/w/cpp/language/exceptions

https://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html ("Itanium C++ ABI:
Exception Handling")

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

* [Bug analyzer/97111] Support for exception-handling within -fanalyzer
  2020-09-18 14:08 [Bug analyzer/97111] New: Support for exception-handling within -fanalyzer dmalcolm at gcc dot gnu.org
  2020-09-25 18:56 ` [Bug analyzer/97111] " dmalcolm at gcc dot gnu.org
@ 2024-05-03 13:12 ` cvs-commit at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2024-05-03 13:12 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:5219414f3cde3c1037e289a6654cd722cfa75dea

commit r15-131-g5219414f3cde3c1037e289a6654cd722cfa75dea
Author: David Malcolm <dmalcolm@redhat.com>
Date:   Fri May 3 09:05:29 2024 -0400

    testsuite: fix analyzer C++ failures on Solaris [PR111475]

    As part of PR analyzer/96395, these patches moved testcases from
    gcc.dg/analyzer to c-c++-common/analyzer:
    - r14-3503-g55f6a7d949abc7
    - r14-3823-g50b5199cff6908
    - r14-6564-gae034b9106fbdd

    Unfortunately this led to numerous g++ testsuite failures on Solaris,
    tracked as PR analyzer/111475.

    Almost all of the failures are due to standard library differences where
    including a C standard library on C++ e.g. <stdlib.h> leads to the plain
    symbols referencing the symbols "std::" via a "using" declaration,
    whereas I had written the code expecting them to use symbols in the root
    namespace.

    The analyzer has special-case handling of many functions by name.
    This patch generalizes such handling to also match against functions
    in "std::" for all of the cases I found in the testsuite (via manual
    inspection of the preprocessed test cases against Solaris headers).
    This fixes cases where the analyzer was failing to "know about" the
    behavior of such functions.

    Other such failures are due to "std::" prefixes appearing in names of
    functions in the output, leading to mismatches against expected output.
    The patch adds regexes to some cases, and moves some other cases back
    from c-c++-common to gcc.dg where the dg-multiline syntax isn't
    expressive enough.

    Various "fd-*.c" failures relate to Solaris's socket-handling functions
    not being marked with "noexcept", where due to PR analyzer/97111 we
    mishandle the exception-handling edges in the CFG, leading to leak
    false positives.  The patch works around this by adding -fno-exceptions
    to these cases, pending a proper fix for PR analyzer/97111.

    gcc/analyzer/ChangeLog:
            PR analyzer/111475
            * analyzer.cc (is_special_named_call_p): Add "look_in_std" param.
            (is_std_function_p): Make non-static.
            * analyzer.h (is_special_named_call_p): Add optional "look_in_std"
            param.
            (is_std_function_p): New decl.
            * engine.cc (stmt_requires_new_enode_p): Look for both "signal"
            and "std::signal".
            * kf.cc (register_known_functions): Add various "std::" copies
            of the known functions.
            * known-function-manager.cc
            (known_function_manager::~known_function_manager): Clean up
            m_std_ns_map_id_to_kf.
            (known_function_manager::add_std_ns): New.
            (known_function_manager::get_match): Also look for known "std::"
            functions.
            (known_function_manager::get_by_identifier_in_std_ns): New.
            * known-function-manager.h
            (known_function_manager::add_std_ns): New decl.
            (known_function_manager::get_by_identifier_in_std_ns): New decl.
            (known_function_manager::m_std_ns_map_id_to_kf): New field.
            * sm-file.cc (register_known_file_functions): Add various "std::"
            copies of the known functions.
            * sm-malloc.cc (malloc_state_machine::on_stmt): Handle
            "std::realloc".
            * sm-signal.cc (signal_unsafe_p): Consider "std::" copies of the
            functions as also being async-signal-unsafe.
            (signal_state_machine::on_stmt): Consider "std::signal".

    gcc/testsuite/ChangeLog:
            PR analyzer/111475
            * c-c++-common/analyzer/fd-glibc-byte-stream-socket.c: Add
            -fno-exceptions for now.
            * c-c++-common/analyzer/fd-manpage-getaddrinfo-client.c: Likewise.
            * c-c++-common/analyzer/fd-mappage-getaddrinfo-server.c: Rename
to...
            * c-c++-common/analyzer/fd-manpage-getaddrinfo-server.c: ...this,
and
            add -fno-exceptions for now.
            * c-c++-common/analyzer/fd-socket-meaning.c: Add -fno-exceptions
            for now.
            * c-c++-common/analyzer/fd-symbolic-socket.c: Likewise.
            * c-c++-common/analyzer/flexible-array-member-1.c: Use regexp to
            handle C vs C++ differences in spelling of function name, which
            could have a "std::" prefix on some targets.
            * c-c++-common/analyzer/pr106539.c: Likewise.
            * c-c++-common/analyzer/malloc-ipa-8-unchecked.c: Move back to...
            * gcc.dg/analyzer/malloc-ipa-8-unchecked.c: ...here, dropping
            attempt to generalize output for C vs C++.
            * c-c++-common/analyzer/signal-4a.c: Move back to...
            * gcc.dg/analyzer/signal-4a.c: ...here, dropping attempt to
            generalize output for C vs C++.
            * c-c++-common/analyzer/signal-4b.c: Move back to...
            * gcc.dg/analyzer/signal-4b.c: ...here, dropping attempt to
            generalize output for C vs C++.

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

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

end of thread, other threads:[~2024-05-03 13:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-18 14:08 [Bug analyzer/97111] New: Support for exception-handling within -fanalyzer dmalcolm at gcc dot gnu.org
2020-09-25 18:56 ` [Bug analyzer/97111] " dmalcolm at gcc dot gnu.org
2024-05-03 13:12 ` cvs-commit 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).