diff mbox series

[WIP,RFC] analyzer: Move gcc.dg/analyzer tests to c-c++-common (3) [PR96395]

Message ID 20230911174433.492082-1-vultkayn@gcc.gnu.org
State New
Headers show
Series [WIP,RFC] analyzer: Move gcc.dg/analyzer tests to c-c++-common (3) [PR96395] | expand

Commit Message

Li, Pan2 via Gcc-patches Sept. 11, 2023, 5:44 p.m. UTC
From: benjamin priour <vultkayn@gcc.gnu.org>

Hi,

Patch below is mostly done, just have to check the formatting.
Althought, I'd like your feedback on how to manage named_constants
from enum in C++.

I've checked and the analyzer works as expected with them.
However, C++ FE makes it so that given

enum
{
  NAMED = 0x1
};

then in analyzer-language.cc:maybe_stash_named_constant

    tree t = tu.lookup_constant_by_id (id);
    ...
    logger->log ("%qs: %qE", name, t);

t is printed as 1 in C, but NAMED in C++.
Should it be left as a "FE specifity",
or should we aim for 1 in C++ as well ?

Thanks,
Benjamin. 
---

Third batch of moving tests from under gcc.dg/analyzer into
c-c++-common/analyzer.

Prior to this patch bzero was not a known_function and C++
wasn't able to predict its result.
Moreover, only the C FE was notifying the analyzer upon finishing
with a TU. Now both C and C++ do it, and consequently C++ now also
evaluates named constants.

gcc/analyzer/ChangeLog:

PR analyzer/96365
	* kf.cc (class kf_bzero): New kf.
	(kf_bzero::impl_call_pre): New function.
	(register_known_functions): Register kf_bzero.

gcc/c-family/ChangeLog:

PR analyzer/96365
	* c-common.cc (c_lex_with_flags): Add extern declaration.
	(lookup_constant_by_id): Moved from c_translation_unit.
	(lookup_type_by_id): Likewise.
	(lookup_global_var_by_id): Likewise.
	(c_common_translation_unit::consider_macro): Likewise.
	* c-common.h (class c_common_translation_unit): New class.

gcc/c/ChangeLog:

	PR analyzer/96365
	* c-parser.cc (class c_translation_unit): Now useless, deleted.

gcc/cp/ChangeLog:

	PR analyzer/96365
	* parser.cc (cp_parser_translation_unit): Add callback to
analyzer when done with TU.

gcc/testsuite/ChangeLog:

	PR analyzer/96365
	* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue-2.c: Moved to...
	* c-c++-common/analyzer/CVE-2005-1689-dedupe-issue-2.c: ...here.
	* gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c: Moved to...
	* c-c++-common/analyzer/CVE-2005-1689-dedupe-issue.c: ...here.
	* gcc.dg/analyzer/CVE-2005-1689-minimal.c: Moved to...
	* c-c++-common/analyzer/CVE-2005-1689-minimal.c: ...here.
	* gcc.dg/analyzer/CWE-131-examples.c: Moved to...
	* c-c++-common/analyzer/CWE-131-examples.c: ...here.
	* gcc.dg/analyzer/attr-alloc_size-3.c: Moved to...
	* c-c++-common/analyzer/attr-alloc_size-3.c: ...here.
	* gcc.dg/analyzer/attr-const-1.c: Moved to...
	* c-c++-common/analyzer/attr-const-1.c: ...here.
	* gcc.dg/analyzer/attr-const-2.c: Moved to...
	* c-c++-common/analyzer/attr-const-2.c: ...here.
	* gcc.dg/analyzer/attr-const-3.c: Moved to...
	* c-c++-common/analyzer/attr-const-3.c: ...here.
	* gcc.dg/analyzer/attr-malloc-1.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-1.c: ...here.
	* gcc.dg/analyzer/attr-malloc-2.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-2.c: ...here.
	* gcc.dg/analyzer/attr-malloc-4.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-4.c: ...here.
	* gcc.dg/analyzer/attr-malloc-5.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-5.c: ...here.
	* gcc.dg/analyzer/attr-malloc-misuses.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-misuses.c: ...here.
	* gcc.dg/analyzer/attr-malloc-pr108252.c: Moved to...
	* c-c++-common/analyzer/attr-malloc-pr108252.c: ...here.
	* gcc.dg/analyzer/attr-nonnull-pr106325.c: Moved to...
	* c-c++-common/analyzer/attr-nonnull-pr106325.c: ...here.
	* gcc.dg/analyzer/attr-tainted_args-misuses.c: Moved to...
	* c-c++-common/analyzer/attr-tainted_args-misuses.c: ...here.
	* gcc.dg/analyzer/attribute-nonnull.c: Moved to...
	* c-c++-common/analyzer/attribute-nonnull.c: ...here.
	* gcc.dg/analyzer/bitfields-1.c: Moved to...
	* c-c++-common/analyzer/bitfields-1.c: ...here.
	* gcc.dg/analyzer/builtins-pr107565.c: Moved to...
	* c-c++-common/analyzer/builtins-pr107565.c: ...here.
	* gcc.dg/analyzer/bzero-1.c: Moved to...
	* c-c++-common/analyzer/bzero-1.c: ...here.
	* gcc.dg/analyzer/bzip2-arg-parse-1.c: Moved to...
	* c-c++-common/analyzer/bzip2-arg-parse-1.c: ...here.
	* gcc.dg/analyzer/call-summaries-1.c: Moved to...
	* c-c++-common/analyzer/call-summaries-1.c: ...here.
	* gcc.dg/analyzer/call-summaries-2.c: Moved to...
	* c-c++-common/analyzer/call-summaries-2.c: ...here.
	* gcc.dg/analyzer/call-summaries-3.c: Moved to...
	* c-c++-common/analyzer/call-summaries-3.c: ...here.
	* gcc.dg/analyzer/call-summaries-asm-x86.c: Moved to...
	* c-c++-common/analyzer/call-summaries-asm-x86.c: ...here.
	* gcc.dg/analyzer/call-summaries-errno.c: Moved to...
	* c-c++-common/analyzer/call-summaries-errno.c: ...here.
	* gcc.dg/analyzer/call-summaries-pr107072.c: Moved to...
	* c-c++-common/analyzer/call-summaries-pr107072.c: ...here.
	* gcc.dg/analyzer/callbacks-1.c: Moved to...
	* c-c++-common/analyzer/callbacks-1.c: ...here.
	* gcc.dg/analyzer/callbacks-2.c: Moved to...
	* c-c++-common/analyzer/callbacks-2.c: ...here.
	* gcc.dg/analyzer/callbacks-3.c: Moved to...
	* c-c++-common/analyzer/callbacks-3.c: ...here.
	* gcc.dg/analyzer/capacity-2.c: Moved to...
	* c-c++-common/analyzer/capacity-2.c: ...here.
	* gcc.dg/analyzer/capacity-3.c: Moved to...
	* c-c++-common/analyzer/capacity-3.c: ...here.
	* gcc.dg/analyzer/casts-1.c: Moved to...
	* c-c++-common/analyzer/casts-1.c: ...here.
	* gcc.dg/analyzer/casts-2.c: Moved to...
	* c-c++-common/analyzer/casts-2.c: ...here.
	* gcc.dg/analyzer/clobbers-1.c: Moved to...
	* c-c++-common/analyzer/clobbers-1.c: ...here.
	* gcc.dg/analyzer/clobbers-2.c: Moved to...
	* c-c++-common/analyzer/clobbers-2.c: ...here.
	* gcc.dg/analyzer/combined-conditionals-1.c: Moved to...
	* c-c++-common/analyzer/combined-conditionals-1.c: ...here.
	* gcc.dg/analyzer/compound-assignment-2.c: Moved to...
	* c-c++-common/analyzer/compound-assignment-2.c: ...here.
	* gcc.dg/analyzer/compound-assignment-3.c: Moved to...
	* c-c++-common/analyzer/compound-assignment-3.c: ...here.
	* gcc.dg/analyzer/compound-assignment-4.c: Moved to...
	* c-c++-common/analyzer/compound-assignment-4.c: ...here.
	* gcc.dg/analyzer/conditionals-3.c: Moved to...
	* c-c++-common/analyzer/conditionals-3.c: ...here.
	* gcc.dg/analyzer/conditionals-notrans.c: Moved to...
	* c-c++-common/analyzer/conditionals-notrans.c: ...here.
	* gcc.dg/analyzer/conditionals-trans.c: Moved to...
	* c-c++-common/analyzer/conditionals-trans.c: ...here.
	* gcc.dg/analyzer/data-model-1.c: Moved to...
	* c-c++-common/analyzer/data-model-1.c: ...here.
	* gcc.dg/analyzer/data-model-10.c: Moved to...
	* c-c++-common/analyzer/data-model-10.c: ...here.
	* gcc.dg/analyzer/data-model-12.c: Moved to...
	* c-c++-common/analyzer/data-model-12.c: ...here.
	* gcc.dg/analyzer/data-model-13.c: Moved to...
	* c-c++-common/analyzer/data-model-13.c: ...here.
	* gcc.dg/analyzer/data-model-14.c: Moved to...
	* c-c++-common/analyzer/data-model-14.c: ...here.
	* gcc.dg/analyzer/data-model-15.c: Moved to...
	* c-c++-common/analyzer/data-model-15.c: ...here.
	* gcc.dg/analyzer/data-model-16.c: Moved to...
	* c-c++-common/analyzer/data-model-16.c: ...here.
	* gcc.dg/analyzer/data-model-17.c: Moved to...
	* c-c++-common/analyzer/data-model-17.c: ...here.
	* gcc.dg/analyzer/data-model-18.c: Moved to...
	* c-c++-common/analyzer/data-model-18.c: ...here.
	* gcc.dg/analyzer/data-model-2.c: Moved to...
	* c-c++-common/analyzer/data-model-2.c: ...here.
	* gcc.dg/analyzer/data-model-20.c: Moved to...
	* c-c++-common/analyzer/data-model-20.c: ...here.
	* gcc.dg/analyzer/data-model-21.c: Moved to...
	* c-c++-common/analyzer/data-model-21.c: ...here.
	* gcc.dg/analyzer/data-model-22.c: Moved to...
	* c-c++-common/analyzer/data-model-22.c: ...here.
	* gcc.dg/analyzer/data-model-23.c: Moved to...
	* c-c++-common/analyzer/data-model-23.c: ...here.
	* gcc.dg/analyzer/data-model-4.c: Moved to...
	* c-c++-common/analyzer/data-model-4.c: ...here.
	* gcc.dg/analyzer/data-model-5.c: Moved to...
	* c-c++-common/analyzer/data-model-5.c: ...here.
	* gcc.dg/analyzer/data-model-5b.c: Moved to...
	* c-c++-common/analyzer/data-model-5b.c: ...here.
	* gcc.dg/analyzer/data-model-5c.c: Moved to...
	* c-c++-common/analyzer/data-model-5c.c: ...here.
	* gcc.dg/analyzer/data-model-5d.c: Moved to...
	* c-c++-common/analyzer/data-model-5d.c: ...here.
	* gcc.dg/analyzer/data-model-7.c: Moved to...
	* c-c++-common/analyzer/data-model-7.c: ...here.
	* gcc.dg/analyzer/data-model-8.c: Moved to...
	* c-c++-common/analyzer/data-model-8.c: ...here.
	* gcc.dg/analyzer/data-model-9.c: Moved to...
	* c-c++-common/analyzer/data-model-9.c: ...here.
	* gcc.dg/analyzer/data-model-path-1.c: Moved to...
	* c-c++-common/analyzer/data-model-path-1.c: ...here.
	* gcc.dg/analyzer/deref-before-check-1.c: Moved to...
	* c-c++-common/analyzer/deref-before-check-1.c: ...here.
	* gcc.dg/analyzer/deref-before-check-2.c: Moved to...
	* c-c++-common/analyzer/deref-before-check-2.c: ...here.
	* gcc.dg/analyzer/deref-before-check-macro-pr108745.c: Moved to...
	* c-c++-common/analyzer/deref-before-check-macro-pr108745.c: ...here.
	* gcc.dg/analyzer/deref-before-check-macro.c: Moved to...
	* c-c++-common/analyzer/deref-before-check-macro.c: ...here.
	* gcc.dg/analyzer/deref-before-check-qemu-qtest_rsp_args.c: Moved to...
	* c-c++-common/analyzer/deref-before-check-qemu-qtest_rsp_args.c: ...here.
	* gcc.dg/analyzer/describe-1.c: Moved to...
	* c-c++-common/analyzer/describe-1.c: ...here.
	* gcc.dg/analyzer/disabling.c: Moved to...
	* c-c++-common/analyzer/disabling.c: ...here.
	* gcc.dg/analyzer/doom-d_main-IdentifyVersion.c: Moved to...
	* c-c++-common/analyzer/doom-d_main-IdentifyVersion.c: ...here.
	* gcc.dg/analyzer/doom-s_sound-pr108867.c: Moved to...
	* c-c++-common/analyzer/doom-s_sound-pr108867.c: ...here.
	* gcc.dg/analyzer/double-free-lto-1-a.c: Moved to...
	* c-c++-common/analyzer/double-free-lto-1-a.c: ...here.
	* gcc.dg/analyzer/double-free-lto-1-b.c: Moved to...
	* c-c++-common/analyzer/double-free-lto-1-b.c: ...here.
	* gcc.dg/analyzer/double-free-lto-1.h: Moved to...
	* c-c++-common/analyzer/double-free-lto-1.h: ...here.
	* gcc.dg/analyzer/dump-state.c: Moved to...
	* c-c++-common/analyzer/dump-state.c: ...here.
	* gcc.dg/analyzer/edges-1.c: Moved to...
	* c-c++-common/analyzer/edges-1.c: ...here.
	* gcc.dg/analyzer/edges-2.c: Moved to...
	* c-c++-common/analyzer/edges-2.c: ...here.
	* gcc.dg/analyzer/equivalence.c: Moved to...
	* c-c++-common/analyzer/equivalence.c: ...here.
	* gcc.dg/analyzer/errno-1.c: Moved to...
	* c-c++-common/analyzer/errno-1.c: ...here.
	* gcc.dg/analyzer/errno-___errno.c: Moved to...
	* c-c++-common/analyzer/errno-___errno.c: ...here.
	* gcc.dg/analyzer/errno-__error.c: Moved to...
	* c-c++-common/analyzer/errno-__error.c: ...here.
	* gcc.dg/analyzer/errno-global-var.c: Moved to...
	* c-c++-common/analyzer/errno-global-var.c: ...here.
	* gcc.dg/analyzer/errno-pr107777.c: Moved to...
	* c-c++-common/analyzer/errno-pr107777.c: ...here.
	* gcc.dg/analyzer/error-1.c: Moved to...
	* c-c++-common/analyzer/error-1.c: ...here.
	* gcc.dg/analyzer/error-3.c: Moved to...
	* c-c++-common/analyzer/error-3.c: ...here.
	* gcc.dg/analyzer/error-uninit.c: Moved to...
	* c-c++-common/analyzer/error-uninit.c: ...here.
	* gcc.dg/analyzer/explode-1.c: Moved to...
	* c-c++-common/analyzer/explode-1.c: ...here.
	* gcc.dg/analyzer/explode-2.c: Moved to...
	* c-c++-common/analyzer/explode-2.c: ...here.
	* gcc.dg/analyzer/explode-2a.c: Moved to...
	* c-c++-common/analyzer/explode-2a.c: ...here.
	* gcc.dg/analyzer/explode-3.c: Moved to...
	* c-c++-common/analyzer/explode-3.c: ...here.
	* gcc.dg/analyzer/factorial.c: Moved to...
	* c-c++-common/analyzer/factorial.c: ...here.
	* gcc.dg/analyzer/fdump-analyzer-1.c: Moved to...
	* c-c++-common/analyzer/fdump-analyzer-1.c: ...here.
	* gcc.dg/analyzer/feasibility-1.c: Moved to...
	* c-c++-common/analyzer/feasibility-1.c: ...here.
	* gcc.dg/analyzer/feasibility-2.c: Moved to...
	* c-c++-common/analyzer/feasibility-2.c: ...here.
	* gcc.dg/analyzer/feasibility-4.c: Moved to...
	* c-c++-common/analyzer/feasibility-4.c: ...here.
	* gcc.dg/analyzer/feasibility-pr107582-1.c: Moved to...
	* c-c++-common/analyzer/feasibility-pr107582-1.c: ...here.
	* gcc.dg/analyzer/feasibility-pr107582-2.c: Moved to...
	* c-c++-common/analyzer/feasibility-pr107582-2.c: ...here.
	* gcc.dg/analyzer/feasibility-pr107948.c: Moved to...
	* c-c++-common/analyzer/feasibility-pr107948.c: ...here.
	* gcc.dg/analyzer/ferror-1.c: Moved to...
	* c-c++-common/analyzer/ferror-1.c: ...here.
	* gcc.dg/analyzer/fibonacci.c: Moved to...
	* c-c++-common/analyzer/fibonacci.c: ...here.
	* gcc.dg/analyzer/file-1.c: Moved to...
	* c-c++-common/analyzer/file-1.c: ...here.
	* gcc.dg/analyzer/file-3.c: Moved to...
	* c-c++-common/analyzer/file-3.c: ...here.
	* gcc.dg/analyzer/file-CWE-1341-example.c: Moved to...
	* c-c++-common/analyzer/file-CWE-1341-example.c: ...here.
	* gcc.dg/analyzer/file-meaning-1.c: Moved to...
	* c-c++-common/analyzer/file-meaning-1.c: ...here.
	* gcc.dg/analyzer/file-paths-1.c: Moved to...
	* c-c++-common/analyzer/file-paths-1.c: ...here.
	* gcc.dg/analyzer/malloc-1.c: Moved to...
	* c-c++-common/analyzer/malloc-1.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-10.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-10.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-12.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-12.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-13.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-13.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-13a.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-13a.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-8-double-free.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-8-double-free.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-8-lto-a.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-8-lto-a.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-8-lto-b.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-8-lto-b.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-8-lto-c.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-8-lto-c.c: ...here.
	* gcc.dg/analyzer/malloc-ipa-8-lto.h: Moved to...
	* c-c++-common/analyzer/malloc-ipa-8-lto.h: ...here.
	* gcc.dg/analyzer/malloc-ipa-9.c: Moved to...
	* c-c++-common/analyzer/malloc-ipa-9.c: ...here.
	* gcc.dg/analyzer/malloc-many-paths-1.c: Moved to...
	* c-c++-common/analyzer/malloc-many-paths-1.c: ...here.
	* gcc.dg/analyzer/malloc-many-paths-2.c: Moved to...
	* c-c++-common/analyzer/malloc-many-paths-2.c: ...here.
	* gcc.dg/analyzer/malloc-many-paths-3.c: Moved to...
	* c-c++-common/analyzer/malloc-many-paths-3.c: ...here.
	* gcc.dg/analyzer/malloc-meaning-1.c: Moved to...
	* c-c++-common/analyzer/malloc-meaning-1.c: ...here.
	* gcc.dg/analyzer/malloc-paths-1.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-1.c: ...here.
	* gcc.dg/analyzer/malloc-paths-10.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-10.c: ...here.
	* gcc.dg/analyzer/malloc-paths-2.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-2.c: ...here.
	* gcc.dg/analyzer/malloc-paths-3.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-3.c: ...here.
	* gcc.dg/analyzer/malloc-paths-4.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-4.c: ...here.
	* gcc.dg/analyzer/malloc-paths-5.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-5.c: ...here.
	* gcc.dg/analyzer/malloc-paths-6.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-6.c: ...here.
	* gcc.dg/analyzer/malloc-paths-7.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-7.c: ...here.
	* gcc.dg/analyzer/malloc-paths-8.c: Moved to...
	* c-c++-common/analyzer/malloc-paths-8.c: ...here.
	* gcc.dg/analyzer/malloc-reuse.c: Moved to...
	* c-c++-common/analyzer/malloc-reuse.c: ...here.
	* gcc.dg/analyzer/malloc-sarif-1.c: Moved to...
	* c-c++-common/analyzer/malloc-sarif-1.c: ...here.
	* gcc.dg/analyzer/malloc-vs-local-1a.c: Moved to...
	* c-c++-common/analyzer/malloc-vs-local-1a.c: ...here.
	* gcc.dg/analyzer/malloc-vs-local-1b.c: Moved to...
	* c-c++-common/analyzer/malloc-vs-local-1b.c: ...here.
	* gcc.dg/analyzer/malloc-vs-local-2.c: Moved to...
	* c-c++-common/analyzer/malloc-vs-local-2.c: ...here.
	* gcc.dg/analyzer/malloc-vs-local-3.c: Moved to...
	* c-c++-common/analyzer/malloc-vs-local-3.c: ...here.
	* gcc.dg/analyzer/malloc-vs-local-4.c: Moved to...
	* c-c++-common/analyzer/malloc-vs-local-4.c: ...here.
	* gcc.dg/analyzer/many-disabled-diagnostics.c: Moved to...
	* c-c++-common/analyzer/many-disabled-diagnostics.c: ...here.
	* gcc.dg/analyzer/many-unused-locals.c: Moved to...
	* c-c++-common/analyzer/many-unused-locals.c: ...here.
	* gcc.dg/analyzer/memcpy-1.c: Moved to...
	* c-c++-common/analyzer/memcpy-1.c: ...here.
	* gcc.dg/analyzer/memcpy-pr107882.c: Moved to...
	* c-c++-common/analyzer/memcpy-pr107882.c: ...here.
	* gcc.dg/analyzer/memmove-1.c: Moved to...
	* c-c++-common/analyzer/memmove-1.c: ...here.
	* gcc.dg/analyzer/memset-1.c: Moved to...
	* c-c++-common/analyzer/memset-1.c: ...here.
	* gcc.dg/analyzer/memset-2.c: Moved to...
	* c-c++-common/analyzer/memset-2.c: ...here.
	* gcc.dg/analyzer/memset-CVE-2017-18549-1.c: Moved to...
	* c-c++-common/analyzer/memset-CVE-2017-18549-1.c: ...here.
	* gcc.dg/analyzer/named-constants-Wunused-macros.c: Moved to...
	* c-c++-common/analyzer/named-constants-Wunused-macros.c: ...here.
	* gcc.dg/analyzer/named-constants-via-command-line.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-command-line.c: ...here.
	* gcc.dg/analyzer/named-constants-via-enum-and-macro.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-enum-and-macro.c: ...here.
	* gcc.dg/analyzer/named-constants-via-enum.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-enum.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-2.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-2.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-3.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-3.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-4.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-4.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-empty.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-empty.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-gc.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-gc.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-traditional.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-traditional.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros-undef.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros-undef.c: ...here.
	* gcc.dg/analyzer/named-constants-via-macros.c: Moved to...
	* c-c++-common/analyzer/named-constants-via-macros.c: ...here.
	* gcc.dg/analyzer/null-deref-pr102671-1.c: Moved to...
	* c-c++-common/analyzer/null-deref-pr102671-1.c: ...here.
	* gcc.dg/analyzer/null-deref-pr102671-2.c: Moved to...
	* c-c++-common/analyzer/null-deref-pr102671-2.c: ...here.
	* gcc.dg/analyzer/null-deref-pr105755.c: Moved to...
	* c-c++-common/analyzer/null-deref-pr105755.c: ...here.
	* gcc.dg/analyzer/null-terminated-strings-1.c: Moved to...
	* c-c++-common/analyzer/null-terminated-strings-1.c: ...here.
	* gcc.dg/analyzer/omp-parallel-for-1.c: Moved to...
	* c-c++-common/analyzer/omp-parallel-for-1.c: ...here.
	* gcc.dg/analyzer/omp-parallel-for-get-min.c: Moved to...
	* c-c++-common/analyzer/omp-parallel-for-get-min.c: ...here.
	* gcc.dg/analyzer/operations.c: Moved to...
	* c-c++-common/analyzer/operations.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-3.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-3.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-4.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-4.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-container_of.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-container_of.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-coreutils.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-coreutils.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-curl.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-curl.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-ascii.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-debug.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-emoji.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-json.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-json.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-sarif.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-1-unicode.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-10.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-10.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-12.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-12.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-13.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-13.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-14.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-14.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-15.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-15.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-16.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-16.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-17.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-17.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-18.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-18.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-19.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-19.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-2.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-2.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-4.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-4.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-6.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-6.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-diagram-9.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-diagram-9.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-multiline-1.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-multiline-1.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-multiline-2.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-multiline-2.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-pr110387.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-pr110387.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-read-char-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-read-char-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-read-int-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-read-int-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-read-struct-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-read-struct-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-realloc-grow.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-realloc-grow.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-write-char-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-write-char-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-write-int-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-write-int-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-write-struct-arr.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-write-struct-arr.c: ...here.
	* gcc.dg/analyzer/out-of-bounds-zero.c: Moved to...
	* c-c++-common/analyzer/out-of-bounds-zero.c: ...here.
	* gcc.dg/analyzer/params-2.c: Moved to...
	* c-c++-common/analyzer/params-2.c: ...here.
	* gcc.dg/analyzer/params.c: Moved to...
	* c-c++-common/analyzer/params.c: ...here.
	* gcc.dg/analyzer/paths-1.c: Moved to...
	* c-c++-common/analyzer/paths-1.c: ...here.
	* gcc.dg/analyzer/paths-1a.c: Moved to...
	* c-c++-common/analyzer/paths-1a.c: ...here.
	* gcc.dg/analyzer/paths-2.c: Moved to...
	* c-c++-common/analyzer/paths-2.c: ...here.
	* gcc.dg/analyzer/paths-3.c: Moved to...
	* c-c++-common/analyzer/paths-3.c: ...here.
	* gcc.dg/analyzer/paths-4.c: Moved to...
	* c-c++-common/analyzer/paths-4.c: ...here.
	* gcc.dg/analyzer/paths-5.c: Moved to...
	* c-c++-common/analyzer/paths-5.c: ...here.
	* gcc.dg/analyzer/paths-6.c: Moved to...
	* c-c++-common/analyzer/paths-6.c: ...here.
	* gcc.dg/analyzer/paths-7.c: Moved to...
	* c-c++-common/analyzer/paths-7.c: ...here.
	* gcc.dg/analyzer/paths-8.c: Moved to...
	* c-c++-common/analyzer/paths-8.c: ...here.
	* gcc.dg/analyzer/pattern-test-1.c: Moved to...
	* c-c++-common/analyzer/pattern-test-1.c: ...here.
	* gcc.dg/analyzer/pattern-test-2.c: Moved to...
	* c-c++-common/analyzer/pattern-test-2.c: ...here.
	* gcc.dg/analyzer/phi-2.c: Moved to...
	* c-c++-common/analyzer/phi-2.c: ...here.
	* gcc.dg/analyzer/pipe-1.c: Moved to...
	* c-c++-common/analyzer/pipe-1.c: ...here.
	* gcc.dg/analyzer/pipe-glibc.c: Moved to...
	* c-c++-common/analyzer/pipe-glibc.c: ...here.
	* gcc.dg/analyzer/pipe-manpages.c: Moved to...
	* c-c++-common/analyzer/pipe-manpages.c: ...here.
	* gcc.dg/analyzer/pipe-pr107486.c: Moved to...
	* c-c++-common/analyzer/pipe-pr107486.c: ...here.
	* gcc.dg/analyzer/pipe-void-return.c: Moved to...
	* c-c++-common/analyzer/pipe-void-return.c: ...here.
	* gcc.dg/analyzer/pipe2-1.c: Moved to...
	* c-c++-common/analyzer/pipe2-1.c: ...here.
	* gcc.dg/analyzer/pointer-merging.c: Moved to...
	* c-c++-common/analyzer/pointer-merging.c: ...here.
	* gcc.dg/analyzer/pr93032-mztools-simplified.c: Moved to...
	* c-c++-common/analyzer/pr93032-mztools-simplified.c: ...here.
	* gcc.dg/analyzer/pr93290.c: Moved to...
	* c-c++-common/analyzer/pr93290.c: ...here.
	* gcc.dg/analyzer/pr93352.c: Moved to...
	* c-c++-common/analyzer/pr93352.c: ...here.
	* gcc.dg/analyzer/pr93355-localealias-feasibility-2.c: Moved to...
	* c-c++-common/analyzer/pr93355-localealias-feasibility-2.c: ...here.
	* gcc.dg/analyzer/pr93355-localealias-feasibility-3.c: Moved to...
	* c-c++-common/analyzer/pr93355-localealias-feasibility-3.c: ...here.
	* gcc.dg/analyzer/pr93355-localealias-simplified.c: Moved to...
	* c-c++-common/analyzer/pr93355-localealias-simplified.c: ...here.
	* gcc.dg/analyzer/data-model-19.c: C only.
	* gcc.dg/analyzer/error-2.c: C only.
	* gcc.dg/analyzer/explode-4.c: C only.
	* gcc.dg/analyzer/file-2.c: C only.
	* gcc.dg/analyzer/pr93032-mztools-signed-char.c: C only.
	* gcc.dg/analyzer/pr93032-mztools-unsigned-char.c: C only.
	* gcc.dg/analyzer/pr93355-localealias.c: C only.
	* gcc.dg/analyzer/attr-format-1.c: Removed.
	* gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c: Removed.
	* gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c: Removed.
	* gcc.dg/analyzer/out-of-bounds-diagram-7.c: Removed.
	* c-c++-common/analyzer/attr-format-1.c: New test.
	* c-c++-common/analyzer/boxed-malloc-1-noexcept.c: Duplicate of
	gcc.dg/analyzer/boxed-malloc-1.c with exceptions disabled.
	* c-c++-common/analyzer/error-2-noexcept.c: Duplicate of
	gcc.dg/analyzer/error-2.c with exceptions disabled..
	* c-c++-common/analyzer/file-2-noexcept.c: Duplicate of
	gcc.dg/analyzer/file-2.c with exceptions disabled.
	* c-c++-common/analyzer/out-of-bounds-diagram-5-ascii.c: New test.
	* c-c++-common/analyzer/out-of-bounds-diagram-5-unicode.c: New test.
	* c-c++-common/analyzer/out-of-bounds-diagram-7.c: New test.

Signed-off-by: benjamin priour <vultkayn@gcc.gnu.org>
---
 gcc/analyzer/kf.cc                            |  39 ++
 gcc/c-family/c-common.cc                      | 110 ++++
 gcc/c-family/c-common.h                       |  29 +-
 gcc/c/c-parser.cc                             | 106 +---
 gcc/cp/parser.cc                              |   7 +
 .../analyzer/CVE-2005-1689-dedupe-issue-2.c   |  12 +-
 .../analyzer/CVE-2005-1689-dedupe-issue.c     |   0
 .../analyzer/CVE-2005-1689-minimal.c          |  22 +-
 .../analyzer/CWE-131-examples.c               |   2 +-
 .../analyzer/attr-alloc_size-3.c              |   0
 .../analyzer/attr-const-1.c                   |   2 +-
 .../analyzer/attr-const-2.c                   |   0
 .../analyzer/attr-const-3.c                   |   2 +-
 .../c-c++-common/analyzer/attr-format-1.c     |  37 ++
 .../analyzer/attr-malloc-1.c                  |   3 +-
 .../analyzer/attr-malloc-2.c                  |   0
 .../analyzer/attr-malloc-4.c                  |   0
 .../analyzer/attr-malloc-5.c                  |   0
 .../analyzer/attr-malloc-misuses.c            |   0
 .../analyzer/attr-malloc-pr108252.c           |   2 +-
 .../analyzer/attr-nonnull-pr106325.c          |  14 +-
 .../analyzer/attr-tainted_args-misuses.c      |   0
 .../analyzer/attribute-nonnull.c              |   8 +-
 .../analyzer/bitfields-1.c                    |   6 +-
 .../analyzer/boxed-malloc-1-noexcept.c        | 510 ++++++++++++++++++
 .../analyzer/builtins-pr107565.c              |   0
 .../analyzer/bzero-1.c                        |   2 +-
 .../analyzer/bzip2-arg-parse-1.c              |   2 +-
 .../analyzer/call-summaries-1.c               |   0
 .../analyzer/call-summaries-2.c               |   9 +-
 .../analyzer/call-summaries-3.c               |   2 +-
 .../analyzer/call-summaries-asm-x86.c         |   2 +-
 .../analyzer/call-summaries-errno.c           |   2 +-
 .../analyzer/call-summaries-pr107072.c        |   4 +
 .../analyzer/callbacks-1.c                    |   0
 .../analyzer/callbacks-2.c                    |   0
 .../analyzer/callbacks-3.c                    |   2 +-
 .../analyzer/capacity-2.c                     |   2 +-
 .../analyzer/capacity-3.c                     |   2 +-
 .../analyzer/casts-1.c                        |   2 +-
 .../analyzer/casts-2.c                        |   2 +-
 .../analyzer/clobbers-1.c                     |   2 +-
 .../analyzer/clobbers-2.c                     |   2 +-
 .../analyzer/combined-conditionals-1.c        |   4 +-
 .../analyzer/compound-assignment-2.c          |   9 +-
 .../analyzer/compound-assignment-3.c          |   6 +-
 .../analyzer/compound-assignment-4.c          |   2 +-
 .../analyzer/conditionals-3.c                 |   4 +-
 .../analyzer/conditionals-notrans.c           |   2 +-
 .../analyzer/conditionals-trans.c             |   2 +-
 .../analyzer/data-model-1.c                   |  16 +-
 .../analyzer/data-model-10.c                  |   6 +-
 .../analyzer/data-model-12.c                  |   0
 .../analyzer/data-model-13.c                  |   5 +-
 .../analyzer/data-model-14.c                  |   0
 .../analyzer/data-model-15.c                  |   2 +-
 .../analyzer/data-model-16.c                  |  12 +-
 .../analyzer/data-model-17.c                  |   2 +-
 .../analyzer/data-model-18.c                  |   2 +-
 .../analyzer/data-model-2.c                   |   0
 .../analyzer/data-model-20.c                  |   0
 .../analyzer/data-model-21.c                  |   0
 .../analyzer/data-model-22.c                  |   2 +-
 .../analyzer/data-model-23.c                  |   7 +-
 .../analyzer/data-model-4.c                   |   0
 .../analyzer/data-model-5.c                   |   0
 .../analyzer/data-model-5b.c                  |   0
 .../analyzer/data-model-5c.c                  |   0
 .../analyzer/data-model-5d.c                  |   2 +-
 .../analyzer/data-model-7.c                   |   4 +-
 .../analyzer/data-model-8.c                   |   2 +-
 .../analyzer/data-model-9.c                   |   6 +-
 .../analyzer/data-model-path-1.c              |   0
 .../analyzer/deref-before-check-1.c           |   8 +-
 .../analyzer/deref-before-check-2.c           |   0
 .../deref-before-check-macro-pr108745.c       |   2 +-
 .../analyzer/deref-before-check-macro.c       |   2 +-
 .../deref-before-check-qemu-qtest_rsp_args.c  |   2 +-
 .../analyzer/describe-1.c                     |   5 +-
 .../analyzer/disabling.c                      |   0
 .../analyzer/doom-d_main-IdentifyVersion.c    |  40 +-
 .../analyzer/doom-s_sound-pr108867.c          |  22 +-
 .../analyzer/double-free-lto-1-a.c            |   0
 .../analyzer/double-free-lto-1-b.c            |   0
 .../analyzer/double-free-lto-1.h              |   0
 .../analyzer/dump-state.c                     |   2 +-
 .../analyzer/edges-1.c                        |   0
 .../analyzer/edges-2.c                        |   0
 .../analyzer/equivalence.c                    |   2 +-
 .../analyzer/errno-1.c                        |   2 +-
 .../analyzer/errno-___errno.c                 |   2 +-
 .../analyzer/errno-__error.c                  |   2 +-
 .../analyzer/errno-global-var.c               |   2 +-
 .../analyzer/errno-pr107777.c                 |   0
 .../analyzer/error-1.c                        |  27 +-
 .../c-c++-common/analyzer/error-2-noexcept.c  |  49 ++
 .../analyzer/error-3.c                        |   0
 .../analyzer/error-uninit.c                   |   0
 .../analyzer/explode-1.c                      |   0
 .../analyzer/explode-2.c                      |   0
 .../analyzer/explode-2a.c                     |   0
 .../analyzer/explode-3.c                      |   0
 .../analyzer/factorial.c                      |   0
 .../analyzer/fdump-analyzer-1.c               |   0
 .../analyzer/feasibility-1.c                  |   2 +-
 .../analyzer/feasibility-2.c                  |   2 +-
 .../analyzer/feasibility-4.c                  |   2 +-
 .../analyzer/feasibility-pr107582-1.c         |   4 +-
 .../analyzer/feasibility-pr107582-2.c         |   4 +-
 .../analyzer/feasibility-pr107948.c           |   2 +-
 .../analyzer/ferror-1.c                       |   0
 .../analyzer/fibonacci.c                      |   0
 .../analyzer/file-1.c                         |   0
 .../c-c++-common/analyzer/file-2-noexcept.c   |  26 +
 .../analyzer/file-3.c                         |   0
 .../analyzer/file-CWE-1341-example.c          |   1 +
 .../analyzer/file-meaning-1.c                 |   0
 .../analyzer/file-paths-1.c                   |   4 +-
 .../analyzer/malloc-1.c                       |  48 +-
 .../analyzer/malloc-ipa-10.c                  |   0
 .../analyzer/malloc-ipa-12.c                  |   0
 .../analyzer/malloc-ipa-13.c                  |   3 +-
 .../analyzer/malloc-ipa-13a.c                 |   0
 .../analyzer/malloc-ipa-8-double-free.c       | 146 ++++-
 .../analyzer/malloc-ipa-8-lto-a.c             |   0
 .../analyzer/malloc-ipa-8-lto-b.c             |   0
 .../analyzer/malloc-ipa-8-lto-c.c             |   0
 .../analyzer/malloc-ipa-8-lto.h               |   0
 .../analyzer/malloc-ipa-9.c                   |   0
 .../analyzer/malloc-many-paths-1.c            |   0
 .../analyzer/malloc-many-paths-2.c            |   2 +-
 .../analyzer/malloc-many-paths-3.c            |   0
 .../analyzer/malloc-meaning-1.c               |   0
 .../analyzer/malloc-paths-1.c                 |   0
 .../analyzer/malloc-paths-10.c                |   4 +-
 .../analyzer/malloc-paths-2.c                 |   0
 .../analyzer/malloc-paths-3.c                 |   0
 .../analyzer/malloc-paths-4.c                 |   0
 .../analyzer/malloc-paths-5.c                 |   0
 .../analyzer/malloc-paths-6.c                 |   0
 .../analyzer/malloc-paths-7.c                 |   0
 .../analyzer/malloc-paths-8.c                 |   0
 .../analyzer/malloc-reuse.c                   |   2 +-
 .../analyzer/malloc-sarif-1.c                 |   0
 .../analyzer/malloc-vs-local-1a.c             |   2 +-
 .../analyzer/malloc-vs-local-1b.c             |   2 +-
 .../analyzer/malloc-vs-local-2.c              |   2 +-
 .../analyzer/malloc-vs-local-3.c              |   2 +-
 .../analyzer/malloc-vs-local-4.c              |   2 +-
 .../analyzer/many-disabled-diagnostics.c      |   0
 .../analyzer/many-unused-locals.c             |   0
 .../analyzer/memcpy-1.c                       |   3 +-
 .../analyzer/memcpy-pr107882.c                |   0
 .../analyzer/memmove-1.c                      |   4 +-
 .../analyzer/memset-1.c                       |   2 +-
 .../analyzer/memset-2.c                       |   2 +-
 .../analyzer/memset-CVE-2017-18549-1.c        |   6 +-
 .../analyzer/named-constants-Wunused-macros.c |   2 +-
 .../named-constants-via-command-line.c        |   2 +-
 .../named-constants-via-enum-and-macro.c      |   2 +-
 .../analyzer/named-constants-via-enum.c       |   2 +-
 .../analyzer/named-constants-via-macros-2.c   |   2 +-
 .../analyzer/named-constants-via-macros-3.c   |   2 +-
 .../analyzer/named-constants-via-macros-4.c   |   2 +-
 .../named-constants-via-macros-empty.c        |   2 +-
 .../analyzer/named-constants-via-macros-gc.c  |   2 +-
 .../named-constants-via-macros-traditional.c  |   2 +-
 .../named-constants-via-macros-undef.c        |   2 +-
 .../analyzer/named-constants-via-macros.c     |   2 +-
 .../analyzer/null-deref-pr102671-1.c          |  14 +-
 .../analyzer/null-deref-pr102671-2.c          |   4 +
 .../analyzer/null-deref-pr105755.c            |   4 +
 .../analyzer/null-terminated-strings-1.c      |  37 +-
 .../analyzer/omp-parallel-for-1.c             |   0
 .../analyzer/omp-parallel-for-get-min.c       |   0
 .../analyzer/operations.c                     |   2 +-
 .../analyzer/out-of-bounds-3.c                |   0
 .../analyzer/out-of-bounds-4.c                |  10 +-
 .../analyzer/out-of-bounds-container_of.c     |   2 +-
 .../analyzer/out-of-bounds-coreutils.c        |   0
 .../analyzer/out-of-bounds-curl.c             |   0
 .../analyzer/out-of-bounds-diagram-1-ascii.c  |  43 +-
 .../analyzer/out-of-bounds-diagram-1-debug.c  |  27 +-
 .../analyzer/out-of-bounds-diagram-1-emoji.c  |  42 +-
 .../analyzer/out-of-bounds-diagram-1-json.c   |   0
 .../analyzer/out-of-bounds-diagram-1-sarif.c  |   0
 .../out-of-bounds-diagram-1-unicode.c         |  42 +-
 .../analyzer/out-of-bounds-diagram-10.c       |   5 +-
 .../analyzer/out-of-bounds-diagram-12.c       |  40 +-
 .../analyzer/out-of-bounds-diagram-13.c       |  33 +-
 .../analyzer/out-of-bounds-diagram-14.c       |  88 ++-
 .../analyzer/out-of-bounds-diagram-15.c       |  33 +-
 .../analyzer/out-of-bounds-diagram-16.c       |   4 +-
 .../analyzer/out-of-bounds-diagram-17.c       |  24 +-
 .../analyzer/out-of-bounds-diagram-18.c       |  28 +-
 .../analyzer/out-of-bounds-diagram-19.c       |  24 +-
 .../analyzer/out-of-bounds-diagram-2.c        |  23 +-
 .../analyzer/out-of-bounds-diagram-4.c        |  30 +-
 .../analyzer/out-of-bounds-diagram-5-ascii.c  |  69 +++
 .../out-of-bounds-diagram-5-unicode.c         |  72 +++
 .../analyzer/out-of-bounds-diagram-6.c        |  91 +++-
 .../analyzer/out-of-bounds-diagram-7.c        |  62 +++
 .../analyzer/out-of-bounds-diagram-9.c        |  25 +-
 .../analyzer/out-of-bounds-multiline-1.c      |  20 +-
 .../analyzer/out-of-bounds-multiline-2.c      |  18 +-
 .../analyzer/out-of-bounds-pr110387.c         |   0
 .../analyzer/out-of-bounds-read-char-arr.c    |   0
 .../analyzer/out-of-bounds-read-int-arr.c     |   0
 .../analyzer/out-of-bounds-read-struct-arr.c  |   0
 .../analyzer/out-of-bounds-realloc-grow.c     |   4 +-
 .../analyzer/out-of-bounds-write-char-arr.c   |   0
 .../analyzer/out-of-bounds-write-int-arr.c    |   0
 .../analyzer/out-of-bounds-write-struct-arr.c |   0
 .../analyzer/out-of-bounds-zero.c             |   6 +-
 .../analyzer/params-2.c                       |   2 +-
 .../analyzer/params.c                         |   2 +-
 .../analyzer/paths-1.c                        |   2 +-
 .../analyzer/paths-1a.c                       |   2 +-
 .../analyzer/paths-2.c                        |   2 +-
 .../analyzer/paths-3.c                        |   2 +-
 .../analyzer/paths-4.c                        |   2 +-
 .../analyzer/paths-5.c                        |   2 +-
 .../analyzer/paths-6.c                        |   2 +-
 .../analyzer/paths-7.c                        |   2 +-
 .../analyzer/paths-8.c                        |   2 +-
 .../analyzer/pattern-test-1.c                 |   0
 .../analyzer/pattern-test-2.c                 |  10 +-
 .../{gcc.dg => c-c++-common}/analyzer/phi-2.c |   2 +-
 .../analyzer/pipe-1.c                         |   3 +-
 .../analyzer/pipe-glibc.c                     |   1 +
 .../analyzer/pipe-manpages.c                  |   2 +
 .../analyzer/pipe-pr107486.c                  |   0
 .../analyzer/pipe-void-return.c               |   1 +
 .../analyzer/pipe2-1.c                        |   3 +-
 .../analyzer/pointer-merging.c                |   0
 .../analyzer/pr93032-mztools-simplified.c     |   2 +-
 .../analyzer/pr93290.c                        |   0
 .../analyzer/pr93352.c                        |   0
 .../pr93355-localealias-feasibility-2.c       |   5 +-
 .../pr93355-localealias-feasibility-3.c       |   2 +-
 .../analyzer/pr93355-localealias-simplified.c |   2 +-
 gcc/testsuite/gcc.dg/analyzer/attr-format-1.c |  31 --
 gcc/testsuite/gcc.dg/analyzer/data-model-19.c |   2 +
 gcc/testsuite/gcc.dg/analyzer/error-2.c       |   7 +-
 gcc/testsuite/gcc.dg/analyzer/explode-4.c     |   2 +
 gcc/testsuite/gcc.dg/analyzer/file-2.c        |   7 +-
 .../analyzer/out-of-bounds-diagram-5-ascii.c  |  41 --
 .../out-of-bounds-diagram-5-unicode.c         |  43 --
 .../gcc.dg/analyzer/out-of-bounds-diagram-7.c |  37 --
 .../analyzer/pr93032-mztools-signed-char.c    |   6 +-
 .../analyzer/pr93032-mztools-unsigned-char.c  |   6 +-
 .../gcc.dg/analyzer/pr93355-localealias.c     |   4 +-
 252 files changed, 2135 insertions(+), 549 deletions(-)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/CVE-2005-1689-dedupe-issue-2.c (52%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/CVE-2005-1689-dedupe-issue.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/CVE-2005-1689-minimal.c (71%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/CWE-131-examples.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-alloc_size-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-const-1.c (99%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-const-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-const-3.c (93%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/attr-format-1.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-1.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-4.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-5.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-misuses.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-malloc-pr108252.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-nonnull-pr106325.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attr-tainted_args-misuses.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/attribute-nonnull.c (88%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/bitfields-1.c (97%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/boxed-malloc-1-noexcept.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/builtins-pr107565.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/bzero-1.c (82%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/bzip2-arg-parse-1.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-2.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-3.c (94%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-asm-x86.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-errno.c (83%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/call-summaries-pr107072.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/callbacks-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/callbacks-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/callbacks-3.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/capacity-2.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/capacity-3.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/casts-1.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/casts-2.c (84%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/clobbers-1.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/clobbers-2.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/combined-conditionals-1.c (95%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/compound-assignment-2.c (53%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/compound-assignment-3.c (57%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/compound-assignment-4.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/conditionals-3.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/conditionals-notrans.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/conditionals-trans.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-1.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-10.c (57%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-12.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-13.c (67%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-14.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-15.c (86%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-16.c (67%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-17.c (87%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-18.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-20.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-21.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-22.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-23.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-4.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-5.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-5b.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-5c.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-5d.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-7.c (84%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-8.c (87%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-9.c (78%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/data-model-path-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/deref-before-check-1.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/deref-before-check-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/deref-before-check-macro-pr108745.c (95%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/deref-before-check-macro.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/deref-before-check-qemu-qtest_rsp_args.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/describe-1.c (58%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/disabling.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/doom-d_main-IdentifyVersion.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/doom-s_sound-pr108867.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/double-free-lto-1-a.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/double-free-lto-1-b.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/double-free-lto-1.h (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/dump-state.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/edges-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/edges-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/equivalence.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/errno-1.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/errno-___errno.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/errno-__error.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/errno-global-var.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/errno-pr107777.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/error-1.c (58%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/error-2-noexcept.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/error-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/error-uninit.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/explode-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/explode-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/explode-2a.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/explode-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/factorial.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/fdump-analyzer-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-1.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-2.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-4.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-pr107582-1.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-pr107582-2.c (85%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/feasibility-pr107948.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/ferror-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/fibonacci.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/file-1.c (100%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/file-2-noexcept.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/file-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/file-CWE-1341-example.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/file-meaning-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/file-paths-1.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-1.c (88%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-10.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-12.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-13.c (68%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-13a.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-8-double-free.c (51%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-8-lto-a.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-8-lto-b.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-8-lto-c.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-8-lto.h (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-ipa-9.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-many-paths-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-many-paths-2.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-many-paths-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-meaning-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-10.c (85%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-2.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-4.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-5.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-6.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-7.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-paths-8.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-reuse.c (95%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-sarif-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-vs-local-1a.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-vs-local-1b.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-vs-local-2.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-vs-local-3.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/malloc-vs-local-4.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/many-disabled-diagnostics.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/many-unused-locals.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memcpy-1.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memcpy-pr107882.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memmove-1.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memset-1.c (99%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memset-2.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/memset-CVE-2017-18549-1.c (95%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-Wunused-macros.c (94%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-command-line.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-enum-and-macro.c (81%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-enum.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-2.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-3.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-4.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-empty.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-gc.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-traditional.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros-undef.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/named-constants-via-macros.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/null-deref-pr102671-1.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/null-deref-pr102671-2.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/null-deref-pr105755.c (98%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/null-terminated-strings-1.c (73%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/omp-parallel-for-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/omp-parallel-for-get-min.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/operations.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-3.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-4.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-container_of.c (90%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-coreutils.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-curl.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-ascii.c (52%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-debug.c (51%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-emoji.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-json.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-sarif.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-1-unicode.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-10.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-12.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-13.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-14.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-15.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-16.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-17.c (51%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-18.c (51%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-19.c (55%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-2.c (50%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-4.c (52%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-ascii.c
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-unicode.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-6.c (50%)
 create mode 100644 gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-7.c
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-diagram-9.c (54%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-multiline-1.c (64%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-multiline-2.c (62%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-pr110387.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-read-char-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-read-int-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-read-struct-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-realloc-grow.c (95%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-write-char-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-write-int-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-write-struct-arr.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/out-of-bounds-zero.c (91%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/params-2.c (83%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/params.c (94%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-1.c (81%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-1a.c (81%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-2.c (87%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-3.c (94%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-4.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-5.c (85%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-6.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-7.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/paths-8.c (85%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pattern-test-1.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pattern-test-2.c (77%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/phi-2.c (77%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe-1.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe-glibc.c (96%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe-manpages.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe-pr107486.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe-void-return.c (88%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pipe2-1.c (92%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pointer-merging.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93032-mztools-simplified.c (93%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93290.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93352.c (100%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93355-localealias-feasibility-2.c (89%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93355-localealias-feasibility-3.c (97%)
 rename gcc/testsuite/{gcc.dg => c-c++-common}/analyzer/pr93355-localealias-simplified.c (96%)
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/attr-format-1.c
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c
 delete mode 100644 gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c

Comments

David Malcolm Sept. 13, 2023, 10:14 p.m. UTC | #1
On Mon, 2023-09-11 at 19:44 +0200, priour.be@gmail.com wrote:
> From: benjamin priour <vultkayn@gcc.gnu.org>
> 
> Hi,
> 
> Patch below is mostly done, just have to check the formatting.
> Althought, I'd like your feedback on how to manage named_constants
> from enum in C++.
> 
> I've checked and the analyzer works as expected with them.
> However, C++ FE makes it so that given
> 
> enum
> {
>   NAMED = 0x1
> };
> 
> then in analyzer-language.cc:maybe_stash_named_constant
> 
>     tree t = tu.lookup_constant_by_id (id);
>     ...
>     logger->log ("%qs: %qE", name, t);
> 
> t is printed as 1 in C, but NAMED in C++.
> Should it be left as a "FE specifity",
> or should we aim for 1 in C++ as well ?

Thanks for the patch.

It seems that the patch consists of three parts:
(a) adding kf_bzero
(b) refactoring/moving c_translation_unit so it can be used by g++
(c) a whole bunch of tests being moved, some of which may depend on (a)
and (b); are there some that don't?

Given how big the (c) changes look like in a "diff", I'd prefer the (a)
and (b) changes to be split out as preliminaries, for readability.  

Presumably this change could be made part of (a):
 	* gcc.dg/analyzer/bzero-1.c: Moved to...
 	* c-c++-common/analyzer/bzero-1.c: ...here.

Does anything in the patch actually use (b)?  IIRC it's used by the
file-descriptor tests, so fd-*.c, pipe-*.c, etc.

As for your question, lookup_constant_by_id should return an
INTEGER_CST (or NULL_TREE), so presumably we want t to be printed as
'1' with both frontends.

Dave
diff mbox series

Patch

diff --git a/gcc/analyzer/kf.cc b/gcc/analyzer/kf.cc
index 92959891fe4..4b64d56494c 100644
--- a/gcc/analyzer/kf.cc
+++ b/gcc/analyzer/kf.cc
@@ -655,6 +655,43 @@  kf_memset::impl_call_pre (const call_details &cd) const
   cd.maybe_set_lhs (dest_sval);
 }
 
+/* Handler for "bzero" and "__builtin_bzero".  */
+
+class kf_bzero : public builtin_known_function
+{
+public:
+  bool matches_call_types_p (const call_details &cd) const final override
+  {
+    return (cd.num_args () == 2
+	    && cd.arg_is_pointer_p (0)
+	    && cd.arg_is_size_p (1));
+  }
+  enum built_in_function builtin_code () const final override
+  {
+    return BUILT_IN_BZERO;
+  }
+
+  void impl_call_pre (const call_details &cd) const final override;
+};
+
+void
+kf_bzero::impl_call_pre (const call_details &cd) const
+{
+  region_model *model = cd.get_model ();
+  region_model_manager *mgr = cd.get_manager ();
+  const svalue *dest_sval = cd.get_arg_svalue (0);
+  const svalue *size_sval = cd.get_arg_svalue (1);
+  const region *dest_reg
+    = model->deref_rvalue (dest_sval, cd.get_arg_tree (0), cd.get_ctxt ());
+
+  const region *sized_reg
+    = mgr->get_sized_region (dest_reg, NULL_TREE, size_sval);
+  model->check_region_for_write (sized_reg,
+				 nullptr,
+				 cd.get_ctxt ());
+  model->zero_fill_region (sized_reg, cd.get_ctxt ());
+}
+
 /* A subclass of pending_diagnostic for complaining about 'putenv'
    called on an auto var.  */
 
@@ -1852,6 +1889,8 @@  register_known_functions (known_function_manager &kfm)
   {
     kfm.add ("alloca", make_unique<kf_alloca> ());
     kfm.add ("__builtin_alloca", make_unique<kf_alloca> ());
+    kfm.add ("bzero", make_unique<kf_bzero> ());
+    kfm.add ("__builtin_bzero", make_unique<kf_bzero> ());
     kfm.add ("calloc", make_unique<kf_calloc> ());
     kfm.add ("__builtin_calloc", make_unique<kf_calloc> ());
     kfm.add ("free", make_unique<kf_free> ());
diff --git a/gcc/c-family/c-common.cc b/gcc/c-family/c-common.cc
index 73e739c503d..152666ddad6 100644
--- a/gcc/c-family/c-common.cc
+++ b/gcc/c-family/c-common.cc
@@ -581,6 +581,116 @@  const struct c_common_resword c_common_reswords[] =
 
 const unsigned int num_c_common_reswords = ARRAY_SIZE (c_common_reswords);
 
+#if ENABLE_ANALYZER
+
+extern enum cpp_ttype c_lex_with_flags (tree *, location_t *, unsigned char *,
+					int);
+
+namespace ana {
+
+/* Implementation of translation_unit::lookup_constant_by_id for use by the
+   analyzer to look up named constants in the user's source code.  */
+
+tree
+c_common_translation_unit::
+lookup_constant_by_id (tree id) const
+{
+  /* Consider decls.  */
+  if (tree decl = lookup_name (id))
+    if (TREE_CODE (decl) == CONST_DECL) // TEST constexpr evaluates to const_decl in c++
+      if (tree value = DECL_INITIAL (decl)) // value from enum type evaluate to their literal string
+	if (TREE_CODE (value) == INTEGER_CST) // why no REAL_TYPE ?
+	  return value;
+
+  /* Consider macros.  */
+  cpp_hashnode *hashnode = C_CPP_HASHNODE (id);
+  if (cpp_macro_p (hashnode))
+    if (tree value = consider_macro (hashnode->value.macro))
+      return value;
+
+  return NULL_TREE;
+}
+
+tree
+c_common_translation_unit::
+lookup_type_by_id (tree id) const
+{
+  /* lookup_name will be linked to its C or C++ implementation
+     depending on the actual FE.  */
+  if (tree type_decl = lookup_name (id))
+    if (TREE_CODE (type_decl) == TYPE_DECL)
+	{
+	  tree record_type = TREE_TYPE (type_decl);
+	  if (TREE_CODE (record_type) == RECORD_TYPE)
+	    return record_type;
+	}
+
+  return NULL_TREE;
+}
+
+tree
+c_common_translation_unit::
+lookup_global_var_by_id (tree id) const
+{
+  if (tree var_decl = lookup_name (id))
+    if (TREE_CODE (var_decl) == VAR_DECL)
+      return var_decl;
+
+  return NULL_TREE;
+}
+
+/* Attempt to get an INTEGER_CST from MACRO.
+   Only handle the simplest cases: where MACRO's definition is a single
+   token containing a number, by lexing the number again.
+   This will handle e.g.
+     #define NAME 42
+   and other bases but not negative numbers, parentheses or e.g.
+     #define NAME 1 << 7
+   as doing so would require a parser.  */
+
+tree
+c_common_translation_unit::consider_macro (cpp_macro *macro) const
+{
+  if (macro->paramc > 0)
+    return NULL_TREE;
+  if (macro->kind != cmk_macro)
+    return NULL_TREE;
+  if (macro->count != 1)
+    return NULL_TREE;
+  const cpp_token &tok = macro->exp.tokens[0];
+  if (tok.type != CPP_NUMBER)
+    return NULL_TREE;
+
+  cpp_reader *old_parse_in = parse_in;
+  parse_in = cpp_create_reader (CLK_GNUC89, NULL, line_table);
+
+  pretty_printer pp;
+  pp_string (&pp, (const char *) tok.val.str.text);
+  pp_newline (&pp);
+  cpp_push_buffer (parse_in,
+		   (const unsigned char *) pp_formatted_text (&pp),
+		   strlen (pp_formatted_text (&pp)),
+		   0);
+
+  tree value;
+  location_t loc;
+  unsigned char cpp_flags;
+  /* c_lex_with_flags is part of c-family.  */
+  c_lex_with_flags (&value, &loc, &cpp_flags, 0);
+
+  cpp_destroy (parse_in);
+  parse_in = old_parse_in;
+
+  if (value && TREE_CODE (value) == INTEGER_CST)
+    return value;
+
+  return NULL_TREE;
+}
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
+
 /* Return identifier for address space AS.  */
 
 const char *
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 1fdba7ef3ea..a5ff1c44ff1 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -26,7 +26,6 @@  along with GCC; see the file COPYING3.  If not see
 #include "tree.h"
 #include "fold-const.h"
 #include "wide-int-bitmask.h"
-
 /* In order for the format checking to accept the C frontend
    diagnostic framework extensions, you must include this file before
    diagnostic-core.h, not after.  The C front end formats are a subset of those
@@ -42,6 +41,7 @@  never after.
 #define GCC_DIAG_STYLE __gcc_cdiag__
 #endif
 #include "diagnostic-core.h"
+#include "analyzer/analyzer-language.h"
 
 /* Usage of TREE_LANG_FLAG_?:
    0: IDENTIFIER_MARKED (used by search routines).
@@ -795,6 +795,33 @@  gnu_vector_type_p (const_tree type)
   return VECTOR_TYPE_P (type) && !TYPE_INDIVISIBLE_P (type);
 }
 
+#if ENABLE_ANALYZER
+
+namespace ana {
+
+/* Concrete implementation of ana::translation_unit for the C-family FE.  */
+
+class c_common_translation_unit : public translation_unit
+{
+public:
+  /* Implementation of translation_unit::lookup_constant_by_id for use by the
+     analyzer to look up named constants in the user's source code.  */
+  tree lookup_constant_by_id (tree id) const final override;
+
+  tree
+  lookup_type_by_id (tree id) const final override;
+
+  tree
+  lookup_global_var_by_id (tree id) const final override;
+
+private:
+  tree consider_macro (cpp_macro *macro) const;
+};
+
+} // namespace ana
+
+#endif /* #if ENABLE_ANALYZER */
+
 struct visibility_flags
 {
   unsigned inpragma : 1;	/* True when in #pragma GCC visibility.  */
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index c04962d67a4..4f870f6972b 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -72,7 +72,6 @@  along with GCC; see the file COPYING3.  If not see
 #include "memmodel.h"
 #include "c-family/known-headers.h"
 #include "bitmap.h"
-#include "analyzer/analyzer-language.h"
 #include "toplev.h"
 
 /* We need to walk over decls with incomplete struct/union/enum types
@@ -1713,109 +1712,6 @@  static bool c_parser_objc_diagnose_bad_element_prefix
   (c_parser *, struct c_declspecs *);
 static location_t c_parser_parse_rtl_body (c_parser *, char *);
 
-#if ENABLE_ANALYZER
-
-namespace ana {
-
-/* Concrete implementation of ana::translation_unit for the C frontend.  */
-
-class c_translation_unit : public translation_unit
-{
-public:
-  /* Implementation of translation_unit::lookup_constant_by_id for use by the
-     analyzer to look up named constants in the user's source code.  */
-  tree lookup_constant_by_id (tree id) const final override
-  {
-    /* Consider decls.  */
-    if (tree decl = lookup_name (id))
-      if (TREE_CODE (decl) == CONST_DECL)
-	if (tree value = DECL_INITIAL (decl))
-	  if (TREE_CODE (value) == INTEGER_CST)
-	    return value;
-
-    /* Consider macros.  */
-    cpp_hashnode *hashnode = C_CPP_HASHNODE (id);
-    if (cpp_macro_p (hashnode))
-      if (tree value = consider_macro (hashnode->value.macro))
-	return value;
-
-    return NULL_TREE;
-  }
-
-  tree
-  lookup_type_by_id (tree id) const final override
-  {
-    if (tree type_decl = lookup_name (id))
-	if (TREE_CODE (type_decl) == TYPE_DECL)
-	  {
-	    tree record_type = TREE_TYPE (type_decl);
-	    if (TREE_CODE (record_type) == RECORD_TYPE)
-	      return record_type;
-	  }
-
-    return NULL_TREE;
-  }
-
-  tree
-  lookup_global_var_by_id (tree id) const final override
-  {
-    if (tree var_decl = lookup_name (id))
-      if (TREE_CODE (var_decl) == VAR_DECL)
-				return var_decl;
-
-    return NULL_TREE;
-  }
-
-private:
-  /* Attempt to get an INTEGER_CST from MACRO.
-     Only handle the simplest cases: where MACRO's definition is a single
-     token containing a number, by lexing the number again.
-     This will handle e.g.
-       #define NAME 42
-     and other bases but not negative numbers, parentheses or e.g.
-       #define NAME 1 << 7
-     as doing so would require a parser.  */
-  tree consider_macro (cpp_macro *macro) const
-  {
-    if (macro->paramc > 0)
-      return NULL_TREE;
-    if (macro->kind != cmk_macro)
-      return NULL_TREE;
-    if (macro->count != 1)
-      return NULL_TREE;
-    const cpp_token &tok = macro->exp.tokens[0];
-    if (tok.type != CPP_NUMBER)
-      return NULL_TREE;
-
-    cpp_reader *old_parse_in = parse_in;
-    parse_in = cpp_create_reader (CLK_GNUC89, NULL, line_table);
-
-    pretty_printer pp;
-    pp_string (&pp, (const char *) tok.val.str.text);
-    pp_newline (&pp);
-    cpp_push_buffer (parse_in,
-		     (const unsigned char *) pp_formatted_text (&pp),
-		     strlen (pp_formatted_text (&pp)),
-		     0);
-
-    tree value;
-    location_t loc;
-    unsigned char cpp_flags;
-    c_lex_with_flags (&value, &loc, &cpp_flags, 0);
-
-    cpp_destroy (parse_in);
-    parse_in = old_parse_in;
-
-    if (value && TREE_CODE (value) == INTEGER_CST)
-      return value;
-
-    return NULL_TREE;
-  }
-};
-
-} // namespace ana
-
-#endif /* #if ENABLE_ANALYZER */
 
 /* Parse a translation unit (C90 6.7, C99 6.9, C11 6.9).
 
@@ -1881,7 +1777,7 @@  c_parser_translation_unit (c_parser *parser)
 #if ENABLE_ANALYZER
   if (flag_analyzer)
     {
-      ana::c_translation_unit tu;
+      ana::c_common_translation_unit tu;
       ana::on_finish_translation_unit (tu);
     }
 #endif
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc
index 8808da3a842..9f6cd2ff6f7 100644
--- a/gcc/cp/parser.cc
+++ b/gcc/cp/parser.cc
@@ -5201,6 +5201,13 @@  cp_parser_translation_unit (cp_parser* parser)
   /* Make sure the declarator obstack was fully cleaned up.  */
   gcc_assert (obstack_next_free (&declarator_obstack)
 	      == declarator_obstack_base);
+#if ENABLE_ANALYZER
+  if (flag_analyzer)
+    {
+      ana::c_common_translation_unit tu;
+      ana::on_finish_translation_unit (tu);
+    }
+#endif
 }
 
 /* Return the appropriate tsubst flags for parsing, possibly in N3276
diff --git a/gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue-2.c b/gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-dedupe-issue-2.c
similarity index 52%
rename from gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue-2.c
rename to gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-dedupe-issue-2.c
index 57fd30add7b..435d50f5d72 100644
--- a/gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-dedupe-issue-2.c
@@ -13,10 +13,14 @@  void
 recvauth_common(krb5_data common)
 {
   free(common.data);
-  free(common.data); /* { dg-warning "double-'free' of 'common.data'" "inner warning" } */
-  /* { dg-warning "double-'free' of 'inbuf_a.data' " "inbuf_a warning" { target *-*-* } .-1 } */
-  /* { dg-warning "double-'free' of 'inbuf_b.data' " "inbuf_b warning" { target *-*-* } .-2 } */
-  /* { dg-message "2 duplicates" "duplicates notification" { xfail *-*-* } .-3 } */
+  free(common.data); /* { dg-line double_free } */
+  /* { dg-warning "double-'free' of 'common.data'" "inner warning" { target c } double_free } */
+  /* { dg-warning "double-'free' of 'common._krb5_data::data'" "inner warning" { target c++ } double_free } */
+  /* { dg-warning "double-'free' of 'inbuf_a.data' " "inbuf_a warning" { target c } double_free } */
+  /* { dg-warning "double-'free' of 'inbuf_a._krb5_data::data' " "inbuf_a warning" { target c++ } double_free } */
+  /* { dg-warning "double-'free' of 'inbuf_b.data' " "inbuf_b warning" { target c } double_free } */
+  /* { dg-warning "double-'free' of 'inbuf_b._krb5_data::data' " "inbuf_b warning" { target c++ } double_free } */
+  /* { dg-message "2 duplicates" "duplicates notification" { xfail *-*-* } double_free } */
 }
 
 void krb5_recvauth(krb5_data inbuf_a)
diff --git a/gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c b/gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-dedupe-issue.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-dedupe-issue.c
rename to gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-dedupe-issue.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-minimal.c b/gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-minimal.c
similarity index 71%
rename from gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-minimal.c
rename to gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-minimal.c
index 5edbdb1cc3e..1f214e10fe4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/CVE-2005-1689-minimal.c
+++ b/gcc/testsuite/c-c++-common/analyzer/CVE-2005-1689-minimal.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef struct _krb5_data {
   char *data;
@@ -9,7 +9,8 @@  void
 test_1 (krb5_data inbuf, int flag)
 {
   free(inbuf.data); /* { dg-message "first 'free' here" } */
-  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" } */
+  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._krb5_data::data'" "" { target c++ } .-1 } */
 }
 
 void
@@ -18,7 +19,8 @@  test_2 (krb5_data inbuf, int flag)
   if (flag) {
     free(inbuf.data); /* { dg-message "first 'free' here" } */
   }
-  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" } */
+  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._krb5_data::data'" "" { target c++ } .-1 } */
 }
 
 void
@@ -27,7 +29,8 @@  test_3 (krb5_data inbuf, int flag)
   if (flag) {
     free((char *)inbuf.data); /* { dg-message "first 'free' here" } */
   }
-  free((char *)inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" } */
+  free((char *)inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._krb5_data::data'" "" { target c++ } .-1 } */
 }
 
 extern void unknown_fn (void *);
@@ -37,7 +40,8 @@  test_4 (krb5_data inbuf)
 {
   unknown_fn (NULL);
   free(inbuf.data); /* { dg-message "first 'free' here" } */
-  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" } */
+  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._krb5_data::data'" "" { target c++ } .-1 } */
 }
 
 void
@@ -45,8 +49,9 @@  test_5 (krb5_data inbuf)
 {
   unknown_fn (&inbuf);
   free(inbuf.data); /* { dg-message "first 'free' here" } */
-  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "inbuf.data" } */
-  /* { dg-bogus "double-'free' of 'inbuf'" "inbuf" { target *-*-* } .-1 } */
+  free(inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "inbuf.data" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._krb5_data::data'" "inbuf.data" { target c++ } .-1 } */
+  /* { dg-bogus "double-'free' of 'inbuf'" "inbuf" { target *-*-* } .-2 } */
 }
 
 typedef struct _padded_krb5_data {
@@ -59,7 +64,8 @@  test_6 (padded_krb5_data inbuf)
 {
   unknown_fn (&inbuf.data);
   free((char *)inbuf.data); /* { dg-message "first 'free' here" } */
-  free((char *)inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "inbuf.data" } */
+  free((char *)inbuf.data); /* { dg-warning "double-'free' of 'inbuf.data'" "inbuf.data" { target c } } */
+  /* { dg-warning "double-'free' of 'inbuf._padded_krb5_data::data'" "inbuf.data" { target c++ } .-1 } */
 }
 
 void
diff --git a/gcc/testsuite/gcc.dg/analyzer/CWE-131-examples.c b/gcc/testsuite/c-c++-common/analyzer/CWE-131-examples.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/CWE-131-examples.c
rename to gcc/testsuite/c-c++-common/analyzer/CWE-131-examples.c
index 3bc898cd0cc..4801de41efd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/CWE-131-examples.c
+++ b/gcc/testsuite/c-c++-common/analyzer/CWE-131-examples.c
@@ -127,7 +127,7 @@  void example_4 (DataPacket *packet)
   if (numHeaders > 100) {
     ExitError("too many headers!");
   }
-  headers = malloc(numHeaders * sizeof(PacketHeader)); /* TODO: ideally we'd warn about possible overflow here with negative numHeaders.  */
+  headers = (PacketHeader *) malloc(numHeaders * sizeof(PacketHeader)); /* TODO: ideally we'd warn about possible overflow here with negative numHeaders.  */
   ParsePacketHeaders(packet, headers);
 }
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-alloc_size-3.c b/gcc/testsuite/c-c++-common/analyzer/attr-alloc_size-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-alloc_size-3.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-alloc_size-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-const-1.c b/gcc/testsuite/c-c++-common/analyzer/attr-const-1.c
similarity index 99%
rename from gcc/testsuite/gcc.dg/analyzer/attr-const-1.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-const-1.c
index 39e813f14c6..d122fabfeff 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-const-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-const-1.c
@@ -1,6 +1,6 @@ 
 /* Verify that we handle functions with __attribute__ ((const)) correctly.  */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int nonconst_fn (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-const-2.c b/gcc/testsuite/c-c++-common/analyzer/attr-const-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-const-2.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-const-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-const-3.c b/gcc/testsuite/c-c++-common/analyzer/attr-const-3.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/attr-const-3.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-const-3.c
index fc8527a5d0e..46296911bfd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-const-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-const-3.c
@@ -3,7 +3,7 @@ 
 
 /* { dg-additional-options "--param analyzer-max-svalue-depth=4" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int const_fn_1 (int) __attribute__ ((const));
 
diff --git a/gcc/testsuite/c-c++-common/analyzer/attr-format-1.c b/gcc/testsuite/c-c++-common/analyzer/attr-format-1.c
new file mode 100644
index 00000000000..3a0ec78ae4e
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-format-1.c
@@ -0,0 +1,37 @@ 
+/* { dg-additional-options "-fpermissive" { target c++ } } */
+
+extern int
+my_printf (void *my_object, const char *my_format, ...)
+  __attribute__ ((format (printf, 2, 3)));
+/* { dg-message "parameter 2 of 'my_printf' marked as a format string via 'format' attribute" "attr note" { target c } .-2 } */
+/* { dg-message "parameter 2 of 'int my_printf\\(void\\*, const char\\*, \\.\\.\\.\\)' marked as a format string via 'format' attribute" "attr note" { target c++ } .-3 } */
+/* { dg-message "argument 2 of 'my_printf' must be a pointer to a null-terminated string" "arg note" { target c } .-4 } */
+/* { dg-message "argument 2 of 'int my_printf\\(void\\*, const char\\*, \\.\\.\\.\\)' must be a pointer to a null-terminated string" "arg note" { target c++ } .-5 } */
+
+int test_empty (void *my_object, const char *msg)
+{
+  return my_printf (my_object, "");
+}
+
+int test_percent_s (void *my_object, const char *msg)
+{
+  return my_printf (my_object, "%s\n", msg);
+}
+
+int
+test_unterminated_format (void *my_object)
+{
+  char fmt[3] = "abc"; /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "" { target c++ } } */
+  return my_printf (my_object, fmt); /* { dg-warning "stack-based buffer over-read" } */
+  /* { dg-message "while looking for null terminator for argument 2 \\('&fmt'\\) of 'my_printf'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 2 \\('& fmt'\\) of 'int my_printf\\(void\\*, const char\\*, \\.\\.\\.\\)'..." "event" { target c++ } .-2 } */
+}
+
+int
+test_uninitialized_format (void *my_object)
+{
+  char fmt[10];
+  return my_printf (my_object, fmt); /* { dg-warning "use of uninitialized value 'fmt\\\[0\\\]'" } */  
+  /* { dg-message "while looking for null terminator for argument 2 \\('&fmt'\\) of 'my_printf'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 2 \\('& fmt'\\) of 'int my_printf\\(void\\*, const char\\*, \\.\\.\\.\\)'..." "event" { target c++ } .-2 } */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-1.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-1.c
index e956cf5fda6..f9fb810308d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-1.c
@@ -71,7 +71,8 @@  void test_7 ()
 {
   struct foo f;
   foo_release (&f); /* { dg-warning "on the stack" "analyzer" } */
-  /* { dg-warning "'foo_release' called on unallocated object 'f'" "non-analyzer" { target *-*-* } .-1 } */
+  /* { dg-warning "'foo_release' called on unallocated object 'f'" "non-analyzer" { target c } .-1 } */
+  /* { dg-warning "'void foo_release\\(foo\\*\\)' called on unallocated object 'f'" "non-analyzer" { target c++ } .-2 } */
 }
 
 int test_8 (struct foo *p)
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-2.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-2.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-4.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-4.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-4.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-5.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-5.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-5.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-misuses.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-misuses.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-misuses.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-misuses.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-pr108252.c b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-pr108252.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/attr-malloc-pr108252.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-malloc-pr108252.c
index 5e3437985cb..14dc5b82739 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-malloc-pr108252.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-malloc-pr108252.c
@@ -7,7 +7,7 @@  extern void foo_release (struct foo *);
 extern struct foo *foo_acquire (void)
   __attribute__ ((malloc (foo_release)));
 
-struct {
+static struct {
   /* [...snip...] */
   struct foo *listen_default_ciphers;
   struct foo *connect_default_ciphers;
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-nonnull-pr106325.c b/gcc/testsuite/c-c++-common/analyzer/attr-nonnull-pr106325.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/attr-nonnull-pr106325.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-nonnull-pr106325.c
index 3b264719f6d..d266433210f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attr-nonnull-pr106325.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attr-nonnull-pr106325.c
@@ -1,3 +1,7 @@ 
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
+
 typedef long int signed_frame_t;
 
 typedef struct Track Track;
@@ -140,7 +144,7 @@  get_position_ptr (ArrangerObject *self, ArrangerObjectPositionType pos_type)
     case ARRANGER_OBJECT_POSITION_TYPE_FADE_OUT:
       return &self->fade_out_pos;
     }
-  return (((void *)0));
+  return ((Position *)((void *)0));
 }
 
 void
@@ -182,10 +186,10 @@  arranger_object_clone (const ArrangerObject *self)
   if (!self)
     {
       g_return_if_fail_warning ("zrythm", ((const char *)(__func__)), "self");
-      return (((void *)0));
+      return ((ArrangerObject *)((void *)0));
     }
   /* .... */
-  return (((void *)0));
+  return ((ArrangerObject *)((void *)0));
 }
 
 __attribute__((nonnull(1, 2)))
@@ -201,7 +205,7 @@  arranger_object_unsplit (ArrangerObject *r1, ArrangerObject *r2,
       || clip_editor_region == (ZRegion *)r2)
     {
       set_clip_editor_region = 1;
-      clip_editor_set_region (((zrythm)->project->clip_editor), ((void *)0),
+      clip_editor_set_region (((zrythm)->project->clip_editor), ((ZRegion *)0),
                               1);
     }
 
@@ -219,7 +223,7 @@  arranger_object_unsplit (ArrangerObject *r1, ArrangerObject *r2,
     case ARRANGER_OBJECT_TYPE_REGION:
       {
         ZRegion *r1_region = (ZRegion *)r1;
-        AutomationTrack *at = ((void *)0);
+        AutomationTrack *at = ((AutomationTrack *)0);
         if (r1_region->id.type == REGION_TYPE_AUTOMATION)
           {
             at = region_get_automation_track (r1_region);
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-tainted_args-misuses.c b/gcc/testsuite/c-c++-common/analyzer/attr-tainted_args-misuses.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/attr-tainted_args-misuses.c
rename to gcc/testsuite/c-c++-common/analyzer/attr-tainted_args-misuses.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/attribute-nonnull.c b/gcc/testsuite/c-c++-common/analyzer/attribute-nonnull.c
similarity index 88%
rename from gcc/testsuite/gcc.dg/analyzer/attribute-nonnull.c
rename to gcc/testsuite/c-c++-common/analyzer/attribute-nonnull.c
index 5700256c06a..ec7446683c2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/attribute-nonnull.c
+++ b/gcc/testsuite/c-c++-common/analyzer/attribute-nonnull.c
@@ -1,11 +1,13 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 #include <stdlib.h>
 
-extern void foo(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'foo' must be non-null" } */
+extern void foo(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'foo' must be non-null" "" { target c } } */
+  /* { dg-message "argument 1 of 'void foo\\(void\\*, void\\*, void\\*\\)' must be non-null" "" { target c++ } .-1 } */
   __attribute__((nonnull (1, 3)));
 
-extern void bar(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'bar' must be non-null" } */
+extern void bar(void *ptrA, void *ptrB, void *ptrC) /* { dg-message "argument 1 of 'bar' must be non-null" "" { target c } } */
+  /* { dg-message "argument 1 of 'void bar\\(void\\*, void\\*, void\\*\\)' must be non-null" "" { target c++ } .-1 } */
   __attribute__((nonnull));
 
 // TODO: complain about NULL and possible NULL args
diff --git a/gcc/testsuite/gcc.dg/analyzer/bitfields-1.c b/gcc/testsuite/c-c++-common/analyzer/bitfields-1.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/bitfields-1.c
rename to gcc/testsuite/c-c++-common/analyzer/bitfields-1.c
index 8bbe76bdbf3..8cf1de9059c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/bitfields-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/bitfields-1.c
@@ -1,4 +1,8 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
 
 typedef unsigned char u8;
 typedef unsigned __INT16_TYPE__ u16;
diff --git a/gcc/testsuite/c-c++-common/analyzer/boxed-malloc-1-noexcept.c b/gcc/testsuite/c-c++-common/analyzer/boxed-malloc-1-noexcept.c
new file mode 100644
index 00000000000..f44c9dc74aa
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/boxed-malloc-1-noexcept.c
@@ -0,0 +1,510 @@ 
+/* Adapted from malloc-1.c, but wrapping the pointers in a struct.  */
+
+/* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-fpermissive -fno-exceptions" { target c++ } } */
+
+#include <stdlib.h>
+
+extern int foo (void);
+extern int bar (void);
+extern void could_free (void *);
+extern void cant_free (const void *); /* since it's a const void *.  */
+
+typedef struct boxed_ptr { void *value; } boxed_ptr;
+
+boxed_ptr
+boxed_malloc (size_t sz)
+{
+  boxed_ptr result;
+  result.value = malloc (sz);
+  return result;
+}
+
+void boxed_free (boxed_ptr ptr)
+{
+  free (ptr.value);
+}
+
+const boxed_ptr boxed_null = {NULL};
+
+void test_1 (void)
+{
+  boxed_ptr ptr;
+  ptr.value = malloc (1024);
+  free (ptr.value);
+  free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_2 (boxed_ptr ptr)
+{
+  free (ptr.value);
+  free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+boxed_ptr
+test_3 (void)
+{
+  boxed_ptr ptr;
+  ptr.value = malloc (sizeof (int));
+  *(int *)ptr.value = 42; /* { dg-warning "dereference of possibly-NULL 'ptr.value' \\\[CWE-690\\\]" "" { target c } } */
+  /* { dg-warning "dereference of possibly-NULL 'ptr.boxed_ptr::value' \\\[CWE-690\\\]" "" { target c++ } .-1 } */
+  return ptr;
+}
+
+boxed_ptr
+test_4 (void)
+{
+  boxed_ptr ptr;
+  ptr.value = malloc (sizeof (int));
+  int *iptr = (int *)ptr.value;
+  if (iptr)
+    *iptr = 42;
+  else
+    *iptr = 43; /* { dg-warning "dereference of NULL 'iptr' \\\[CWE-476\\\]" } */
+  return ptr;
+}
+
+int test_5 (boxed_ptr ptr)
+{
+  free (ptr.value);
+  return *(int *)ptr.value; /* { dg-warning "use after 'free' of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "use after 'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_6 (void *ptr)
+{
+  boxed_ptr q;
+  q.value = ptr;
+  free (ptr);
+  free (q.value); /* { dg-warning "double-'free' of 'ptr'" } */
+}
+
+void test_6a (boxed_ptr ptr)
+{
+  boxed_ptr q;
+  q = ptr;
+  boxed_free (ptr);
+  free (q.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_7 (void)
+{
+  boxed_ptr ptr = boxed_malloc(4096);
+  if (!ptr.value)
+    return;
+  __builtin_memset(ptr.value, 0, 4096);
+  boxed_free(ptr);
+}
+
+boxed_ptr test_8 (void)
+{
+  boxed_ptr ptr = boxed_malloc(4096);
+  if (!ptr.value)
+    return boxed_null;
+  __builtin_memset(ptr.value, 0, 4096);
+  return ptr;
+}
+
+void test_9 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+
+  int i;
+  for (i = 0; i < 1024; i++)
+    free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+    /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_10 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+
+  int i;
+  for (i = 0; i < 1024; i++)
+    foo ();
+
+  free (ptr.value);
+  free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */ 
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */ 
+}
+
+void test_11 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+
+  while (foo ())
+    bar ();
+
+  free (ptr.value);
+  free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_12 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+
+  while (1)
+    {
+      free (ptr.value);
+      free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */
+      /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+    }
+}
+
+void test_13 (void)
+{
+  boxed_ptr p = boxed_malloc (1024);
+  boxed_ptr q = boxed_malloc (1024);
+
+  foo ();
+  if (!q.value)
+    {
+      boxed_free (q);
+      return; /* { dg-warning "leak of 'p.value'" "" { target c } } */ 
+      /* { dg-warning "leak of 'p.boxed_ptr::value'" "" { target c++ } .-1 } */
+    }
+  bar ();
+  boxed_free (q);
+  boxed_free (p);
+}
+
+void test_14 (void)
+{
+  boxed_ptr p, q;
+  p = boxed_malloc (1024);
+  if (!p.value)
+    return;
+
+  q = boxed_malloc (1024);
+  if (!q.value)
+    {
+      boxed_free (p);
+      boxed_free (q);
+      /* oops: missing "return".  */
+    }
+  bar ();
+  boxed_free (q); /* Although this looks like a double-'free' of q,
+	       it's known to be NULL for the case where free is
+	       called twice on it.  */
+  free (p.value); /* { dg-warning "double-'free' of 'p.value'" "" { target c } } */
+  /* { dg-warning "double-'free' of 'p.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_15 (void)
+{
+  boxed_ptr p, q;
+  p.value = NULL;
+  q.value = NULL;
+
+  p = boxed_malloc (1024);
+  if (!p.value)
+    goto fail;
+
+  foo ();
+
+  q = boxed_malloc (1024);
+  if (!q.value)
+    goto fail;
+
+  bar ();
+
+ fail:
+  boxed_free (q);
+  boxed_free (p);
+}
+
+void test_16 (void)
+{
+  boxed_ptr p, q; /* { dg-message "region created on stack here" } */
+
+  p = boxed_malloc (1024);
+  if (!p.value)
+    goto fail;
+
+  foo ();
+
+  q = boxed_malloc (1024);
+  if (!q.value)
+    goto fail;
+
+  bar ();
+
+ fail:
+  boxed_free (q); /* { dg-warning "use of uninitialized value 'q'" } */
+  boxed_free (p);
+}
+
+void test_17 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+} /* { dg-warning "leak of 'ptr.value'" "" { target c } } */
+/* { dg-warning "leak of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+
+void test_18 (void)
+{
+  boxed_ptr ptr = boxed_malloc (64);
+  ptr = boxed_null; /* { dg-warning "leak of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "leak of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_18a (void)
+{
+  boxed_ptr ptr = boxed_malloc (64);
+  ptr.value = NULL; /* { dg-warning "leak of 'ptr.value'" "" { target c } } */
+  /* { dg-warning "leak of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+}
+
+void test_19 (void)
+{
+  boxed_ptr ptr = boxed_malloc (64);
+  free (ptr.value);
+  ptr.value = NULL;
+  free (ptr.value);
+}
+
+boxed_ptr global_ptr_20;
+
+void test_20 (void)
+{
+  global_ptr_20 = boxed_malloc (1024);
+}
+
+int *test_21 (int i)
+{
+  boxed_ptr ptr = boxed_malloc (sizeof (int));
+  if (!ptr.value)
+    abort ();
+  *(int *)ptr.value = i;
+  return (int *)ptr.value;
+}
+
+boxed_ptr test_21a (int i)
+{
+  boxed_ptr ptr = boxed_malloc (sizeof (int));
+  if (!ptr.value)
+    abort ();
+  *(int *)ptr.value = i;
+  return ptr;
+}
+
+void test_22 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+
+  int i;
+  for (i = 5; i < 10; i++)
+    foo ();
+
+  free (ptr.value);
+  free (ptr.value); /* { dg-warning "double-'free' of 'ptr.value'" "" { target c } } */ 
+  /* { dg-warning "double-'free' of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */ 
+}
+
+void test_24 (void)
+{
+  boxed_ptr ptr;
+  ptr.value = __builtin_alloca (sizeof (int)); /* { dg-message "region created on stack here" } */
+  free (ptr.value); /* { dg-warning "'free' of 'ptr.value' which points to memory on the stack \\\[CWE-590\\\]" "" { target c } } */
+  /* { dg-warning "'free' of 'ptr.boxed_ptr::value' which points to memory on the stack \\\[CWE-590\\\]" "" { target c++ } .-1 } */
+}
+
+void test_25 (void)
+{
+  char tmp[100]; /* { dg-message "region created on stack here" } */
+  boxed_ptr p;
+  p.value = tmp;
+  free (p.value); /* { dg-warning "'free' of '& ?tmp' which points to memory on the stack \\\[CWE-590\\\]" } */
+}
+
+char global_buffer[100]; /* { dg-message "region created here" } */
+
+void test_26 (void)
+{
+  boxed_ptr p;
+  p.value = global_buffer;
+  free (p.value); /* { dg-warning "'free' of '& ?global_buffer' which points to memory not on the heap \\\[CWE-590\\\]" } */
+}
+
+struct coord {
+  float x;
+  float y;
+};
+
+boxed_ptr test_27 (void)
+{
+  boxed_ptr p = boxed_malloc (sizeof (struct coord));
+  ((struct coord *)p.value)->x = 0.f;  /* { dg-warning "dereference of possibly-NULL 'p.value' \\\[CWE-690\\\]" "" { target c } } */
+  /* { dg-warning "dereference of possibly-NULL 'p.boxed_ptr::value' \\\[CWE-690\\\]" "" { target c++ } .-1 } */
+
+  /* Only the first such usage should be reported: */
+  ((struct coord *)p.value)->y = 0.f;
+
+  return p;
+}
+
+struct link
+{
+  boxed_ptr m_ptr;
+};
+
+boxed_ptr test_29 (void)
+{
+  boxed_ptr res = boxed_malloc (sizeof (struct link));
+  if (!res.value)
+    return boxed_null;
+  ((struct link *)res.value)->m_ptr = boxed_malloc (sizeof (struct link));
+  return res;
+}
+
+void test_31 (void)
+{
+  struct link tmp;
+  boxed_ptr ptr = boxed_malloc (sizeof (struct link));
+  tmp.m_ptr = ptr;
+} /* { dg-warning "leak" } */ 
+
+void test_32 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+  could_free (ptr.value);
+} /* { dg-bogus "leak" } */
+
+void test_33 (void)
+{
+  boxed_ptr ptr = boxed_malloc (1024);
+  cant_free (ptr.value);
+} /* { dg-warning "leak of 'ptr.value'" "" { target c } } */
+/* { dg-warning "leak of 'ptr.boxed_ptr::value'" "" { target c++ } .-1 } */
+
+void test_34 (void)
+{
+  float *q;
+  boxed_ptr p = boxed_malloc (sizeof (struct coord));
+  if (!p.value)
+    return;
+  ((struct coord *)p.value)->x = 0.0f;
+  q = &((struct coord *)p.value)->x;
+  boxed_free (p);
+  *q = 1.0f; /* { dg-warning "use after 'free' of 'q'" } */
+};
+
+int test_35 (void)
+{
+  boxed_ptr ptr = boxed_malloc(4096);
+  if (!ptr.value)
+    return -1;
+  __builtin_memset(ptr.value, 0, 4096);
+  boxed_free(ptr);
+  return 0;
+}
+
+void test_36 (void)
+{
+  boxed_ptr ptr = boxed_malloc(4096);
+  if (!ptr.value)
+    return;
+  __builtin_memset(ptr.value, 0, 4096);
+  boxed_free(ptr);
+}
+
+boxed_ptr test_37a (void)
+{
+  boxed_ptr ptr = boxed_malloc(4096);
+  __builtin_memset(ptr.value, 0, 4096); /* { dg-warning "use of possibly-NULL 'ptr.value' where non-null expected \\\[CWE-690\\\]" "" { target c } } */
+   /* { dg-warning "use of possibly-NULL 'ptr.boxed_ptr::value' where non-null expected \\\[CWE-690\\\]" "" { target c++ } .-1 } */
+  return ptr;
+}
+
+int test_37b (void)
+{
+  boxed_ptr p = boxed_malloc(4096);
+  boxed_ptr q = boxed_malloc(4096);
+  if (p.value) {
+    __builtin_memset(p.value, 0, 4096); /* Not a bug: checked */
+  } else {
+    __builtin_memset(q.value, 0, 4096); /* { dg-warning "use of possibly-NULL 'q.value' where non-null expected \\\[CWE-690\\\]" "" { target c } } */
+    /* { dg-warning "use of possibly-NULL 'q.boxed_ptr::value' where non-null expected \\\[CWE-690\\\]" "" { target c++ } .-1 } */
+  }
+  boxed_free(p);
+  boxed_free(q);
+  return 0;
+}
+
+extern void might_use_ptr (void *ptr);
+
+void test_38(int i)
+{
+  boxed_ptr p;
+
+  p = boxed_malloc(1024);
+  if (p.value) {
+    boxed_free(p);
+    might_use_ptr(p.value); /* { dg-warning "use after 'free' of 'p.value'" "" { xfail *-*-* } } */
+     /* { dg-warning "use after 'free' of 'p.boxed_ptr::value'" "" { xfail *-*-* } .-1 } */
+    // TODO: xfail
+  }
+}
+
+boxed_ptr
+test_39 (int i)
+{
+  boxed_ptr p = boxed_malloc(sizeof(int*));
+  *(int *)p.value = i; /* { dg-warning "dereference of possibly-NULL 'p.value' \\\[CWE-690\\\]" "" { target c } } */
+   /* { dg-warning "dereference of possibly-NULL 'p.boxed_ptr::value' \\\[CWE-690\\\]" "" { target c++ } .-1 } */
+  return p;
+}
+
+boxed_ptr
+test_41 (int flag)
+{
+  boxed_ptr buffer;
+
+  if (flag) {
+    buffer = boxed_malloc(4096);
+  } else {
+    buffer = boxed_null;
+  }
+
+  ((char *)buffer.value)[0] = 'a'; /* { dg-warning "dereference of possibly-NULL 'buffer.value' \\\[CWE-690\\\]" "possibly-NULL" { target c } } */
+  /* { dg-warning "dereference of possibly-NULL 'buffer.boxed_ptr::value' \\\[CWE-690\\\]" "possibly-NULL" { target c++ } .-1 } */
+  /* { dg-warning "dereference of NULL" "NULL" { target *-*-* } .-2 } */
+
+  return buffer;
+}
+
+extern void might_take_ownership (boxed_ptr ptr);
+
+void test_45 (void)
+{
+  boxed_ptr p = boxed_malloc (1024);
+  might_take_ownership (p);
+}
+
+/* Free of function, and of label within function.  */
+
+void test_50a (void)
+{
+}
+
+void test_50b (void)
+{
+  boxed_ptr ptr;
+  ptr.value = test_50a; /* { dg-warning "invalid conversion from '\[^\n\]*' to 'void\\*" "fpermissive" { target c++ } } */
+  free (ptr.value); /* { dg-warning "'free' of '&test_50a' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c } } */
+  /* { dg-warning "'free' of 'test_50a' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c++ } .-1 } */
+}
+
+void test_50c (void)
+{
+ my_label:
+  boxed_ptr ptr;
+  ptr.value = &&my_label;
+  free (ptr.value); /* { dg-warning "'free' of '&my_label' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c } } */
+  /* { dg-warning "'free' of '&& my_label' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c++ } .-1 } */
+}
+
+/* { dg-prune-output "\\\[-Wfree-nonheap-object" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/builtins-pr107565.c b/gcc/testsuite/c-c++-common/analyzer/builtins-pr107565.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/builtins-pr107565.c
rename to gcc/testsuite/c-c++-common/analyzer/builtins-pr107565.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/bzero-1.c b/gcc/testsuite/c-c++-common/analyzer/bzero-1.c
similarity index 82%
rename from gcc/testsuite/gcc.dg/analyzer/bzero-1.c
rename to gcc/testsuite/c-c++-common/analyzer/bzero-1.c
index 894508611fe..b9dbd1d5fde 100644
--- a/gcc/testsuite/gcc.dg/analyzer/bzero-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/bzero-1.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern void bzero(void *s, __SIZE_TYPE__ n);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/bzip2-arg-parse-1.c b/gcc/testsuite/c-c++-common/analyzer/bzip2-arg-parse-1.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/bzip2-arg-parse-1.c
rename to gcc/testsuite/c-c++-common/analyzer/bzip2-arg-parse-1.c
index 1f1d8294c33..6df4d307611 100644
--- a/gcc/testsuite/gcc.dg/analyzer/bzip2-arg-parse-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/bzip2-arg-parse-1.c
@@ -4,7 +4,7 @@ 
 
 #include <stdlib.h>
 #include <stdio.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* This test file has been heavily modified from the bzip2.c original,
    which has the following license boilerplate.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-1.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-1.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-2.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-2.c
index 1bac24f4c67..b56abe1c393 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-2.c
@@ -6,7 +6,7 @@ 
    TODO: add some kind of test that summarization *was* used.  */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int external_fn (void *);
 
@@ -23,7 +23,8 @@  void test_summarized_returns_const (void)
 
 void test_summarized_returns_const_2 (void)
 {
-  returns_const (); /* { dg-message "when 'returns_const' returns" } */
+  returns_const (); /* { dg-message "when 'returns_const' returns" "" { target c } } */
+  /* { dg-message "when 'int returns_const\\(\\)' returns" "" { target c++ } .-1 } */
   __analyzer_dump_path (); /* { dg-message "path" } */
 }
 
@@ -467,7 +468,7 @@  int test_returns_external_result (void)
 
 int uses_alloca (int i)
 {
-  int *p = __builtin_alloca (sizeof (int));
+  int *p = (int *)__builtin_alloca (sizeof (int));
   *p = i;
   return *p;
 }
@@ -510,7 +511,7 @@  int consume_two_ints_from_va_list (__builtin_va_list ap)
   return i * j;
 }
 
-int test_consume_two_ints_from_va_list (__builtin_va_list ap1)
+void test_consume_two_ints_from_va_list (__builtin_va_list ap1)
 {
   int p1, p2;
   __builtin_va_list ap2;
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-3.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-3.c
similarity index 94%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-3.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-3.c
index d63eb0cf9a3..f27994acb38 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-3.c
@@ -4,7 +4,7 @@ 
    call-summarization code to be used.
    TODO: add some kind of test that summarization *was* used.  */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* With state merging disabled, we get two summaries here.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-asm-x86.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-asm-x86.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-asm-x86.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-asm-x86.c
index cc23283f0f8..9199297771b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-asm-x86.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-asm-x86.c
@@ -1,7 +1,7 @@ 
 /* { dg-do compile { target x86_64-*-* } } */
 /* { dg-additional-options "-fanalyzer-call-summaries --param analyzer-min-snodes-for-call-summary=0" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int returns_asm_value (void)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-errno.c
similarity index 83%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-errno.c
index e4333b30bb7..ed28dba06f7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-errno.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-errno.c
@@ -1,7 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-call-summaries" } */
 
 #include <errno.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void sets_errno (int x)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107072.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c
rename to gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107072.c
index 6e583d0228f..3f1706e80ad 100644
--- a/gcc/testsuite/gcc.dg/analyzer/call-summaries-pr107072.c
+++ b/gcc/testsuite/c-c++-common/analyzer/call-summaries-pr107072.c
@@ -8,6 +8,10 @@ 
 /* Reduced from an example in Emacs in which string_char_and_length
    was being incorrectly summarized, failing to see the write to *length.  */
 
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
+
 typedef long int ptrdiff_t;
 typedef struct Lisp_X *Lisp_Word;
 typedef Lisp_Word Lisp_Object;
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-1.c b/gcc/testsuite/c-c++-common/analyzer/callbacks-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/callbacks-1.c
rename to gcc/testsuite/c-c++-common/analyzer/callbacks-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-2.c b/gcc/testsuite/c-c++-common/analyzer/callbacks-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/callbacks-2.c
rename to gcc/testsuite/c-c++-common/analyzer/callbacks-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c b/gcc/testsuite/c-c++-common/analyzer/callbacks-3.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
rename to gcc/testsuite/c-c++-common/analyzer/callbacks-3.c
index 5f12c2a28d3..aaeec3f066f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/callbacks-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/callbacks-3.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef __SIZE_TYPE__ size_t;
 typedef int (*__compar_fn_t)(const void *, const void *);
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-2.c b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/capacity-2.c
rename to gcc/testsuite/c-c++-common/analyzer/capacity-2.c
index 2db1b3fa200..a5d31bb1ab0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/capacity-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/capacity-2.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern void might_realloc (void *);
 extern void cant_realloc (const void *);
diff --git a/gcc/testsuite/gcc.dg/analyzer/capacity-3.c b/gcc/testsuite/c-c++-common/analyzer/capacity-3.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/capacity-3.c
rename to gcc/testsuite/c-c++-common/analyzer/capacity-3.c
index c099ff5725d..138019b6f47 100644
--- a/gcc/testsuite/gcc.dg/analyzer/capacity-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/capacity-3.c
@@ -1,7 +1,7 @@ 
 /* { dg-require-effective-target alloca } */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 static void __attribute__((noinline))
 __analyzer_callee_1 (size_t inner_sz)
diff --git a/gcc/testsuite/gcc.dg/analyzer/casts-1.c b/gcc/testsuite/c-c++-common/analyzer/casts-1.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/casts-1.c
rename to gcc/testsuite/c-c++-common/analyzer/casts-1.c
index 7e4af384971..e029548c450 100644
--- a/gcc/testsuite/gcc.dg/analyzer/casts-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/casts-1.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct s1
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/casts-2.c b/gcc/testsuite/c-c++-common/analyzer/casts-2.c
similarity index 84%
rename from gcc/testsuite/gcc.dg/analyzer/casts-2.c
rename to gcc/testsuite/c-c++-common/analyzer/casts-2.c
index 3eef71726ba..40ba8c45d54 100644
--- a/gcc/testsuite/gcc.dg/analyzer/casts-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/casts-2.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test_1 (int i)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/clobbers-1.c b/gcc/testsuite/c-c++-common/analyzer/clobbers-1.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/clobbers-1.c
rename to gcc/testsuite/c-c++-common/analyzer/clobbers-1.c
index 6400f845f9e..e3f62ef6608 100644
--- a/gcc/testsuite/gcc.dg/analyzer/clobbers-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/clobbers-1.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct foo
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/clobbers-2.c b/gcc/testsuite/c-c++-common/analyzer/clobbers-2.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/clobbers-2.c
rename to gcc/testsuite/c-c++-common/analyzer/clobbers-2.c
index 9a88349d641..855a4e27958 100644
--- a/gcc/testsuite/gcc.dg/analyzer/clobbers-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/clobbers-2.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef __SIZE_TYPE__ size_t;
 extern void bzero (void *s, size_t n);
diff --git a/gcc/testsuite/gcc.dg/analyzer/combined-conditionals-1.c b/gcc/testsuite/c-c++-common/analyzer/combined-conditionals-1.c
similarity index 95%
rename from gcc/testsuite/gcc.dg/analyzer/combined-conditionals-1.c
rename to gcc/testsuite/c-c++-common/analyzer/combined-conditionals-1.c
index caac2678bf3..ba658e48376 100644
--- a/gcc/testsuite/gcc.dg/analyzer/combined-conditionals-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/combined-conditionals-1.c
@@ -1,6 +1,6 @@ 
 /* Verify that we correctly consolidate conditionals in paths.  */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo ();
 extern int bar ();
@@ -48,7 +48,7 @@  void test_6 (void)
     __analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */
 }
 
-int test_7 (void)
+void test_7 (void)
 {
   if (foo () ? bar () ? baz () : 0 : 0) /* { dg-message "\\(1\\) following 'true' branch\\.\\.\\." } */
     __analyzer_dump_path (); /* { dg-message "\\(2\\) \\.\\.\\.to here" } */    
diff --git a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-2.c b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-2.c
similarity index 53%
rename from gcc/testsuite/gcc.dg/analyzer/compound-assignment-2.c
rename to gcc/testsuite/c-c++-common/analyzer/compound-assignment-2.c
index ecca9aca83b..22d7c9c4046 100644
--- a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-2.c
@@ -14,11 +14,12 @@  test_1 (void)
   return aw1;
 }
 
-struct array_wrapper
-test_2 (void)
+void test_2 (void)
 {
   struct array_wrapper aw2;
   aw2.ptrs[0] = malloc (1024);
   aw2.ptrs[1] = malloc (512);
-} /* { dg-warning "leak of 'aw2.ptrs.0.'" "leak of element 0" } */
-/* { dg-warning "leak of 'aw2.ptrs.1.'" "leak of element 1" { target *-*-* } .-1 } */
+} /* { dg-warning "leak of 'aw2.ptrs.0.'" "leak of element 0" { target c } } */
+/* { dg-warning "leak of 'aw2.array_wrapper::ptrs.0.'" "leak of element 0" { target c++ } .-1 } */
+/* { dg-warning "leak of 'aw2.ptrs.1.'" "leak of element 1" { target c } .-2 } */
+/* { dg-warning "leak of 'aw2.array_wrapper::ptrs.1.'" "leak of element 1" { target c++ } .-3 } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-3.c
similarity index 57%
rename from gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c
rename to gcc/testsuite/c-c++-common/analyzer/compound-assignment-3.c
index 49259262c4a..141ae98fb80 100644
--- a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-3.c
@@ -17,9 +17,9 @@  test_1 (void)
   return uw1;
 }
 
-struct union_wrapper
-test_2 (void)
+void test_2 (void)
 {
   struct union_wrapper uw2;
   uw2.u.ptr = malloc (1024);
-} /* { dg-warning "leak of 'uw2.u.ptr'" } */
+} /* { dg-warning "leak of 'uw2.u.ptr'" "" { target c } } */
+  /* { dg-warning "leak of 'uw2.union_wrapper::u.union_wrapper::<unnamed union>::ptr'" "" { target c++ } .-1 } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-4.c b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-4.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/compound-assignment-4.c
rename to gcc/testsuite/c-c++-common/analyzer/compound-assignment-4.c
index 5c0a5f9d47c..93c21e8edbf 100644
--- a/gcc/testsuite/gcc.dg/analyzer/compound-assignment-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/compound-assignment-4.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct coord
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c b/gcc/testsuite/c-c++-common/analyzer/conditionals-3.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/conditionals-3.c
rename to gcc/testsuite/c-c++-common/analyzer/conditionals-3.c
index f1c6c208405..6ba90a1bc15 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/conditionals-3.c
@@ -1,6 +1,6 @@ 
 /* { dg-additional-options "-fno-analyzer-state-merge" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 static void __analyzer_only_called_when_flag_a_true (int i)
 {
@@ -12,7 +12,7 @@  static void __analyzer_only_called_when_flag_b_true (int i)
   __analyzer_eval (i == 17); /* { dg-warning "TRUE" } */
 }
 
-int test_1 (int flag_a, int flag_b)
+void test_1 (int flag_a, int flag_b)
 {
   int i = 17;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c b/gcc/testsuite/c-c++-common/analyzer/conditionals-notrans.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c
rename to gcc/testsuite/c-c++-common/analyzer/conditionals-notrans.c
index b1ac541920f..277fc4dd243 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-notrans.c
+++ b/gcc/testsuite/c-c++-common/analyzer/conditionals-notrans.c
@@ -1,5 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-transitivity" } */
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c b/gcc/testsuite/c-c++-common/analyzer/conditionals-trans.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c
rename to gcc/testsuite/c-c++-common/analyzer/conditionals-trans.c
index f032789e6c4..7dd20e299a7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/conditionals-trans.c
+++ b/gcc/testsuite/c-c++-common/analyzer/conditionals-trans.c
@@ -1,5 +1,5 @@ 
 /* { dg-additional-options "-fanalyzer-transitivity" } */
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c b/gcc/testsuite/c-c++-common/analyzer/data-model-1.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-1.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-1.c
index 3c4a45f4a4a..d5fc1fee466 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-1.c
@@ -4,7 +4,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct foo
 {
@@ -146,7 +146,7 @@  int test_12 (void)
   /* alloca results should be unique.  */
   __analyzer_eval (p == q); /* { dg-warning "FALSE" } */
 
-  return *(int *)p; /* { dg-warning "use of uninitialized value '\\*\\(int \\*\\)p" } */
+  return *(int *)p; /* { dg-warning "use of uninitialized value '\\*\\(int ?\\*\\)p" } */
 }
 
 /* Use of uninit value.  */
@@ -179,7 +179,7 @@  struct coord
   long y;
 };
 
-int test_12d (struct coord c)
+void test_12d (struct coord c)
 {
   struct coord d;
   d = c;
@@ -674,7 +674,8 @@  void test_29b (void)
   __analyzer_eval (q->x == 107024); /* { dg-warning "TRUE" } */
   __analyzer_eval (q->y == 107025); /* { dg-warning "TRUE" } */
 
-  __analyzer_eval (p[10].x == 0); /* { dg-warning "use of uninitialized value 'p\\\[10\\\].x'" } */
+  __analyzer_eval (p[10].x == 0); /* { dg-warning "use of uninitialized value 'p\\\[10\\\].x'" "" { target c } } */
+  /* { dg-warning "use of uninitialized value 'p\\\[10\\\].coord::x'" "" { target c++ } .-1 } */
 }
 
 void test_29c (int len)
@@ -722,7 +723,8 @@  void test_29c (int len)
   __analyzer_eval (q->x == 107024); /* { dg-warning "TRUE" } */
   __analyzer_eval (q->y == 107025); /* { dg-warning "TRUE" } */
 
-  __analyzer_eval (p[10].x == 0); /* { dg-warning "use of uninitialized value '\\*p\\\[10\\\].x'" } */
+  __analyzer_eval (p[10].x == 0); /* { dg-warning "use of uninitialized value '\\*p\\\[10\\\].x'" "" { target c } } */
+  /* { dg-warning "use of uninitialized value '\\*p\\\[10\\\].coord::x'" "" { target c++ } .-1 } */
 }
 
 void test_30 (void *ptr)
@@ -835,7 +837,7 @@  int test_38 (void)
 
 /* Write through NULL pointer.  */
 
-int test_38a (int i)
+void test_38a (int i)
 {
   int *ptr = NULL;
   *ptr = i; /* { dg-warning "dereference of NULL 'ptr'" } */
@@ -849,7 +851,7 @@  int test_39 (void)
   return *ptr;
 }
 
-int test_40 (int flag)
+void test_40 (int flag)
 {
   int i;
   if (flag)
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c b/gcc/testsuite/c-c++-common/analyzer/data-model-10.c
similarity index 57%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-10.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-10.c
index 04c9891d89b..2bfce1f7174 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-10.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-10.c
@@ -12,7 +12,9 @@  test (void)
   if (!new_table)
     return NULL;
   new_table->m_f = (char **)malloc(sizeof(char **));
-  *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" } */
-  /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target *-*-* } .-1 } */
+  *new_table->m_f = NULL; /* { dg-warning "dereference of possibly-NULL '\\*new_table.m_f'" "" { target c } } */
+  /* { dg-warning "dereference of possibly-NULL '\\*new_table.foo::m_f'" "" { target c++ } .-1 } */
+  /* { dg-message "'\\*new_table.m_f' could be NULL" "final event wording" { target c } .-2 } */
+  /* { dg-message "'\\*new_table.foo::m_f' could be NULL" "final event wording" { target c++ } .-3 } */
   return new_table;
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-12.c b/gcc/testsuite/c-c++-common/analyzer/data-model-12.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-12.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-12.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-13.c b/gcc/testsuite/c-c++-common/analyzer/data-model-13.c
similarity index 67%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-13.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-13.c
index 31c1896b0c2..c9cabb8d526 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-13.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-13.c
@@ -1,6 +1,6 @@ 
 #include <stdlib.h>
 
-union
+static union
 {
   void *ptr_val;
   int int_val;
@@ -14,5 +14,6 @@  void test_1 (void)
 void test_2 (void)
 {
   global_union.ptr_val = malloc (1024); /* { dg-message "allocated here" } */
-  global_union.int_val = 0; /* { dg-warning "leak of 'global_union.ptr_val' " } */
+  global_union.int_val = 0; /* { dg-warning "leak of 'global_union.ptr_val' " "" { target c } } */
+  /* { dg-warning "leak of 'global_union.<unnamed union>::ptr_val' " "" { target c++ } .-1 } */
 } 
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-14.c b/gcc/testsuite/c-c++-common/analyzer/data-model-14.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-14.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-14.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-15.c b/gcc/testsuite/c-c++-common/analyzer/data-model-15.c
similarity index 86%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-15.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-15.c
index 12e84a12420..82f0f22ae5c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-15.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-15.c
@@ -26,7 +26,7 @@  int test_2 (const struct coord *c1, const struct coord *c2, double r_squared)
   return (dx * dx) + (dy * dy) + (dz * dz) <= r_squared;
 }
 
-int test_3 (const struct coord *c1, const struct coord *c2, struct coord *out)
+void test_3 (const struct coord *c1, const struct coord *c2, struct coord *out)
 {
   out->x = c1->x + c2->x;
   out->y = c1->y + c2->y;
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-16.c b/gcc/testsuite/c-c++-common/analyzer/data-model-16.c
similarity index 67%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-16.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-16.c
index 616d3537054..b0ae90db542 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-16.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-16.c
@@ -2,7 +2,7 @@ 
 
 /* Labels as values.  */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern void foo (void);
 
@@ -40,10 +40,10 @@  void test_2 (int i)
 
 void test_3 (int i)
 {
-  static const int array[] = { &&label0 - &&label0,
-			       &&label1 - &&label0,
-			       &&label2 - &&label0 };
-  goto *(&&label0 + array[i]);
+  static const int array[] = { (char *)&&label0 - (char *)&&label0,
+			       (char *)&&label1 - (char *)&&label0,
+			       (char *)&&label2 - (char *)&&label0 };
+  goto *((int *)&&label0 + array[i]);
 
  label0:
   foo ();
@@ -52,3 +52,5 @@  void test_3 (int i)
  label2:
   foo ();
 }
+
+/* { dg-prune-output "Wnarrowing" }*/
\ No newline at end of file
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-17.c b/gcc/testsuite/c-c++-common/analyzer/data-model-17.c
similarity index 87%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-17.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-17.c
index d50b84ab43a..556c53ac7ab 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-17.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-17.c
@@ -14,7 +14,7 @@  static const config table[2] = {
   { cb_2 }
 };
 
-int deflate (foo_t *s, int which)
+void deflate (foo_t *s, int which)
 {
   (*(table[which].func))(s);
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-18.c b/gcc/testsuite/c-c++-common/analyzer/data-model-18.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-18.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-18.c
index 86e8110ccf6..1e359e56bbd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-18.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-18.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int *p, int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-2.c b/gcc/testsuite/c-c++-common/analyzer/data-model-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-2.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-20.c b/gcc/testsuite/c-c++-common/analyzer/data-model-20.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-20.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-20.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-21.c b/gcc/testsuite/c-c++-common/analyzer/data-model-21.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-21.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-21.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-22.c b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-22.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-22.c
index 8429b2f4dc6..6f5b04ed5d7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-22.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-22.c
@@ -1,5 +1,5 @@ 
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern void check_init_char (char v);
 extern void check_init_int (int v);
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-23.c b/gcc/testsuite/c-c++-common/analyzer/data-model-23.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-23.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-23.c
index d10dd057d96..366f0c9376e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-23.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-23.c
@@ -1,11 +1,10 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
-#define NULL ((void *)0)
 
-void * __attribute__((noinline))
+char * __attribute__((noinline))
 hide (void *ptr)
 {
-  return ptr;
+  return (char *)ptr;
 }
 
 void test_1 (void)
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-4.c b/gcc/testsuite/c-c++-common/analyzer/data-model-4.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-4.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-4.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-5.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-5.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5b.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5b.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-5b.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-5b.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5c.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5c.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-5c.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-5c.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
index b4d77a939bc..f5434090ae5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-5d.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-5d.c
@@ -3,7 +3,7 @@ 
 #include <stddef.h>
 #include <string.h>
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef struct base_obj
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c b/gcc/testsuite/c-c++-common/analyzer/data-model-7.c
similarity index 84%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-7.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-7.c
index cb0b33e66c8..489ed6ecc4c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-7.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-7.c
@@ -1,7 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-state-merge" } */
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
-int test_40 (int flag)
+void test_40 (int flag)
 {
   int i;
   if (flag)
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-8.c b/gcc/testsuite/c-c++-common/analyzer/data-model-8.c
similarity index 87%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-8.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-8.c
index 3e69d0f8aa5..98d25886e5c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-8.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-8.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct base
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-9.c b/gcc/testsuite/c-c++-common/analyzer/data-model-9.c
similarity index 78%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-9.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-9.c
index 159bc612576..4467ab9f3b1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-9.c
+++ b/gcc/testsuite/c-c++-common/analyzer/data-model-9.c
@@ -1,6 +1,6 @@ 
 #include <stdlib.h>
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct foo
 {
@@ -11,7 +11,7 @@  struct foo
 
 void test_1 (void)
 {
-  struct foo *f = calloc (1, sizeof (struct foo));
+  struct foo *f = (struct foo *) calloc (1, sizeof (struct foo));
   if (f == NULL)
     return;
   __analyzer_eval (f->i == 0); /* { dg-warning "TRUE" "desired" { xfail *-*-* } } */
@@ -23,7 +23,7 @@  void test_1 (void)
 
 void test_2 (void)
 {
-  struct foo *f = malloc (sizeof (struct foo));
+  struct foo *f = (struct foo *) malloc (sizeof (struct foo));
   if (f == NULL)
     return;
   memset (f, 0, sizeof (struct foo));
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-path-1.c b/gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/data-model-path-1.c
rename to gcc/testsuite/c-c++-common/analyzer/data-model-path-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-1.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c
rename to gcc/testsuite/c-c++-common/analyzer/deref-before-check-1.c
index 1b11da5d8e1..10cdd35f1ef 100644
--- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-1.c
@@ -1,4 +1,4 @@ 
-#define NULL ((void *)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int test_from_pr77432 (int *a)
 {
@@ -76,9 +76,11 @@  struct s4
 
 int test_4 (struct s4 *p)
 {
-  if (p->m_next->m_val > 0) /* { dg-message "pointer '\\*p.m_next' is dereferenced here" } */
+  if (p->m_next->m_val > 0) /* { dg-message "pointer '\\*p.m_next' is dereferenced here" "" { target c } } */
+    /* { dg-message "pointer '\\*p.s4::m_next' is dereferenced here" "" { target c++ } .-1 } */
     return -1;
-  if (!p->m_next) /* { dg-warning "check of '\\*p.m_next' for NULL after already dereferencing it" } */
+  if (!p->m_next) /* { dg-warning "check of '\\*p.m_next' for NULL after already dereferencing it" "" { target c } } */
+                  /* { dg-warning "check of '\\*p.s4::m_next' for NULL after already dereferencing it" "" { target c++ } .-1 } */
     return -2;
   return p->m_next->m_val;
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-2.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/deref-before-check-2.c
rename to gcc/testsuite/c-c++-common/analyzer/deref-before-check-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro-pr108745.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro-pr108745.c
similarity index 95%
rename from gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro-pr108745.c
rename to gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro-pr108745.c
index 92f5a02645d..39e8ce2684a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro-pr108745.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro-pr108745.c
@@ -1,6 +1,6 @@ 
 /* Reduced from ImageMagick-7.1.0-57.  */
 
-#define NULL ((void *)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef __builtin_va_list va_list;
 typedef __SIZE_TYPE__ size_t;
diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro.c
rename to gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro.c
index 5146129772f..4c3e217185f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-macro.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-macro.c
@@ -1,4 +1,4 @@ 
-#define NULL ((void*)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 #define MY_ASSERT(COND)				\
   do {						\
diff --git a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-qemu-qtest_rsp_args.c b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-qemu-qtest_rsp_args.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/deref-before-check-qemu-qtest_rsp_args.c
rename to gcc/testsuite/c-c++-common/analyzer/deref-before-check-qemu-qtest_rsp_args.c
index 2b3ad8c5fb3..e84867d75d3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/deref-before-check-qemu-qtest_rsp_args.c
+++ b/gcc/testsuite/c-c++-common/analyzer/deref-before-check-qemu-qtest_rsp_args.c
@@ -1,7 +1,7 @@ 
 /* Reduced from qemu-7.2.0's tests/qtest/libqtest.c.  */
 
 #define TRUE 1
-#define NULL ((void *)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 #define g_assert(expr) \
   do {									\
diff --git a/gcc/testsuite/gcc.dg/analyzer/describe-1.c b/gcc/testsuite/c-c++-common/analyzer/describe-1.c
similarity index 58%
rename from gcc/testsuite/gcc.dg/analyzer/describe-1.c
rename to gcc/testsuite/c-c++-common/analyzer/describe-1.c
index bc57c6ecef2..24c52543e26 100644
--- a/gcc/testsuite/gcc.dg/analyzer/describe-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/describe-1.c
@@ -1,11 +1,12 @@ 
 /* Smoketest for __analyzer_describe.  */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int i)
 {
   __analyzer_describe (0, 42); /* { dg-warning "svalue: '\\(int\\)42'" } */
   __analyzer_describe (0, i); /* { dg-warning "svalue: 'INIT_VAL\\(i.*\\)'" } */
-  __analyzer_describe (0, &i); /* { dg-warning "svalue: '&i'" } */
+  __analyzer_describe (0, &i); /* { dg-warning "svalue: '&i'" "" { target c } } */
+  /* { dg-warning "svalue: '&int i'" "" { target c++ } .-1 } */
   /* Further cases would risk overspecifying things. */
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/disabling.c b/gcc/testsuite/c-c++-common/analyzer/disabling.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/disabling.c
rename to gcc/testsuite/c-c++-common/analyzer/disabling.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/doom-d_main-IdentifyVersion.c b/gcc/testsuite/c-c++-common/analyzer/doom-d_main-IdentifyVersion.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/doom-d_main-IdentifyVersion.c
rename to gcc/testsuite/c-c++-common/analyzer/doom-d_main-IdentifyVersion.c
index 982b9b74349..edc6c3217a6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/doom-d_main-IdentifyVersion.c
+++ b/gcc/testsuite/c-c++-common/analyzer/doom-d_main-IdentifyVersion.c
@@ -2,6 +2,12 @@ 
 
 /* { dg-additional-options "-Wno-analyzer-too-complex" } */
 
+#ifdef __cplusplus
+#define CONST_CAST(type, v) const_cast<type> (v)
+#else
+#define CONST_CAST(type, v) v
+#endif
+
 typedef __SIZE_TYPE__ size_t;
 typedef struct _IO_FILE FILE;
 
@@ -60,8 +66,8 @@  typedef enum
 
 typedef enum
 {
-  false,
-  true
+  False,
+  True
 } boolean;
 
 extern boolean devparm;
@@ -69,14 +75,14 @@  extern GameMode_t gamemode;
 extern Language_t language;
 extern char basedefault[1024];
 int
-M_CheckParm(char* check);
+M_CheckParm(const char* check);
 void
-I_Error(char* error, ...);
+I_Error(const char* error, ...);
 
 extern char* wadfiles[20];
 
 void
-D_AddFile(char* file)
+D_AddFile(const char* file)
 {
   int numwadfiles;
   char* newfile;
@@ -84,7 +90,7 @@  D_AddFile(char* file)
   for (numwadfiles = 0; wadfiles[numwadfiles]; numwadfiles++)
     ;
 
-  newfile = malloc(strlen(file) + 1);
+  newfile = (char *)malloc(strlen(file) + 1);
   strcpy(newfile, file); /* { dg-warning "use of possibly-NULL 'newfile' where non-null expected" } */
 
   wadfiles[numwadfiles] = newfile;
@@ -107,27 +113,27 @@  IdentifyVersion(void)
   char* doomwaddir;
   doomwaddir = getenv("DOOMWADDIR");
   if (!doomwaddir)
-    doomwaddir = ".";
+    doomwaddir = CONST_CAST(char *, ".");
 
-  doom2wad = malloc(strlen(doomwaddir) + 1 + 9 + 1);
+  doom2wad = (char *)malloc(strlen(doomwaddir) + 1 + 9 + 1);
   sprintf(doom2wad, "%s/doom2.wad", doomwaddir); /* { dg-warning "possibly-NULL 'doom2wad'" } */
 
-  doomuwad = malloc(strlen(doomwaddir) + 1 + 8 + 1);
+  doomuwad = (char *)malloc(strlen(doomwaddir) + 1 + 8 + 1);
   sprintf(doomuwad, "%s/doomu.wad", doomwaddir); /* { dg-warning "possibly-NULL 'doomuwad'" } */
 
-  doomwad = malloc(strlen(doomwaddir) + 1 + 8 + 1);
+  doomwad = (char *)malloc(strlen(doomwaddir) + 1 + 8 + 1);
   sprintf(doomwad, "%s/doom.wad", doomwaddir); /* { dg-warning "possibly-NULL 'doomwad'" } */
 
-  doom1wad = malloc(strlen(doomwaddir) + 1 + 9 + 1);
+  doom1wad = (char *)malloc(strlen(doomwaddir) + 1 + 9 + 1);
   sprintf(doom1wad, "%s/doom1.wad", doomwaddir); /* { dg-warning "possibly-NULL 'doom1wad'" } */
 
-  plutoniawad = malloc(strlen(doomwaddir) + 1 + 12 + 1);
+  plutoniawad = (char *)malloc(strlen(doomwaddir) + 1 + 12 + 1);
   sprintf(plutoniawad, "%s/plutonia.wad", doomwaddir); /* { dg-warning "possibly-NULL 'plutoniawad'" } */
 
-  tntwad = malloc(strlen(doomwaddir) + 1 + 9 + 1);
+  tntwad = (char *)malloc(strlen(doomwaddir) + 1 + 9 + 1);
   sprintf(tntwad, "%s/tnt.wad", doomwaddir); /* { dg-warning "possibly-NULL 'tntwad'" } */
 
-  doom2fwad = malloc(strlen(doomwaddir) + 1 + 10 + 1);
+  doom2fwad = (char *)malloc(strlen(doomwaddir) + 1 + 10 + 1);
   sprintf(doom2fwad, "%s/doom2f.wad", doomwaddir); /* { dg-warning "possibly-NULL 'doom2fwad'" } */
 
   home = getenv("HOME");
@@ -137,7 +143,7 @@  IdentifyVersion(void)
 
   if (M_CheckParm("-shdev")) {
     gamemode = shareware;
-    devparm = true;
+    devparm = True;
     D_AddFile("devdata"
               "doom1.wad");
     D_AddFile("devmaps"
@@ -158,7 +164,7 @@  IdentifyVersion(void)
 
   if (M_CheckParm("-regdev")) {
     gamemode = registered;
-    devparm = true;
+    devparm = True;
     D_AddFile("devdata"
               "doom.wad");
     D_AddFile("devmaps"
@@ -181,7 +187,7 @@  IdentifyVersion(void)
 
   if (M_CheckParm("-comdev")) {
     gamemode = commercial;
-    devparm = true;
+    devparm = True;
 
     D_AddFile("devdata"
               "doom2.wad");
diff --git a/gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c b/gcc/testsuite/c-c++-common/analyzer/doom-s_sound-pr108867.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c
rename to gcc/testsuite/c-c++-common/analyzer/doom-s_sound-pr108867.c
index ae58f03d3b3..e7ec29dc9c2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/doom-s_sound-pr108867.c
+++ b/gcc/testsuite/c-c++-common/analyzer/doom-s_sound-pr108867.c
@@ -15,14 +15,14 @@  abs(int __x) __attribute__((__nothrow__, __leaf__)) __attribute__((__const__));
 
 typedef enum
 {
-  false,
-  true
+  False,
+  True
 } boolean;
 
 typedef unsigned char byte;
 
 void
-I_Error(char* error, ...);
+I_Error(const char* error, ...);
 
 typedef enum
 {
@@ -238,7 +238,7 @@  S_Init(int sfxVolume, int musicVolume)
   for (i = 0; i < numChannels; i++)
     channels[i].sfxinfo = 0;
 
-  mus_paused = 0;
+  mus_paused = (boolean) 0;
 
   for (i = 1; i < NUMSFX; i++)
     S_sfx[i].lumpnum = S_sfx[i].usefulness = -1;
@@ -253,7 +253,7 @@  S_Start(void)
     if (channels[cnum].sfxinfo)
       S_StopChannel(cnum);
 
-  mus_paused = 0;
+  mus_paused = (boolean) 0;
 
   if (gamemode == commercial)
     mnum = mus_runnin + gamemap - 1;
@@ -270,7 +270,7 @@  S_Start(void)
       mnum = spmus[gamemap - 1];
   }
 
-  S_ChangeMusic(mnum, true);
+  S_ChangeMusic(mnum, True);
 
   nextcleanup = 15;
 }
@@ -387,7 +387,7 @@  S_PauseSound(void)
 {
   if (mus_playing && !mus_paused) {
     I_PauseSong(mus_playing->handle);
-    mus_paused = true;
+    mus_paused = True;
   }
 }
 
@@ -396,7 +396,7 @@  S_ResumeSound(void)
 {
   if (mus_playing && mus_paused) {
     I_ResumeSong(mus_playing->handle);
-    mus_paused = false;
+    mus_paused = False;
   }
 }
 
@@ -436,7 +436,7 @@  S_UpdateSounds(void* listener_p)
 
         if (c->origin && listener_p != c->origin) {
           audible =
-            S_AdjustSoundParams(listener, c->origin, &volume, &sep, &pitch);
+            S_AdjustSoundParams(listener, (mobj_t *) c->origin, &volume, &sep, &pitch);
 
           if (!audible) {
             S_StopChannel(cnum);
@@ -476,7 +476,7 @@  S_SetSfxVolume(int volume)
 void
 S_StartMusic(int m_id)
 {
-  S_ChangeMusic(m_id, false);
+  S_ChangeMusic(m_id, False);
 }
 
 void
@@ -490,7 +490,7 @@  S_ChangeMusic(int musicnum, int looping)
   } else
     music = &S_music[musicnum];
 
-  /* We don't know that I_Error exits, so actually a false positive;
+  /* We don't know that I_Error exits, so actually a False positive;
      see PR analyzer/108867.  */
 
   if (mus_playing == music) /* { dg-warning "use of uninitialized value 'music'" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/double-free-lto-1-a.c b/gcc/testsuite/c-c++-common/analyzer/double-free-lto-1-a.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/double-free-lto-1-a.c
rename to gcc/testsuite/c-c++-common/analyzer/double-free-lto-1-a.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/double-free-lto-1-b.c b/gcc/testsuite/c-c++-common/analyzer/double-free-lto-1-b.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/double-free-lto-1-b.c
rename to gcc/testsuite/c-c++-common/analyzer/double-free-lto-1-b.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/double-free-lto-1.h b/gcc/testsuite/c-c++-common/analyzer/double-free-lto-1.h
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/double-free-lto-1.h
rename to gcc/testsuite/c-c++-common/analyzer/double-free-lto-1.h
diff --git a/gcc/testsuite/gcc.dg/analyzer/dump-state.c b/gcc/testsuite/c-c++-common/analyzer/dump-state.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/dump-state.c
rename to gcc/testsuite/c-c++-common/analyzer/dump-state.c
index 618a5a9d781..9f2f4d0d2f9 100644
--- a/gcc/testsuite/gcc.dg/analyzer/dump-state.c
+++ b/gcc/testsuite/c-c++-common/analyzer/dump-state.c
@@ -1,7 +1,7 @@ 
 /* Verify that __analyzer_dump_state works as expected.  */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test_1 (void)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/edges-1.c b/gcc/testsuite/c-c++-common/analyzer/edges-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/edges-1.c
rename to gcc/testsuite/c-c++-common/analyzer/edges-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/edges-2.c b/gcc/testsuite/c-c++-common/analyzer/edges-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/edges-2.c
rename to gcc/testsuite/c-c++-common/analyzer/edges-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/equivalence.c b/gcc/testsuite/c-c++-common/analyzer/equivalence.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/equivalence.c
rename to gcc/testsuite/c-c++-common/analyzer/equivalence.c
index 609b6fdef50..64230aa6a96 100644
--- a/gcc/testsuite/gcc.dg/analyzer/equivalence.c
+++ b/gcc/testsuite/c-c++-common/analyzer/equivalence.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int p, int q, int r)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-1.c b/gcc/testsuite/c-c++-common/analyzer/errno-1.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/errno-1.c
rename to gcc/testsuite/c-c++-common/analyzer/errno-1.c
index 6b9d28c1079..53f42906981 100644
--- a/gcc/testsuite/gcc.dg/analyzer/errno-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/errno-1.c
@@ -1,5 +1,5 @@ 
 #include <errno.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern void external_fn (void);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-___errno.c b/gcc/testsuite/c-c++-common/analyzer/errno-___errno.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/errno-___errno.c
rename to gcc/testsuite/c-c++-common/analyzer/errno-___errno.c
index 17ff8b7de9d..abfc1452ace 100644
--- a/gcc/testsuite/gcc.dg/analyzer/errno-___errno.c
+++ b/gcc/testsuite/c-c++-common/analyzer/errno-___errno.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* According to PR 107807 comment #2, Solaris implements "errno"
    like this:  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-__error.c b/gcc/testsuite/c-c++-common/analyzer/errno-__error.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/errno-__error.c
rename to gcc/testsuite/c-c++-common/analyzer/errno-__error.c
index 19bc4f937f6..9b33d216647 100644
--- a/gcc/testsuite/gcc.dg/analyzer/errno-__error.c
+++ b/gcc/testsuite/c-c++-common/analyzer/errno-__error.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* According to PR 107807 comment #2, OS X implements "errno"
    like this:  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-global-var.c b/gcc/testsuite/c-c++-common/analyzer/errno-global-var.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/errno-global-var.c
rename to gcc/testsuite/c-c++-common/analyzer/errno-global-var.c
index fdf1b17cecc..fbd09e5bed3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/errno-global-var.c
+++ b/gcc/testsuite/c-c++-common/analyzer/errno-global-var.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* "errno" declared as a global var.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/errno-pr107777.c b/gcc/testsuite/c-c++-common/analyzer/errno-pr107777.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/errno-pr107777.c
rename to gcc/testsuite/c-c++-common/analyzer/errno-pr107777.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/error-1.c b/gcc/testsuite/c-c++-common/analyzer/error-1.c
similarity index 58%
rename from gcc/testsuite/gcc.dg/analyzer/error-1.c
rename to gcc/testsuite/c-c++-common/analyzer/error-1.c
index 794a9ae7b42..b387fe6bafe 100644
--- a/gcc/testsuite/gcc.dg/analyzer/error-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/error-1.c
@@ -1,4 +1,5 @@ 
-#include "analyzer-decls.h"
+/* { dg-additional-options "-fpermissive" { target c++ } } */
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int errno;
 
@@ -65,30 +66,34 @@  void test_6 (int st, const char *str)
   __analyzer_eval (st == 0); /* { dg-warning "TRUE" } */
 }
 
-char *test_error_unterminated (int st)
+void test_error_unterminated (int st)
 {
-  char fmt[3] = "abc";
+  char fmt[3] = "abc"; /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "" { target c++ } } */
   error (st, errno, fmt); /* { dg-warning "stack-based buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 3 \\('&fmt'\\) of 'error'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 3 \\('&fmt'\\) of 'error'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 3 \\('& fmt'\\) of 'void error\\(int, int, const char\\*, \\.\\.\\.\\)'..." "event" { target c++ } .-2 } */
 }
 
-char *test_error_at_line_unterminated (int st, int errno)
+void test_error_at_line_unterminated (int st, int errno)
 {
-  char fmt[3] = "abc";
+  char fmt[3] = "abc"; /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "" { target c++ } } */
   error_at_line (st, errno, __FILE__, __LINE__, fmt); /* { dg-warning "stack-based buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 5 \\('&fmt'\\) of 'error_at_line'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 5 \\('&fmt'\\) of 'error_at_line'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 5 \\('& fmt'\\) of 'void error_at_line\\(int, int, const char\\*, unsigned int, const char\\*, ...\\)'..." "event" { target c++ } .-2 } */
 }
 
-char *test_error_uninitialized (int st, int errno)
+void test_error_uninitialized (int st, int errno)
 {
   char fmt[16];
   error (st, errno, fmt); /* { dg-warning "use of uninitialized value 'fmt\\\[0\\\]'" } */
-  /* { dg-message "while looking for null terminator for argument 3 \\('&fmt'\\) of 'error'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 3 \\('&fmt'\\) of 'error'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 3 \\('& fmt'\\) of 'void error\\(int, int, const char\\*, \\.\\.\\.\\)'..." "event" { target c++ } .-2 } */
 }
 
-char *test_error_at_line_uninitialized (int st, int errno)
+void test_error_at_line_uninitialized (int st, int errno)
 {
   char fmt[16];
   error_at_line (st, errno, __FILE__, __LINE__, fmt); /* { dg-warning "use of uninitialized value 'fmt\\\[0\\\]'" } */
-  /* { dg-message "while looking for null terminator for argument 5 \\('&fmt'\\) of 'error_at_line'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 5 \\('&fmt'\\) of 'error_at_line'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 5 \\('& fmt'\\) of 'void error_at_line\\(int, int, const char\\*, unsigned int, const char\\*, ...\\)'..." "event" { target c++ } .-2 } */
 }
diff --git a/gcc/testsuite/c-c++-common/analyzer/error-2-noexcept.c b/gcc/testsuite/c-c++-common/analyzer/error-2-noexcept.c
new file mode 100644
index 00000000000..63f996869fb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/error-2-noexcept.c
@@ -0,0 +1,49 @@ 
+/* { dg-additional-options "-fno-exceptions" } */
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
+typedef __SIZE_TYPE__ size_t;
+
+extern int errno;
+
+extern void free (void *);
+char *strdup (const char *)
+  __attribute__((malloc (free)));
+
+extern size_t strlen (const char *__s)
+  __attribute__ ((__nothrow__ , __leaf__))
+  __attribute__ ((__pure__))
+  __attribute__ ((__nonnull__ (1)));
+
+extern void error (int __status, int __errnum, const char *__format, ...)
+     __attribute__ ((__format__ (__printf__, 3, 4)));
+
+extern void error_at_line (int __status, int __errnum, const char *__fname,
+			   unsigned int __lineno, const char *__format, ...)
+     __attribute__ ((__format__ (__printf__, 5, 6)));
+
+/* PR analyzer/99196; extract taken from
+     https://github.com/libguestfs/libguestfs/blob/f19fd566f6387ce7e4d82409528c9dde374d25e0/daemon/tar.c#L108
+   (which is GPLv2 or later).  */
+
+extern char *read_whole_file (const char *error_file, size_t *out);
+
+#define EXIT_FAILURE 1
+
+char *read_error_file (const char *error_file)
+{
+  size_t len;
+  char *str;
+
+  str = read_whole_file (error_file, &len);
+  if (str == NULL) {
+    str = strdup ("(no error)");
+    if (str == NULL)
+      error (EXIT_FAILURE, errno, "strdup");
+    len = strlen (str); /* { dg-bogus "NULL" } */
+  }
+
+  /* Remove trailing \n character if any. */
+  if (len > 0 && str[len-1] == '\n')
+    str[--len] = '\0';
+
+  return str;                   /* caller frees */
+}
diff --git a/gcc/testsuite/gcc.dg/analyzer/error-3.c b/gcc/testsuite/c-c++-common/analyzer/error-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/error-3.c
rename to gcc/testsuite/c-c++-common/analyzer/error-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/error-uninit.c b/gcc/testsuite/c-c++-common/analyzer/error-uninit.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/error-uninit.c
rename to gcc/testsuite/c-c++-common/analyzer/error-uninit.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-1.c b/gcc/testsuite/c-c++-common/analyzer/explode-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/explode-1.c
rename to gcc/testsuite/c-c++-common/analyzer/explode-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-2.c b/gcc/testsuite/c-c++-common/analyzer/explode-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/explode-2.c
rename to gcc/testsuite/c-c++-common/analyzer/explode-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-2a.c b/gcc/testsuite/c-c++-common/analyzer/explode-2a.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/explode-2a.c
rename to gcc/testsuite/c-c++-common/analyzer/explode-2a.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-3.c b/gcc/testsuite/c-c++-common/analyzer/explode-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/explode-3.c
rename to gcc/testsuite/c-c++-common/analyzer/explode-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/factorial.c b/gcc/testsuite/c-c++-common/analyzer/factorial.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/factorial.c
rename to gcc/testsuite/c-c++-common/analyzer/factorial.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/fdump-analyzer-1.c b/gcc/testsuite/c-c++-common/analyzer/fdump-analyzer-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/fdump-analyzer-1.c
rename to gcc/testsuite/c-c++-common/analyzer/fdump-analyzer-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-1.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-1.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-1.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-1.c
index 83ec1cab58b..6c973802320 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-1.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test_1 (void)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-2.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-2.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-2.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-2.c
index 9fe62d22cc2..b7374896554 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-2.c
@@ -1,7 +1,7 @@ 
 /* Verify that -fno-analyzer-feasibility works.  */
 /* { dg-additional-options "-fno-analyzer-feasibility" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test_1 (int flag)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-4.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-4.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-4.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-4.c
index 1a1128089fb..ffc32061361 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-4.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int rand (void);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-1.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-1.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-1.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-1.c
index 15799d02845..a130ead6b18 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-1.c
@@ -6,7 +6,7 @@ 
 #include <errno.h>
 #include <unistd.h>
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int z;
 
@@ -16,7 +16,7 @@  static void func(void * o)
 }
 
 int main(int    argc,
-         int ** argv)
+         char ** argv)
 {
   struct timespec now;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-2.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-2.c
similarity index 85%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-2.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-2.c
index b86ffd86d5c..1c206da2da7 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107582-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107582-2.c
@@ -1,7 +1,7 @@ 
 #include <stdio.h>
 #include <stdlib.h>
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int z;
 
@@ -10,7 +10,7 @@  static void func(void)
 }
 
 int main(int    argc,
-         int ** argv)
+         char ** argv)
 {
   int * x;
   int   ret = 0;
diff --git a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107948.c b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107948.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/feasibility-pr107948.c
rename to gcc/testsuite/c-c++-common/analyzer/feasibility-pr107948.c
index 5eb8b0aef22..b543f8f2bf4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/feasibility-pr107948.c
+++ b/gcc/testsuite/c-c++-common/analyzer/feasibility-pr107948.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void foo(int width) {
   int i = 0;
diff --git a/gcc/testsuite/gcc.dg/analyzer/ferror-1.c b/gcc/testsuite/c-c++-common/analyzer/ferror-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/ferror-1.c
rename to gcc/testsuite/c-c++-common/analyzer/ferror-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/fibonacci.c b/gcc/testsuite/c-c++-common/analyzer/fibonacci.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/fibonacci.c
rename to gcc/testsuite/c-c++-common/analyzer/fibonacci.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-1.c b/gcc/testsuite/c-c++-common/analyzer/file-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/file-1.c
rename to gcc/testsuite/c-c++-common/analyzer/file-1.c
diff --git a/gcc/testsuite/c-c++-common/analyzer/file-2-noexcept.c b/gcc/testsuite/c-c++-common/analyzer/file-2-noexcept.c
new file mode 100644
index 00000000000..362580a0ae4
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/file-2-noexcept.c
@@ -0,0 +1,26 @@ 
+/* { dg-additional-options "-fno-exceptions" } */
+typedef struct FILE   FILE;
+
+FILE* fopen (const char*, const char*);
+int   fclose (FILE*);
+
+struct foo
+{
+  FILE *m_f;
+};
+
+void test (const char *path)
+{
+  struct foo f;
+  f.m_f = fopen (path, "r");
+
+  if (!f.m_f)
+    return; /* { dg-bogus "leak of FILE" } */
+
+  fclose (f.m_f);
+  fclose (f.m_f); /* { dg-warning "double 'fclose' of FILE 'f.m_f'" "" { target c } } */
+                  /* { dg-warning "double 'fclose' of FILE 'f.foo::m_f'" "" { target c++ } .-1 } */
+}
+
+/* Swallow -Wuse-after-free issued for the same problem
+   { dg-prune-output "-Wuse-after-free" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-3.c b/gcc/testsuite/c-c++-common/analyzer/file-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/file-3.c
rename to gcc/testsuite/c-c++-common/analyzer/file-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c b/gcc/testsuite/c-c++-common/analyzer/file-CWE-1341-example.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c
rename to gcc/testsuite/c-c++-common/analyzer/file-CWE-1341-example.c
index 9d125dfefe5..d4c1f02e8f2 100644
--- a/gcc/testsuite/gcc.dg/analyzer/file-CWE-1341-example.c
+++ b/gcc/testsuite/c-c++-common/analyzer/file-CWE-1341-example.c
@@ -21,6 +21,7 @@ 
 
 /* Checks double-fclose only, suppress CWE-415. (PR analyzer/108722).  */
 /* { dg-additional-options -Wno-analyzer-double-free } */
+/* { dg-additional-options "-fno-exceptions" { target c++ } } */
 
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-meaning-1.c b/gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/file-meaning-1.c
rename to gcc/testsuite/c-c++-common/analyzer/file-meaning-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-paths-1.c b/gcc/testsuite/c-c++-common/analyzer/file-paths-1.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/file-paths-1.c
rename to gcc/testsuite/c-c++-common/analyzer/file-paths-1.c
index f35017835d4..daa8032d264 100644
--- a/gcc/testsuite/gcc.dg/analyzer/file-paths-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/file-paths-1.c
@@ -1,4 +1,6 @@ 
 /* { dg-additional-options "-fanalyzer-verbosity=3" } */
+/* { dg-additional-options "-fno-exceptions" { target c++ } } */
+
 
 typedef struct FILE   FILE;
 
@@ -6,7 +8,7 @@  FILE* fopen (const char*, const char*);
 int   fclose (FILE*);
 char *fgets (char *, int, FILE *);
 
-#define NULL ((void *)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 
 /* Verify that we correctly emit CFG events in the face of buffers
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-1.c
similarity index 88%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-1.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-1.c
index 6b5590a433a..15d66995c30 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-1.c
@@ -1,4 +1,5 @@ 
 /* { dg-require-effective-target alloca } */
+/* { dg-additional-options "-fpermissive" { target c++ } } */
 
 #include <stdlib.h>
 
@@ -236,7 +237,7 @@  void test_20 (void)
 
 int *test_21 (int i)
 {
-  int *ptr = malloc (sizeof (int));
+  int *ptr = (int *) malloc (sizeof (int));
   if (!ptr)
     abort ();
   *ptr = i;
@@ -269,13 +270,13 @@  int *test_23a (int n)
   return ptr;
 }
 
-int test_24 (void)
+void test_24 (void)
 {
   void *ptr = __builtin_alloca (sizeof (int)); /* { dg-message "region created on stack here" } */
   free (ptr); /* { dg-warning "'free' of 'ptr' which points to memory on the stack \\\[CWE-590\\\]" } */
 }
 
-int test_25 (void)
+void test_25 (void)
 {
   char tmp[100]; /* { dg-message "region created on stack here" } */
   void *p = tmp;
@@ -285,7 +286,7 @@  int test_25 (void)
 
 char global_buffer[100]; /* { dg-message "region created here" } */
 
-int test_26 (void)
+void test_26 (void)
 {
   void *p = global_buffer;
   free (p); /* { dg-warning "'free' of 'p' which points to memory not on the heap \\\[CWE-590\\\]" } */
@@ -357,8 +358,9 @@  void test_30 (void)
 {
   struct link tmp;
   tmp.m_ptr = (struct link *)malloc (sizeof (struct link)); /* { dg-message "allocated here" } */
-} /* { dg-warning "leak of 'tmp.m_ptr'" } */ 
-/* { dg-bogus "leak of '<unknown>'" "leak of unknown" { target *-*-* } .-1 } */
+} /* { dg-warning "leak of 'tmp.m_ptr'" "" { target c } } */
+/* { dg-warning "leak of 'tmp.link::m_ptr'" "" { target c++ } .-1 } */
+/* { dg-bogus "leak of '<unknown>'" "leak of unknown" { target *-*-* } .-2 } */
 
 void test_31 (void)
 {
@@ -383,7 +385,7 @@  void test_33 (void)
 void test_34 (void)
 {
   float *q;
-  struct coord *p = malloc (sizeof (struct coord));
+  struct coord *p = (struct coord *) malloc (sizeof (struct coord));
   if (!p)
     return;
   p->x = 0.0f;
@@ -482,7 +484,7 @@  test_41 (int flag)
 
 void test_42a (void)
 {
-  void *p = malloc (1024); /* { dg-message "allocated here" } */
+  char *p = (char *)malloc (1024); /* { dg-message "allocated here" } */
   free (p + 64); /* this could well corrupt the heap.  */
   /* TODO: ^^^ we should warn about this.  */
 } /* { dg-warning "leak of 'p'" } */
@@ -492,7 +494,7 @@  void test_42a (void)
 
 void test_42b (void)
 {
-  void *p = malloc (1024); /* { dg-message "allocated here" } */
+  char *p = (char *)malloc (1024); /* { dg-message "allocated here" } */
   free (p - 64); /* this could well corrupt the heap.  */
   /* TODO: ^^^ we should warn about this.  */
 } /* { dg-warning "leak of 'p'" } */
@@ -502,16 +504,16 @@  void test_42b (void)
 
 void test_42c (void)
 {
-  void *p = malloc (1024);
-  void *q = p + 64;
+  char *p = (char *)malloc (1024);
+  char *q = p + 64;
   free (q - 64); /* this is probably OK.  */
 } /* { dg-bogus "leak of 'p'" } */
 
 void *
 test_42d (void)
 {
-  void *p = malloc (1024);
-  void *q = p + 64;
+  char *p = (char *)malloc (1024);
+  char *q = p + 64;
   return q;
 } /* { dg-bogus "leak of 'p'" } */
 
@@ -535,18 +537,19 @@  struct link global_link;
 
 void test_43 (void)
 {
-  global_link.m_ptr = malloc (sizeof (struct link)); /* { dg-message "allocated here" } */
-  global_link.m_ptr = NULL; /* { dg-warning "leak of 'global_link.m_ptr'" } */
+  global_link.m_ptr = (struct link *) malloc (sizeof (struct link)); /* { dg-message "allocated here" } */
+  global_link.m_ptr = NULL; /* { dg-warning "leak of 'global_link.m_ptr'" "" { target c } } */
+  /* { dg-warning "leak of 'global_link.link::m_ptr'" "" { target c++ } .-1 } */
 }
 
 struct link *global_ptr;
 
 void test_44 (void)
 {
-  global_ptr = malloc (sizeof (struct link));
+  global_ptr = (struct link *) malloc (sizeof (struct link));
   if (!global_ptr)
     return;
-  global_ptr->m_ptr = malloc (sizeof (struct link)); /* { dg-message "allocated here" } */
+  global_ptr->m_ptr = (struct link *) malloc (sizeof (struct link)); /* { dg-message "allocated here" } */
   free (global_ptr); /* { dg-warning "leak of '<unknown>'" } */
   /* TODO: should be more precise than just '<unknown>'.  */
 }
@@ -573,10 +576,10 @@  extern int maybe_alloc (char **);
 
 int test_47 (void)
 {
-  char *p = ((void *)0);
+  char *p = (char *)((void *)0);
   int p_size = 0;
 
-  p = malloc (16);
+  p = (char *)malloc (16);
   if (p) {
     free (p);
   } else {
@@ -616,13 +619,16 @@  void test_50a (void)
 
 void test_50b (void)
 {
-  free (test_50a); /* { dg-warning "'free' of '&test_50a' which points to memory not on the heap \\\[CWE-590\\\]" } */
+  free (test_50a); /* { dg-warning "'free' of '&test_50a' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c } } */
+  /* { dg-warning "'free' of 'test_50a' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c++ } .-1 } */
+  /* { dg-warning "invalid conversion from '\[^\n\]*' to 'void\\*" "fpermissive" { target c++ } .-2 } */
 }
 
 void test_50c (void)
 {
  my_label:
-  free (&&my_label); /* { dg-warning "'free' of '&my_label' which points to memory not on the heap \\\[CWE-590\\\]" } */
+  free (&&my_label); /* { dg-warning "'free' of '&my_label' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c } } */
+  /* { dg-warning "'free' of '&& my_label' which points to memory not on the heap \\\[CWE-590\\\]" "" { target c++ } .-1 } */
 }
 
 /* Double free after unconditional dereference.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-10.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-10.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-10.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-10.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-12.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-12.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-12.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-12.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-13.c
similarity index 68%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-13.c
index a08386a4626..8923db06ad3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-13.c
@@ -23,7 +23,8 @@  void test (struct foo f)
 
   do_stuff ();
 
-  calls_free (f.m_p); /* { dg-message "passing freed pointer 'f\\.m_p' in call to 'calls_free' from 'test'" } */
+  calls_free (f.m_p); /* { dg-message "passing freed pointer 'f\\.m_p' in call to 'calls_free' from 'test'" "" { target c } } */
+  /* { dg-message "passing freed pointer 'f\\.foo::m_p' in call to 'calls_free' from 'test'" "" { target c++ } .-1 } */
 
   do_stuff ();
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-13a.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-13a.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-13a.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-double-free.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-double-free.c
similarity index 51%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-double-free.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-double-free.c
index 580862b0138..a2a63a5785b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-double-free.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-double-free.c
@@ -189,7 +189,151 @@  void test (int i)
                   |      |   |
                   |      |   (23) second 'free' here; first 'free' was at (16)
                   |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   NN |   free (ptr);
+      |   ~~~~~^~~~~
+  'void test(int)': events 1-2
+    |
+    |   NN | void test (int i)
+    |      |      ^~~~
+    |      |      |
+    |      |      (1) entry to 'test'
+    |   NN | {
+    |   NN |   boxed_int *obj = make_boxed_int (i);
+    |      |                    ~~~~~~~~~~~~~~~~~~
+    |      |                                   |
+    |      |                                   (2) calling 'make_boxed_int' from 'test'
+    |
+    +--> 'boxed_int* make_boxed_int(int)': events 3-4
+           |
+           |   NN | make_boxed_int (int i)
+           |      | ^~~~~~~~~~~~~~
+           |      | |
+           |      | (3) entry to 'make_boxed_int'
+           |   NN | {
+           |   NN |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
+           |      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+           |      |                                                   |
+           |      |                                                   (4) calling 'wrapped_malloc' from 'make_boxed_int'
+           |
+           +--> 'void* wrapped_malloc(size_t)': events 5-6
+                  |
+                  |   NN | void *wrapped_malloc (size_t size)
+                  |      |       ^~~~~~~~~~~~~~
+                  |      |       |
+                  |      |       (5) entry to 'wrapped_malloc'
+                  |   NN | {
+                  |   NN |   return malloc (size);
+                  |      |          ~~~~~~~~~~~~~
+                  |      |                 |
+                  |      |                 (6) allocated here
+                  |
+           <------+
+           |
+         'boxed_int* make_boxed_int(int)': events 7-10
+           |
+           |   NN |   boxed_int *result = (boxed_int *)wrapped_malloc (sizeof (boxed_int));
+           |      |                                    ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
+           |      |                                                   |
+           |      |                                                   (7) returning to 'make_boxed_int' from 'wrapped_malloc'
+           |   NN |   if (!result)
+           |      |   ~~                                               
+           |      |   |
+           |      |   (8) assuming 'result' is non-NULL
+           |      |   (9) following 'false' branch (when 'result' is non-NULL)...
+           |   NN |     abort ();
+           |   NN |   result->i = i;
+           |      |   ~~~~~~~~~~~~~                                    
+           |      |             |
+           |      |             (10) ...to here
+           |
+    <------+
+    |
+  'void test(int)': events 11-12
+    |
+    |   NN |   boxed_int *obj = make_boxed_int (i);
+    |      |                    ~~~~~~~~~~~~~~~^~~
+    |      |                                   |
+    |      |                                   (11) returning to 'test' from 'make_boxed_int'
+    |   NN | 
+    |   NN |   free_boxed_int (obj);
+    |      |   ~~~~~~~~~~~~~~~~~~~~             
+    |      |                  |
+    |      |                  (12) calling 'free_boxed_int' from 'test'
+    |
+    +--> 'void free_boxed_int(boxed_int*)': events 13-14
+           |
+           |   NN | free_boxed_int (boxed_int *bi)
+           |      | ^~~~~~~~~~~~~~
+           |      | |
+           |      | (13) entry to 'free_boxed_int'
+           |   NN | {
+           |   NN |   wrapped_free (bi);
+           |      |   ~~~~~~~~~~~~~~~~~
+           |      |                |
+           |      |                (14) calling 'wrapped_free' from 'free_boxed_int'
+           |
+           +--> 'void wrapped_free(void*)': events 15-16
+                  |
+                  |   NN | void wrapped_free (void *ptr)
+                  |      |      ^~~~~~~~~~~~
+                  |      |      |
+                  |      |      (15) entry to 'wrapped_free'
+                  |   NN | {
+                  |   NN |   free (ptr);
+                  |      |   ~~~~~~~~~~
+                  |      |        |
+                  |      |        (16) first 'free' here
+                  |
+           <------+
+           |
+         'void free_boxed_int(boxed_int*)': event 17
+           |
+           |   NN |   wrapped_free (bi);
+           |      |   ~~~~~~~~~~~~~^~~~
+           |      |                |
+           |      |                (17) returning to 'free_boxed_int' from 'wrapped_free'
+           |
+    <------+
+    |
+  'void test(int)': events 18-19
+    |
+    |   NN |   free_boxed_int (obj);
+    |      |   ~~~~~~~~~~~~~~~^~~~~
+    |      |                  |
+    |      |                  (18) returning to 'test' from 'free_boxed_int'
+    |   NN | 
+    |   NN |   free_boxed_int (obj);
+    |      |   ~~~~~~~~~~~~~~~~~~~~
+    |      |                  |
+    |      |                  (19) passing freed pointer 'obj' in call to 'free_boxed_int' from 'test'
+    |
+    +--> 'void free_boxed_int(boxed_int*)': events 20-21
+           |
+           |   NN | free_boxed_int (boxed_int *bi)
+           |      | ^~~~~~~~~~~~~~
+           |      | |
+           |      | (20) entry to 'free_boxed_int'
+           |   NN | {
+           |   NN |   wrapped_free (bi);
+           |      |   ~~~~~~~~~~~~~~~~~
+           |      |                |
+           |      |                (21) passing freed pointer 'bi' in call to 'wrapped_free' from 'free_boxed_int'
+           |
+           +--> 'void wrapped_free(void*)': events 22-23
+                  |
+                  |   NN | void wrapped_free (void *ptr)
+                  |      |      ^~~~~~~~~~~~
+                  |      |      |
+                  |      |      (22) entry to 'wrapped_free'
+                  |   NN | {
+                  |   NN |   free (ptr);
+                  |      |   ~~~~~~~~~~
+                  |      |        |
+                  |      |        (23) second 'free' here; first 'free' was at (16)
+                  |
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* TODO: the event describing the allocation is uninteresting and probably
    should be purged.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-a.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-a.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-a.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-a.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-b.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-b.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-b.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-b.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-c.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-c.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto-c.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto-c.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto.h b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto.h
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-8-lto.h
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-8-lto.h
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-ipa-9.c b/gcc/testsuite/c-c++-common/analyzer/malloc-ipa-9.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-ipa-9.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-ipa-9.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-1.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-2.c b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-2.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-2.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-2.c
index 9f6440b52b2..3d4048e5586 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-2.c
@@ -15,7 +15,7 @@  extern void Py_Dealloc (PyObject *op);
 	Py_Dealloc((PyObject *)(op));			\
     } while (0)
 
-int test (PyObject *obj_01, PyObject *obj_02, PyObject *obj_03,
+void test (PyObject *obj_01, PyObject *obj_02, PyObject *obj_03,
 	  PyObject *obj_04, PyObject *obj_05, PyObject *obj_06,
 	  PyObject *obj_07, PyObject *obj_08, PyObject *obj_09,
 	  PyObject *obj_10, PyObject *obj_11, PyObject *obj_12,
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-many-paths-3.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-many-paths-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-meaning-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-meaning-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-meaning-1.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-meaning-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-1.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-10.c
similarity index 85%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-10.c
index ef88388267b..547c4cc2a84 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-10.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-10.c
@@ -1,7 +1,7 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
-int test (int flag)
+void test (int flag)
 {
   int other_flag;
   if (flag)
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-2.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-2.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-2.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-2.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-3.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-4.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-4.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-4.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-4.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-5.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-5.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-5.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-6.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-6.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-6.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-6.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-7.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-7.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-7.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c b/gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-paths-8.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-paths-8.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-reuse.c b/gcc/testsuite/c-c++-common/analyzer/malloc-reuse.c
similarity index 95%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-reuse.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-reuse.c
index 4575ff5563d..1205ee09c97 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-reuse.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-reuse.c
@@ -1,7 +1,7 @@ 
 /* { dg-require-effective-target alloca } */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Multiple calls to malloc (without a free) should return non-equal pointers.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c b/gcc/testsuite/c-c++-common/analyzer/malloc-sarif-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-sarif-1.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-sarif-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
index bf77862e67c..6c2c215bd14 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1a.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1a.c
@@ -1,7 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-call-summaries -fanalyzer-transitivity" } */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1b.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1b.c
index a30b8c0e080..038e3fe2f16 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-1b.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-1b.c
@@ -1,7 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-call-summaries" } */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
index 9001fe66cd7..9e833eb3517 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-2.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
index 0196389d3a5..3b83916d108 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-3.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-4.c b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-4.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-4.c
rename to gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-4.c
index 7410a717762..b8cac71e85a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/malloc-vs-local-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/malloc-vs-local-4.c
@@ -22,7 +22,7 @@  void __attribute__((noinline)) callee_2 (int *ptr)
   *ptr = 42;
 }
 
-int test_2 (int flag)
+void test_2 (int flag)
 {
   int i;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/many-disabled-diagnostics.c b/gcc/testsuite/c-c++-common/analyzer/many-disabled-diagnostics.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/many-disabled-diagnostics.c
rename to gcc/testsuite/c-c++-common/analyzer/many-disabled-diagnostics.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/many-unused-locals.c b/gcc/testsuite/c-c++-common/analyzer/many-unused-locals.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/many-unused-locals.c
rename to gcc/testsuite/c-c++-common/analyzer/many-unused-locals.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/memcpy-1.c b/gcc/testsuite/c-c++-common/analyzer/memcpy-1.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/memcpy-1.c
rename to gcc/testsuite/c-c++-common/analyzer/memcpy-1.c
index b1ffed0a979..4f7099eabfe 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memcpy-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/memcpy-1.c
@@ -1,9 +1,10 @@ 
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Function for thwarting expansion of memcpy by optimizer.  */
 
 typedef void * (*memcpy_t) (void *dst, const void *src, size_t n);
+extern void *__memcpy_chk (void *, const void *, size_t, size_t);
   
 static memcpy_t __attribute__((noinline))
 get_memcpy (void)
diff --git a/gcc/testsuite/gcc.dg/analyzer/memcpy-pr107882.c b/gcc/testsuite/c-c++-common/analyzer/memcpy-pr107882.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/memcpy-pr107882.c
rename to gcc/testsuite/c-c++-common/analyzer/memcpy-pr107882.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/memmove-1.c b/gcc/testsuite/c-c++-common/analyzer/memmove-1.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/memmove-1.c
rename to gcc/testsuite/c-c++-common/analyzer/memmove-1.c
index 06627ede081..ff8407d3533 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memmove-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/memmove-1.c
@@ -1,9 +1,11 @@ 
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Function for thwarting expansion of memmove by optimizer.  */
 
 typedef void * (*memmove_t) (void *dst, const void *src, size_t n);
+extern void *__memmove_chk (void *, const void *, size_t, size_t);
+
   
 static memmove_t __attribute__((noinline))
 get_memmove (void)
diff --git a/gcc/testsuite/gcc.dg/analyzer/memset-1.c b/gcc/testsuite/c-c++-common/analyzer/memset-1.c
similarity index 99%
rename from gcc/testsuite/gcc.dg/analyzer/memset-1.c
rename to gcc/testsuite/c-c++-common/analyzer/memset-1.c
index 75aef53d348..264db089493 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memset-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/memset-1.c
@@ -1,5 +1,5 @@ 
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Zero-fill of uninitialized buffer.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/memset-2.c b/gcc/testsuite/c-c++-common/analyzer/memset-2.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/memset-2.c
rename to gcc/testsuite/c-c++-common/analyzer/memset-2.c
index de7c973b1fd..c3636bf040f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memset-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/memset-2.c
@@ -1,6 +1,6 @@ 
 /* { dg-additional-options "-fdump-analyzer-untracked" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct S
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c b/gcc/testsuite/c-c++-common/analyzer/memset-CVE-2017-18549-1.c
similarity index 95%
rename from gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c
rename to gcc/testsuite/c-c++-common/analyzer/memset-CVE-2017-18549-1.c
index 418168d413e..1d2de63c6fc 100644
--- a/gcc/testsuite/gcc.dg/analyzer/memset-CVE-2017-18549-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/memset-CVE-2017-18549-1.c
@@ -7,7 +7,7 @@ 
 
 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 #include <string.h>
 
 typedef unsigned int __u32;
@@ -43,7 +43,7 @@  extern void check_uninit (u8 v);
 
 /* Adapted from drivers/scsi/aacraid/commctrl.c  */
 
-static int aac_send_raw_srb(/* [...snip...] */)
+static void aac_send_raw_srb(/* [...snip...] */)
 {
 	u32 byte_count = 0;
 
@@ -74,7 +74,7 @@  static int aac_send_raw_srb(/* [...snip...] */)
 	check_uninit (reply.padding[1]); /* { dg-warning "uninitialized value" } */
 }
 
-static int aac_send_raw_srb_fixed(/* [...snip...] */)
+static void aac_send_raw_srb_fixed(/* [...snip...] */)
 {
 	u32 byte_count = 0;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-Wunused-macros.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-Wunused-macros.c
similarity index 94%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-Wunused-macros.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-Wunused-macros.c
index 0b31cc42d78..356d8f9962a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-Wunused-macros.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-Wunused-macros.c
@@ -3,7 +3,7 @@ 
 
 /* { dg-additional-options "-Wunused-macros" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-command-line.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-command-line.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-command-line.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-command-line.c
index 4a3dd16752e..a6a5062dd25 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-command-line.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-command-line.c
@@ -1,6 +1,6 @@ 
 /* { dg-additional-options "-DO_ACCMODE=42 -DO_RDONLY=0x1 -DO_WRONLY=010" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test_sm_fd_constants (void)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum-and-macro.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum-and-macro.c
similarity index 81%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum-and-macro.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum-and-macro.c
index 9e6cbeeb036..80ebbed29b0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum-and-macro.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum-and-macro.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 enum __foo {
      O_ACCMODE = 1,
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum.c
index e6b77b8dd18..5fbe51f714b 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-enum.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-enum.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 enum {
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-2.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-2.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-2.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-2.c
index 9c019e7c5ef..4bcb0fad23e 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-2.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine, as macros
    that can't be handled.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-3.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-3.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-3.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-3.c
index 2a3f2b0070a..ce296b027a3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-3.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine, as macros
    that can't be handled.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-4.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-4.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-4.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-4.c
index 16eef964051..918ab27eac1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-4.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine, as macros
    that can't be handled.  */
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-empty.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-empty.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-empty.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-empty.c
index 3d347e2caf5..243ad303b32 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-empty.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-empty.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-gc.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-gc.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-gc.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-gc.c
index e7b12f325a5..cc8c0d39f32 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-gc.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-gc.c
@@ -1,6 +1,6 @@ 
 /* { dg-additional-options "--param ggc-min-expand=0 --param ggc-min-heapsize=0" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-traditional.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-traditional.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-traditional.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-traditional.c
index 64acaad6aa0..c17b726919d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-traditional.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-traditional.c
@@ -1,6 +1,6 @@ 
 /* { dg-additional-options "-traditional-cpp" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-undef.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-undef.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-undef.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-undef.c
index 46c03223190..ed7354acb6a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros-undef.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros-undef.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros.c b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros.c
rename to gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros.c
index 2022f98e5b6..ede9804e39a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/named-constants-via-macros.c
+++ b/gcc/testsuite/c-c++-common/analyzer/named-constants-via-macros.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Various constants used by the fd state machine.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-1.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c
rename to gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-1.c
index 3fe061bdbd8..bae9397651f 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-1.c
@@ -1,6 +1,16 @@ 
 /* { dg-require-effective-target ptr_eq_long } */
 /* { dg-additional-options "-O2 -Wno-shift-count-overflow" } */
 
+#define REGISTER register
+
+#ifdef __cplusplus 
+#define _Bool bool
+#if __cplusplus >= 201703L
+#undef REGISTER
+#define REGISTER
+#endif
+#endif
+
 struct lisp;
 union vectorlike_header { long size; };
 struct Lisp_Symbol { void *unused; };
@@ -114,7 +124,7 @@  wset_combination (struct window *w, _Bool horflag, struct lisp *val)
 extern struct lisp *selected_window;
 
 struct window *
-decode_live_window (register struct lisp *window)
+decode_live_window (REGISTER struct lisp *window)
 {
   if (NILP (window))
     return XWINDOW (selected_window);
@@ -124,7 +134,7 @@  decode_live_window (register struct lisp *window)
 }
 
 struct window *
-decode_any_window (register struct lisp *window)
+decode_any_window (REGISTER struct lisp *window)
 {
   struct window *w;
   if (NILP (window))
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-2.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c
rename to gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-2.c
index 298e4839b98..55c45249a87 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr102671-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr102671-2.c
@@ -1,6 +1,10 @@ 
 /* { dg-require-effective-target ptr_eq_long } */
 /* { dg-additional-options "-O2 -Wno-shift-count-overflow" } */
 
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
+
 struct lisp;
 union vectorlike_header { long size; };
 struct Lisp_Symbol { void *unused; };
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr105755.c
similarity index 98%
rename from gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c
rename to gcc/testsuite/c-c++-common/analyzer/null-deref-pr105755.c
index 2b0ba292e00..ff519e68a56 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-deref-pr105755.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-deref-pr105755.c
@@ -1,6 +1,10 @@ 
 /* { dg-require-effective-target int32plus } */
 /* { dg-additional-options "-Wno-analyzer-too-complex -O2" } */
 
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
+
 typedef long int ptrdiff_t;
 typedef long int EMACS_INT;
 typedef long int intmax_t;
diff --git a/gcc/testsuite/gcc.dg/analyzer/null-terminated-strings-1.c b/gcc/testsuite/c-c++-common/analyzer/null-terminated-strings-1.c
similarity index 73%
rename from gcc/testsuite/gcc.dg/analyzer/null-terminated-strings-1.c
rename to gcc/testsuite/c-c++-common/analyzer/null-terminated-strings-1.c
index c9095fa3b94..64ef69ff6e4 100644
--- a/gcc/testsuite/gcc.dg/analyzer/null-terminated-strings-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/null-terminated-strings-1.c
@@ -1,6 +1,6 @@ 
-#include "analyzer-decls.h"
+/* { dg-additional-options "-fpermissive" { target c++ } } */
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
-#define NULL ((void *)0)
 typedef __SIZE_TYPE__ size_t;
 
 void test_terminated (void)
@@ -10,16 +10,17 @@  void test_terminated (void)
 
 void test_unterminated (void)
 {
-  char buf[3] = "abc";
+  char buf[3] = "abc";  /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "" { target c++ } } */
   __analyzer_get_strlen (buf); /* { dg-warning "stack-based buffer over-read" } */
   /* { dg-message "out-of-bounds read at byte 3 but 'buf' ends at byte 3" "bad read event" { target *-*-* } .-1 } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "null terminator event" { target *-*-* } .-2 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "null terminator event" { target c } .-2 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('& buf'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "null terminator event" { target c++ } .-3 } */
 }
 
 void test_embedded_nuls (void)
 {
   /*             0123 456 78.  */
-  char buf[9] = "abc\0pq\0xy"; /* unterminated.  */
+  char buf[9] = "abc\0pq\0xy";  /* { dg-warning "initializer-string for '\[^\n\]*' is too long" "unterminated" { target c++ } } */
   __analyzer_eval (__analyzer_get_strlen (buf) == 3); /* { dg-warning "TRUE" } */
   __analyzer_eval (__analyzer_get_strlen (buf + 1) == 2); /* { dg-warning "TRUE" } */
   __analyzer_eval (__analyzer_get_strlen (buf + 2) == 1); /* { dg-warning "TRUE" } */
@@ -28,7 +29,8 @@  void test_embedded_nuls (void)
   __analyzer_eval (__analyzer_get_strlen (buf + 5) == 1); /* { dg-warning "TRUE" } */
   __analyzer_eval (__analyzer_get_strlen (buf + 6) == 0); /* { dg-warning "TRUE" } */
   __analyzer_get_strlen (buf + 7); /* { dg-warning "stack-based buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
   // TODO: fix the "<unknown>" here?
 }
 
@@ -36,7 +38,8 @@  void test_before_start_of_buffer (void)
 {
   const char *buf = "abc";
   __analyzer_get_strlen (buf - 1); /* { dg-warning "buffer under-read" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
   // TODO: fix the "<unknown>" here?
 }
 
@@ -44,7 +47,8 @@  void test_after_end_of_buffer (void)
 {
   const char *buf = "abc";
   __analyzer_get_strlen (buf + 4); /* { dg-warning "buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */  
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('<unknown>'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
   // TODO: fix the "<unknown>" here?
 }
 
@@ -55,14 +59,16 @@  void test_fully_initialized_but_unterminated (void)
   buf[1] = 'b';
   buf[2] = 'c';
   __analyzer_get_strlen (buf); /* { dg-warning "stack-based buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('& buf'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
 }
 
 void test_uninitialized (void)
 {
   char buf[16];
   __analyzer_get_strlen (buf); /* { dg-warning "use of uninitialized value 'buf\\\[0\\\]'" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('& buf'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
 }
 
 void test_partially_initialized (void)
@@ -70,14 +76,15 @@  void test_partially_initialized (void)
   char buf[16];
   buf[0] = 'a';
   __analyzer_get_strlen (buf); /* { dg-warning "use of uninitialized value 'buf\\\[1\\\]'" } */
-  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target *-*-* } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('&buf'\\) of '__analyzer_get_strlen'..." "event" { target c } .-1 } */
+  /* { dg-message "while looking for null terminator for argument 1 \\('& buf'\\) of '(long )?unsigned int __analyzer_get_strlen\\(const char\\*\\)'..." "event" { target c++ } .-2 } */
 }
 
 char *test_dynamic_1 (void)
 {
   const char *kvstr = "NAME=value";
   size_t len = __builtin_strlen (kvstr);
-  char *ptr = __builtin_malloc (len + 1);
+  char *ptr = (char *)__builtin_malloc (len + 1);
   if (!ptr)
     return NULL;
   __builtin_memcpy (ptr, kvstr, len);
@@ -91,7 +98,7 @@  char *test_dynamic_2 (void)
 {
   const char *kvstr = "NAME=value";
   size_t len = __builtin_strlen (kvstr);
-  char *ptr = __builtin_malloc (len + 1);
+  char *ptr = (char *)__builtin_malloc (len + 1);
   if (!ptr)
     return NULL;
   __builtin_memcpy (ptr, kvstr, len);
@@ -104,7 +111,7 @@  char *test_dynamic_2 (void)
 char *test_dynamic_3 (const char *src)
 {
   size_t len = __builtin_strlen (src);
-  char *ptr = __builtin_malloc (len + 1);
+  char *ptr = (char *)__builtin_malloc (len + 1);
   if (!ptr)
     return NULL;
   __builtin_memcpy (ptr, src, len);
@@ -117,7 +124,7 @@  char *test_dynamic_3 (const char *src)
 char *test_dynamic_4 (const char *src)
 {
   size_t len = __builtin_strlen (src);
-  char *ptr = __builtin_malloc (len + 1);
+  char *ptr = (char *)__builtin_malloc (len + 1);
   if (!ptr)
     return NULL;
   __builtin_memcpy (ptr, src, len);
diff --git a/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c b/gcc/testsuite/c-c++-common/analyzer/omp-parallel-for-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-1.c
rename to gcc/testsuite/c-c++-common/analyzer/omp-parallel-for-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-get-min.c b/gcc/testsuite/c-c++-common/analyzer/omp-parallel-for-get-min.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/omp-parallel-for-get-min.c
rename to gcc/testsuite/c-c++-common/analyzer/omp-parallel-for-get-min.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/operations.c b/gcc/testsuite/c-c++-common/analyzer/operations.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/operations.c
rename to gcc/testsuite/c-c++-common/analyzer/operations.c
index 79e76bccc66..eee01c5cd42 100644
--- a/gcc/testsuite/gcc.dg/analyzer/operations.c
+++ b/gcc/testsuite/c-c++-common/analyzer/operations.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int i, int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-3.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-3.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-3.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-4.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-4.c
index 9cd8bda76c3..f79aab2e576 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-4.c
@@ -1,6 +1,12 @@ 
 /* { dg-additional-options "-Wno-stringop-overflow -Wno-stringop-truncation" } */
 #include <string.h>
 
+#ifdef __cplusplus
+#define CONST_CAST(type, v) const_cast<type> (v)
+#else
+#define CONST_CAST(type, v) v
+#endif
+
 /* Wanalyzer-out-of-bounds tests for strpy-related overflows.
   
    The intra-procedural tests are all caught by Wstringop-overflow.
@@ -24,7 +30,7 @@  void test2 (void)
 
 void test3 (void)
 {
-  char *src = "Hello";
+  char *src = CONST_CAST(char *, "Hello");
   char dst[5];
   strcpy (dst, src); /* { dg-line test3 } */
 
@@ -35,7 +41,7 @@  void test3 (void)
 
 void test4 (void)
 {
-  char *src = "Hello";
+  char *src = CONST_CAST(char *, "Hello");
   char dst[6];
   strcpy (dst, src);
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-container_of.c
similarity index 90%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-container_of.c
index ef460f4e772..5a3ac279512 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-container_of.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-container_of.c
@@ -11,7 +11,7 @@  struct outer {
 
 struct outer *container_of (struct inner *ptr_to_inner)
 {
-  struct outer *ptr_to_outer = ((struct outer *) (((void *) ptr_to_inner) - __builtin_offsetof(struct outer, inner_struct)));
+  struct outer *ptr_to_outer = ((struct outer *) (((char *)(void *) ptr_to_inner) - (char *)__builtin_offsetof(struct outer, inner_struct)));
   return ptr_to_outer;
 }
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-coreutils.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-coreutils.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-coreutils.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-curl.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-curl.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-curl.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-ascii.c
similarity index 52%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-ascii.c
index 5e6eadcf27d..1eb0ee58578 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-ascii.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-ascii.c
@@ -31,7 +31,7 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
            |           |
            |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
            |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -52,4 +52,43 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
           |capacity: 40 bytes|                |overflow of 4 bytes|
           +------------------+                +-------------------+
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   arr[10] = x;
+   ~~~~~~~~^~~
+  event 1 (depth 0)
+    |
+    | int32_t arr[10];
+    |         ^~~
+    |         |
+    |         (1) capacity: 40 bytes
+    |
+    +--> 'void int_arr_write_element_after_end_off_by_one(int32_t)': event 2 (depth 1)
+           |
+           |   arr[10] = x;
+           |   ~~~~~~~~^~~
+           |           |
+           |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+           |
+   { dg-end-multiline-output "" { target c++ } } */
+
+/* { dg-begin-multiline-output "" }
+
+                                            +----------------------------------------+
+                                            |write from 'int32_t x' (type: 'int32_t')|
+                                            +----------------------------------------+
+                                                                |
+                                                                |
+                                                                v
+  +------------+------------+--------------++----------------------------------------+
+  |    [0]     |    ...     |     [9]      ||                                        |
+  +------------+------------+--------------+|           after valid range            |
+  |'int32_t arr [10]' (type: 'int32_t[10]')||                                        |
+  +----------------------------------------++----------------------------------------+
+  |~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
+                      |                                         |
+            +---------+--------+                      +---------+---------+
+            |capacity: 40 bytes|                      |overflow of 4 bytes|
+            +------------------+                      +-------------------+
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-debug.c
similarity index 51%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-debug.c
index 4c4d9d1b867..e8bfafeac76 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-debug.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-debug.c
@@ -37,4 +37,29 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
          |capacity: 40 bytes|                 |overflow of 4 bytes|
          +------------------+                 +-------------------+
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  +-----------+------------+---------------+---+----------------------------------------+
+  |    tc0    |    tc1     |      tc2      |tc3|                  tc4                   |
+  +-----------+------------+---------------+---+----------------------------------------+
+  | bytes 0-3 | bytes 4-35 |  bytes 36-39  |   |              bytes 40-43               |
+  +-----------+------------+---------------+   +----------------------------------------+
+                                               +----------------------------------------+
+                                               |write from 'int32_t x' (type: 'int32_t')|
+                                               +----------------------------------------+
+                                                                   |
+                                                                   |
+                                                                   v
+  +-----------+------------+---------------+   +----------------------------------------+
+  |    [0]    |    ...     |      [9]      |   |                                        |
+  +-----------+------------+---------------+   |           after valid range            |
+  |'int32_t arr [10]' (type: 'int32_t[10]')|   |                                        |
+  +----------------------------------------+   +----------------------------------------+
+  |~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|   |~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
+                      |                                            |
+            +---------+--------+                         +---------+---------+
+            |capacity: 40 bytes|                         |overflow of 4 bytes|
+            +------------------+                         +-------------------+
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-emoji.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-emoji.c
index 1c6125225ff..ce3373a4bab 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-emoji.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-emoji.c
@@ -31,7 +31,25 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
            |           |
            |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
            |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   arr[10] = x;
+   ~~~~~~~~^~~
+  event 1 (depth 0)
+    |
+    | int32_t arr[10];
+    |         ^~~
+    |         |
+    |         (1) capacity: 40 bytes
+    |
+    +--> 'void int_arr_write_element_after_end_off_by_one(int32_t)': event 2 (depth 1)
+           |
+           |   arr[10] = x;
+           |   ~~~~~~~~^~~
+           |           |
+           |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+           |
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -52,4 +70,24 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
           │capacity: 40 bytes│              │⚠️  overflow of 4 bytes│
           ╰──────────────────╯              ╰──────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────────────┐
+                                            │write from 'int32_t x' (type: 'int32_t')│
+                                            └────────────────────────────────────────┘
+                                                                │
+                                                                │
+                                                                v
+  ┌────────────┬────────────┬──────────────┐┌────────────────────────────────────────┐
+  │    [0]     │    ...     │     [9]      ││                                        │
+  ├────────────┴────────────┴──────────────┤│           after valid range            │
+  │'int32_t arr [10]' (type: 'int32_t[10]')││                                        │
+  └────────────────────────────────────────┘└────────────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────────┬────────────────────┤
+                      │                                         │
+            ╭─────────┴────────╮                    ╭───────────┴──────────╮
+            │capacity: 40 bytes│                    │⚠️  overflow of 4 bytes│
+            ╰──────────────────╯                    ╰──────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-json.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-json.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-sarif.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-sarif.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-sarif.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-unicode.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-unicode.c
index 71f66ff87c9..a565ff765a8 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-1-unicode.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-1-unicode.c
@@ -31,7 +31,25 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
            |           |
            |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
            |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   arr[10] = x;
+   ~~~~~~~~^~~
+  event 1 (depth 0)
+    |
+    | int32_t arr[10];
+    |         ^~~
+    |         |
+    |         (1) capacity: 40 bytes
+    |
+    +--> 'void int_arr_write_element_after_end_off_by_one(int32_t)': event 2 (depth 1)
+           |
+           |   arr[10] = x;
+           |   ~~~~~~~~^~~
+           |           |
+           |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+           |
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -52,4 +70,24 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
           │capacity: 40 bytes│                │overflow of 4 bytes│
           ╰──────────────────╯                ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────────────┐
+                                            │write from 'int32_t x' (type: 'int32_t')│
+                                            └────────────────────────────────────────┘
+                                                                │
+                                                                │
+                                                                v
+  ┌────────────┬────────────┬──────────────┐┌────────────────────────────────────────┐
+  │    [0]     │    ...     │     [9]      ││                                        │
+  ├────────────┴────────────┴──────────────┤│           after valid range            │
+  │'int32_t arr [10]' (type: 'int32_t[10]')││                                        │
+  └────────────────────────────────────────┘└────────────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────────┬────────────────────┤
+                      │                                         │
+            ╭─────────┴────────╮                      ╭─────────┴─────────╮
+            │capacity: 40 bytes│                      │overflow of 4 bytes│
+            ╰──────────────────╯                      ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-10.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-10.c
index 4a7b8e306de..ea7bdf680b5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-10.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-10.c
@@ -3,9 +3,10 @@ 
 #include <stdint.h>
 #include <stdlib.h>
 
-int32_t int_vla_write_element_symbolic_before_start (int32_t x, size_t n)
+void int_vla_write_element_symbolic_before_start (int32_t x, size_t n)
 {
-  int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" } */
+  int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" "" { target c } } */
+                  /* { dg-message "\\(1\\) capacity: '\\(n \\* 4\\)' bytes" "" { target c++ } .-1 } */
   arr[-2] = 42;  /* { dg-warning "stack-based buffer underwrite" } */
 }
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-12.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-12.c
index 3573750e57a..ca840b41254 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-12.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-12.c
@@ -31,7 +31,25 @@  void test8 (size_t size, size_t offset)
          │size: 'size' bytes│            │over-read of 'offset' bytes│
          ╰──────────────────╯            ╰───────────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌──────────────────────────────────────────────────────────────────────┐
+  │                    read of 'size + offset' bytes                     │
+  └──────────────────────────────────────────────────────────────────────┘
+                   ^                                   ^
+                   │                                   │
+                   │                                   │
+  ┌──────────────────────────────────┐┌──────────────────────────────────┐
+  │ buffer allocated on stack at (1) ││        after valid range         │
+  └──────────────────────────────────┘└──────────────────────────────────┘
+  ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+                   │                                   │
+      ╭────────────┴────────────╮    ╭─────────────────┴────────────────╮
+      │size: 'size_t size' bytes│    │over-read of 'size_t offset' bytes│
+      ╰─────────────────────────╯    ╰──────────────────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -50,4 +68,22 @@  void test8 (size_t size, size_t offset)
        │capacity: 'size' bytes│          │overflow of 'offset' bytes│
        ╰──────────────────────╯          ╰──────────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌──────────────────────────────────────────────────────────────────────┐
+  │                    write of 'size + offset' bytes                    │
+  └──────────────────────────────────────────────────────────────────────┘
+                   │                                   │
+                   │                                   │
+                   v                                   v
+  ┌──────────────────────────────────┐┌──────────────────────────────────┐
+  │ buffer allocated on stack at (1) ││        after valid range         │
+  └──────────────────────────────────┘└──────────────────────────────────┘
+  ├────────────────┬─────────────────┤├────────────────┬─────────────────┤
+                   │                                   │
+    ╭──────────────┴──────────────╮   ╭────────────────┴────────────────╮
+    │capacity: 'size_t size' bytes│   │overflow of 'size_t offset' bytes│
+    ╰─────────────────────────────╯   ╰─────────────────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-13.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-13.c
index 9b2d6b304ab..103f064f048 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-13.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-13.c
@@ -8,7 +8,8 @@  test_non_ascii ()
 {
   char buf[9];
   strcpy (buf, "Liberté\n"); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target *-*-* } .-1 } */
+  /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 10 bytes into a region of size 9 overflows the destination" "" { target c++ } .-2 } */
 }
 
 /* Example of non-ASCII UTF-8 that's short enough to fully quote, whilst
@@ -41,4 +42,32 @@  test_non_ascii ()
                       │capacity: 9 bytes│                    │overflow of 1 byte│
                       ╰─────────────────╯                    ╰──────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌──────┬──────┬──────┬──────┬──────┬──────┬────┬────┬──────┐┌─────────────────┐
+  │ [0]  │ [1]  │ [2]  │ [3]  │ [4]  │ [5]  │[6] │[7] │ [8]  ││       [9]       │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼────┼────┼──────┤├─────────────────┤
+  │ 0x4c │ 0x69 │ 0x62 │ 0x65 │ 0x72 │ 0x74 │0xc3│0xa9│ 0x0a ││      0x00       │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼────┴────┼──────┤├─────────────────┤
+  │U+004c│U+0069│U+0062│U+0065│U+0072│U+0074│ U+00e9  │U+000a││     U+0000      │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼─────────┼──────┤├─────────────────┤
+  │  L   │  i   │  b   │  e   │  r   │  t   │    é    │      ││       NUL       │
+  ├──────┴──────┴──────┴──────┴──────┴──────┴─────────┴──────┴┴─────────────────┤
+  │                   string literal (type: 'const char[10]')                   │
+  └─────────────────────────────────────────────────────────────────────────────┘
+     │      │      │      │      │      │     │    │     │             │
+     │      │      │      │      │      │     │    │     │             │
+     v      v      v      v      v      v     v    v     v             v
+  ┌──────┬────────────────────────────────────────────┬──────┐┌─────────────────┐
+  │ [0]  │                    ...                     │ [8]  ││                 │
+  ├──────┴────────────────────────────────────────────┴──────┤│after valid range│
+  │             'char buf [9]' (type: 'char[9]')             ││                 │
+  └──────────────────────────────────────────────────────────┘└─────────────────┘
+  ├────────────────────────────┬─────────────────────────────┤├────────┬────────┤
+                               │                                       │
+                      ╭────────┴────────╮                    ╭─────────┴────────╮
+                      │capacity: 9 bytes│                    │overflow of 1 byte│
+                      ╰─────────────────╯                    ╰──────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-14.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-14.c
index 3cedf06d258..46aab8536f1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-14.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-14.c
@@ -40,7 +40,27 @@  to write to.  */
           │capacity: 4 bytes│                │overflow of 4 bytes│
           ╰─────────────────╯                ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────┐
+                                            │write from 'int x' (type: 'int')│
+                                            └────────────────────────────────┘
+                                                            │
+                                                            │
+                                                            v
+  ┌────────────────────────────────────────┐┌────────────────────────────────┐
+  │                  [0]                   ││                                │
+  ├────────────────────────────────────────┤│       after valid range        │
+  │'int32_t arr_1 [1]' (type: 'int32_t[1]')││                                │
+  └────────────────────────────────────────┘└────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────┬────────────────┤
+                      │                                     │
+             ╭────────┴────────╮                  ╭─────────┴─────────╮
+             │capacity: 4 bytes│                  │overflow of 4 bytes│
+             ╰─────────────────╯                  ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* The arr_2 case.  */
 /* { dg-begin-multiline-output "" }
@@ -62,7 +82,27 @@  to write to.  */
              │capacity: 8 bytes│                │overflow of 4 bytes│
              ╰─────────────────╯                ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────┐
+                                            │write from 'int x' (type: 'int')│
+                                            └────────────────────────────────┘
+                                                            │
+                                                            │
+                                                            v
+  ┌───────────────────┬────────────────────┐┌────────────────────────────────┐
+  │        [0]        │        [1]         ││                                │
+  ├───────────────────┴────────────────────┤│       after valid range        │
+  │'int32_t arr_2 [2]' (type: 'int32_t[2]')││                                │
+  └────────────────────────────────────────┘└────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────┬────────────────┤
+                      │                                     │
+             ╭────────┴────────╮                  ╭─────────┴─────────╮
+             │capacity: 8 bytes│                  │overflow of 4 bytes│
+             ╰─────────────────╯                  ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* The arr_3 case.  */
 // Perhaps we should show [1] rather than ellipsize here.
@@ -85,7 +125,27 @@  to write to.  */
             │capacity: 12 bytes│                │overflow of 4 bytes│
             ╰──────────────────╯                ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────┐
+                                            │write from 'int x' (type: 'int')│
+                                            └────────────────────────────────┘
+                                                            │
+                                                            │
+                                                            v
+  ┌────────────┬────────────┬──────────────┐┌────────────────────────────────┐
+  │    [0]     │    ...     │     [2]      ││                                │
+  ├────────────┴────────────┴──────────────┤│       after valid range        │
+  │'int32_t arr_3 [3]' (type: 'int32_t[3]')││                                │
+  └────────────────────────────────────────┘└────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────┬────────────────┤
+                      │                                     │
+            ╭─────────┴────────╮                  ╭─────────┴─────────╮
+            │capacity: 12 bytes│                  │overflow of 4 bytes│
+            ╰──────────────────╯                  ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* The arr_4 case.  */
 /* { dg-begin-multiline-output "" }
@@ -107,4 +167,24 @@  to write to.  */
             │capacity: 16 bytes│                │overflow of 4 bytes│
             ╰──────────────────╯                ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                            ┌────────────────────────────────┐
+                                            │write from 'int x' (type: 'int')│
+                                            └────────────────────────────────┘
+                                                            │
+                                                            │
+                                                            v
+  ┌────────────┬────────────┬──────────────┐┌────────────────────────────────┐
+  │    [0]     │    ...     │     [3]      ││                                │
+  ├────────────┴────────────┴──────────────┤│       after valid range        │
+  │'int32_t arr_4 [4]' (type: 'int32_t[4]')││                                │
+  └────────────────────────────────────────┘└────────────────────────────────┘
+  ├───────────────────┬────────────────────┤├───────────────┬────────────────┤
+                      │                                     │
+            ╭─────────┴────────╮                  ╭─────────┴─────────╮
+            │capacity: 16 bytes│                  │overflow of 4 bytes│
+            ╰──────────────────╯                  ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-15.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-15.c
index 411b84c3268..b5c70b981b0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-15.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-15.c
@@ -10,7 +10,8 @@  test_non_ascii ()
 {
   char buf[9];
   strcpy (buf, "Liberté\n"); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target *-*-* } .-1 } */
+  /* { dg-warning "'__builtin_memcpy' writing 10 bytes into a region of size 9 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 10 bytes into a region of size 9 overflows the destination" "" { target c++ } .-2 } */
 }
 
 /* { dg-begin-multiline-output "" }
@@ -40,4 +41,32 @@  test_non_ascii ()
                       │capacity: 9 bytes│                    │overflow of 1 byte│
                       ╰─────────────────╯                    ╰──────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌──────┬──────┬──────┬──────┬──────┬──────┬────┬────┬──────┐┌─────────────────┐
+  │ [0]  │ [1]  │ [2]  │ [3]  │ [4]  │ [5]  │[6] │[7] │ [8]  ││       [9]       │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼────┼────┼──────┤├─────────────────┤
+  │ 0x4c │ 0x69 │ 0x62 │ 0x65 │ 0x72 │ 0x74 │0xc3│0xa9│ 0x0a ││      0x00       │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼────┴────┼──────┤├─────────────────┤
+  │U+004c│U+0069│U+0062│U+0065│U+0072│U+0074│ U+00e9  │U+000a││     U+0000      │
+  ├──────┼──────┼──────┼──────┼──────┼──────┼─────────┼──────┤├─────────────────┤
+  │  L   │  i   │  b   │  e   │  r   │  t   │    é    │      ││       NUL       │
+  ├──────┴──────┴──────┴──────┴──────┴──────┴─────────┴──────┴┴─────────────────┤
+  │                   string literal (type: 'const char[10]')                   │
+  └─────────────────────────────────────────────────────────────────────────────┘
+     │      │      │      │      │      │     │    │     │             │
+     │      │      │      │      │      │     │    │     │             │
+     v      v      v      v      v      v     v    v     v             v
+  ┌──────┬────────────────────────────────────────────┬──────┐┌─────────────────┐
+  │ [0]  │                    ...                     │ [8]  ││                 │
+  ├──────┴────────────────────────────────────────────┴──────┤│after valid range│
+  │             'char buf [9]' (type: 'char[9]')             ││                 │
+  └──────────────────────────────────────────────────────────┘└─────────────────┘
+  ├────────────────────────────┬─────────────────────────────┤├────────┬────────┤
+                               │                                       │
+                      ╭────────┴────────╮                    ╭─────────┴────────╮
+                      │capacity: 9 bytes│                    │overflow of 1 byte│
+                      ╰─────────────────╯                    ╰──────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-16.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-16.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-16.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-16.c
index b0fb409267e..da53a99a891 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-16.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-16.c
@@ -1,12 +1,12 @@ 
 /* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
 
 #include <string.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 char *test_fixed_size_heap_2_invalid (void)
 {
   char str[] = "abc";
-  char *p = __builtin_malloc (strlen (str)); /* { dg-message "\\(1\\) capacity: 3 bytes" } */
+  char *p = (char *) __builtin_malloc (strlen (str)); /* { dg-message "\\(1\\) capacity: 3 bytes" } */
   if (!p)
     return NULL;
   strcpy (p, str); /* { dg-warning "heap-based buffer overflow" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-17.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-17.c
similarity index 51%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-17.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-17.c
index 6920e8c776f..bbbdd5af572 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-17.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-17.c
@@ -31,4 +31,26 @@  void test (void)
                   ╭─────────┴────────╮                ╭─────────┴─────────╮
                   │capacity: 10 bytes│                │overflow of 3 bytes│
                   ╰──────────────────╯                ╰───────────────────╯
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+                          ┌────┬────┬────┬────┬─────┐┌────┬────┬─────────┐
+                          │[0] │[1] │[2] │[3] │ [4] ││[5] │[6] │   [7]   │
+                          ├────┼────┼────┼────┼─────┤├────┼────┼─────────┤
+                          │' ' │'w' │'o' │'r' │ 'l' ││'d' │'!' │   NUL   │
+                          ├────┴────┴────┴────┴─────┴┴────┴────┴─────────┤
+                          │    string literal (type: 'const char[8]')    │
+                          └──────────────────────────────────────────────┘
+                            │    │    │    │     │     │    │       │
+                            │    │    │    │     │     │    │       │
+                            v    v    v    v     v     v    v       v
+  ┌────┬──────────────────────────────────────┬─────┐┌───────────────────┐
+  │[0] │                 ...                  │ [9] ││                   │
+  ├────┴──────────────────────────────────────┴─────┤│ after valid range │
+  │       'char buf [10]' (type: 'char[10]')        ││                   │
+  └─────────────────────────────────────────────────┘└───────────────────┘
+  ├────────────────────────┬────────────────────────┤├─────────┬─────────┤
+                           │                                   │
+                 ╭─────────┴────────╮                ╭─────────┴─────────╮
+                 │capacity: 10 bytes│                │overflow of 3 bytes│
+                 ╰──────────────────╯                ╰───────────────────╯
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-18.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-18.c
similarity index 51%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-18.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-18.c
index ea0b88019cd..ca8d740c6f0 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-18.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-18.c
@@ -35,4 +35,30 @@  void test (void)
              ╭─────────┴────────╮                ╭─────────┴─────────╮
              │capacity: 11 bytes│                │overflow of 5 bytes│
              ╰──────────────────╯                ╰───────────────────╯
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+                        ┌───────┬───────────┐┌────┬────┬────┬────┬───────┐
+                        │  [0]  │    [1]    ││[2] │[3] │[4] │[5] │  [6]  │
+                        ├───────┼───────────┤├────┼────┼────┼────┼───────┤
+                        │ 0xe3  │   0x83    ││0xa1│0xe3│0x82│0xa4│ 0x00  │
+                        ├───────┴───────────┴┴────┼────┴────┴────┼───────┤
+                        │         U+30e1          │    U+30a4    │U+0000 │
+                        ├─────────────────────────┼──────────────┼───────┤
+                        │           メ            │      イ      │  NUL  │
+                        ├─────────────────────────┴──────────────┴───────┤
+                        │     string literal (type: 'const char[7]')     │
+                        └────────────────────────────────────────────────┘
+                            │         │        │    │    │    │      │
+                            │         │        │    │    │    │      │
+                            v         v        v    v    v    v      v
+  ┌──────┬──────────────────────┬───────────┐┌───────────────────────────┐
+  │ [0]  │         ...          │   [10]    ││                           │
+  ├──────┴──────────────────────┴───────────┤│     after valid range     │
+  │   'char buf [11]' (type: 'char[11]')    ││                           │
+  └─────────────────────────────────────────┘└───────────────────────────┘
+  ├────────────────────┬────────────────────┤├─────────────┬─────────────┤
+                       │                                   │
+             ╭─────────┴────────╮                ╭─────────┴─────────╮
+             │capacity: 11 bytes│                │overflow of 5 bytes│
+             ╰──────────────────╯                ╰───────────────────╯
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-19.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-19.c
similarity index 55%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-19.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-19.c
index 35ab72b6efc..4d0fb749bbf 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-19.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-19.c
@@ -42,4 +42,26 @@  test_long_string ()
           ╭─────────┴─────────╮               ╭──────────┴──────────╮
           │capacity: 100 bytes│               │overflow of 350 bytes│
           ╰───────────────────╯               ╰─────────────────────╯
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+        ┌───┬───┬───┬───┬───┬───┬────────┬─────┬─────┬─────┬─────┬─────┬─────┐
+        │[0]│[1]│[2]│[3]│[4]│[5]│        │[440]│[441]│[442]│[443]│[444]│[445]│
+        ├───┼───┼───┼───┼───┼───┤  ...   ├─────┼─────┼─────┼─────┼─────┼─────┤
+        │'L'│'o'│'r'│'e'│'m'│' '│        │ 'o' │ 'r' │ 'u' │ 'm' │ '.' │ NUL │
+        ├───┴───┴───┴───┴───┴───┴────────┴─────┴─────┴─────┴─────┴─────┴─────┤
+        │              string literal (type: 'const char[446]')              │
+        └────────────────────────────────────────────────────────────────────┘
+          │   │   │   │   │   │ │   │   │   │     │     │     │     │     │
+          │   │   │   │   │   │ │   │   │   │     │     │     │     │     │
+          v   v   v   v   v   v v   v   v   v     v     v     v     v     v
+  ┌───┬──────────────────────────┬─────┐┌────────────────────────────────────┐
+  │[0]│           ...            │[99] ││                                    │
+  ├───┴──────────────────────────┴─────┤│         after valid range          │
+  │'char buf [100]' (type: 'char[100]')││                                    │
+  └────────────────────────────────────┘└────────────────────────────────────┘
+  ├─────────────────┬──────────────────┤├─────────────────┬──────────────────┤
+                    │                                     │
+          ╭─────────┴─────────╮                ╭──────────┴──────────╮
+          │capacity: 100 bytes│                │overflow of 350 bytes│
+          ╰───────────────────╯                ╰─────────────────────╯
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-2.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-2.c
index 535dab1eb9e..47801dbc0ff 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-2.c
@@ -5,7 +5,8 @@ 
 
 void int_vla_write_element_after_end_off_by_one(int32_t x, size_t n)
 {
-  int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" } */
+  int32_t arr[n]; /* { dg-message "\\(1\\) capacity: 'n \\* 4' bytes" "" { target c } } */
+   /* { dg-message "\\(1\\) capacity: '\\(n \\* 4\\)' bytes" "" { target c++ } .-1 } */
 
   arr[n] = x;  /* { dg-warning "stack-based buffer overflow" } */
 }
@@ -27,4 +28,22 @@  void int_vla_write_element_after_end_off_by_one(int32_t x, size_t n)
        │capacity: 'n * 4' bytes│             │overflow of 4 bytes│
        ╰───────────────────────╯             ╰───────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+                                    ┌────────────────────────────────────────┐
+                                    │write from 'int32_t x' (type: 'int32_t')│
+                                    └────────────────────────────────────────┘
+                                                        │
+                                                        │
+                                                        v
+  ┌────────────────────────────────┐┌────────────────────────────────────────┐
+  │buffer allocated on stack at (1)││           after valid range            │
+  └────────────────────────────────┘└────────────────────────────────────────┘
+  ├───────────────┬────────────────┤├───────────────────┬────────────────────┤
+                  │                                     │
+      ╭───────────┴───────────╮               ╭─────────┴─────────╮
+      │capacity: 'n * 4' bytes│               │overflow of 4 bytes│
+      ╰───────────────────────╯               ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-4.c
similarity index 52%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-4.c
index d5d72482843..86d2bc84c7d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-4.c
@@ -17,7 +17,9 @@  test_long_string ()
 {
   char buf[100];
   strcpy (buf, LOREM_IPSUM); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 446 bytes into a region of size 100 overflows the destination" "" { target *-*-* } .-1 } */
+  /* { dg-warning "'__builtin_memcpy' writing 446 bytes into a region of size 100 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 446 bytes into a region of size 100 overflows the destination" "" { target c++ } .-2 } */
+
 }
 
 /* { dg-begin-multiline-output "" }
@@ -43,4 +45,28 @@  test_long_string ()
        │capacity: 100 bytes│              │overflow of 346 bytes│
        ╰───────────────────╯              ╰─────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───┬───┬───┬───┬───┬───┬──────────────┬─────┬─────┬─────┬─────┬─────┬─────┐
+  │[0]│[1]│[2]│[3]│[4]│[5]│              │[440]│[441]│[442]│[443]│[444]│[445]│
+  ├───┼───┼───┼───┼───┼───┤     ...      ├─────┼─────┼─────┼─────┼─────┼─────┤
+  │'L'│'o'│'r'│'e'│'m'│' '│              │ 'o' │ 'r' │ 'u' │ 'm' │ '.' │ NUL │
+  ├───┴───┴───┴───┴───┴───┴──────────────┴─────┴─────┴─────┴─────┴─────┴─────┤
+  │                 string literal (type: 'const char[446]')                 │
+  └──────────────────────────────────────────────────────────────────────────┘
+    │   │   │   │   │   │ │      │      │   │     │     │     │     │     │
+    │   │   │   │   │   │ │      │      │   │     │     │     │     │     │
+    v   v   v   v   v   v v      v      v   v     v     v     v     v     v
+  ┌───┬────────────────────┬───────────┐┌────────────────────────────────────┐
+  │[0]│        ...         │   [99]    ││                                    │
+  ├───┴────────────────────┴───────────┤│         after valid range          │
+  │'char buf [100]' (type: 'char[100]')││                                    │
+  └────────────────────────────────────┘└────────────────────────────────────┘
+  ├─────────────────┬──────────────────┤├─────────────────┬──────────────────┤
+                    │                                     │
+          ╭─────────┴─────────╮                ╭──────────┴──────────╮
+          │capacity: 100 bytes│                │overflow of 346 bytes│
+          ╰───────────────────╯                ╰─────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-ascii.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-ascii.c
new file mode 100644
index 00000000000..b7847606cf7
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-ascii.c
@@ -0,0 +1,69 @@ 
+/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii" } */
+/* { dg-skip-if "" { powerpc-ibm-aix* } } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+  char buf[5];
+  strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
+  /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 13 bytes into a region of size 5 overflows the destination" "" { target c++ } .-2 } */
+
+}
+
+/* Without unicode support, we shouldn't show the printable unicode chars.  */
+
+/* { dg-begin-multiline-output "" }
+
+  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+  | [0] | [1] | [2] |[3] |[4] ||[5] |[6] |[7] |[8] |[9] |[10]|[11]| [12] |
+  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+  |0xe6 |0x96 |0x87 |0xe5|0xad||0x97|0xe5|0x8c|0x96|0xe3|0x81|0x91| 0x00 |
+  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
+  |     U+6587      |    U+5b57     |    U+5316    |    U+3051    |U+0000|
+  +-----------------+---------------+--------------+--------------+------+
+  |                  string literal (type: 'char[13]')                   |
+  +----------------------------------------------------------------------+
+     |     |     |    |    |     |    |    |    |    |    |    |     |
+     |     |     |    |    |     |    |    |    |    |    |    |     |
+     v     v     v    v    v     v    v    v    v    v    v    v     v
+  +-----+----------------+----++-----------------------------------------+
+  | [0] |      ...       |[4] ||                                         |
+  +-----+----------------+----+|            after valid range            |
+  |  'buf' (type: 'char[5]')  ||                                         |
+  +---------------------------++-----------------------------------------+
+  |~~~~~~~~~~~~~+~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
+                |                                   |
+       +--------+--------+                +---------+---------+
+       |capacity: 5 bytes|                |overflow of 8 bytes|
+       +-----------------+                +-------------------+
+
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  +-----+-----+-----+-----+--------++----+----+----+----+----+----+----+------+
+  | [0] | [1] | [2] | [3] |  [4]   ||[5] |[6] |[7] |[8] |[9] |[10]|[11]| [12] |
+  +-----+-----+-----+-----+--------++----+----+----+----+----+----+----+------+
+  |0xe6 |0x96 |0x87 |0xe5 |  0xad  ||0x97|0xe5|0x8c|0x96|0xe3|0x81|0x91| 0x00 |
+  +-----+-----+-----+-----+--------++----+----+----+----+----+----+----+------+
+  |     U+6587      |       U+5b57       |    U+5316    |    U+3051    |U+0000|
+  +-----------------+--------------------+--------------+--------------+------+
+  |                  string literal (type: 'const char[13]')                  |
+  +---------------------------------------------------------------------------+
+     |     |     |     |      |       |    |    |    |    |    |    |     |
+     |     |     |     |      |       |    |    |    |    |    |    |     |
+     v     v     v     v      v       v    v    v    v    v    v    v     v
+  +-----+-----------------+--------++-----------------------------------------+
+  | [0] |       ...       |  [4]   ||                                         |
+  +-----+-----------------+--------+|            after valid range            |
+  |'char buf [5]' (type: 'char[5]')||                                         |
+  +--------------------------------++-----------------------------------------+
+  |~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
+                  |                                      |
+         +--------+--------+                   +---------+---------+
+         |capacity: 5 bytes|                   |overflow of 8 bytes|
+         +-----------------+                   +-------------------+
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-unicode.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-unicode.c
new file mode 100644
index 00000000000..ddcde10df77
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-5-unicode.c
@@ -0,0 +1,72 @@ 
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+/* { dg-skip-if "" { powerpc-ibm-aix* } } */
+
+#include <string.h>
+
+void
+test_non_ascii ()
+{
+  char buf[5];
+  strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
+  /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 13 bytes into a region of size 5 overflows the destination" "" { target c++ } .-2 } */
+}
+
+/* With unicode support, we should show the printable unicode chars.  */
+
+/* { dg-begin-multiline-output "" }
+
+  ┌─────┬─────┬─────┬────┬────┐┌────┬────┬────┬────┬────┬────┬────┬──────┐
+  │ [0] │ [1] │ [2] │[3] │[4] ││[5] │[6] │[7] │[8] │[9] │[10]│[11]│ [12] │
+  ├─────┼─────┼─────┼────┼────┤├────┼────┼────┼────┼────┼────┼────┼──────┤
+  │0xe6 │0x96 │0x87 │0xe5│0xad││0x97│0xe5│0x8c│0x96│0xe3│0x81│0x91│ 0x00 │
+  ├─────┴─────┴─────┼────┴────┴┴────┼────┴────┴────┼────┴────┴────┼──────┤
+  │     U+6587      │    U+5b57     │    U+5316    │    U+3051    │U+0000│
+  ├─────────────────┼───────────────┼──────────────┼──────────────┼──────┤
+  │       文        │      字       │      化      │      け      │ NUL  │
+  ├─────────────────┴───────────────┴──────────────┴──────────────┴──────┤
+  │                  string literal (type: 'char[13]')                   │
+  └──────────────────────────────────────────────────────────────────────┘
+     │     │     │    │    │     │    │    │    │    │    │    │     │
+     │     │     │    │    │     │    │    │    │    │    │    │     │
+     v     v     v    v    v     v    v    v    v    v    v    v     v
+  ┌─────┬────────────────┬────┐┌─────────────────────────────────────────┐
+  │ [0] │      ...       │[4] ││                                         │
+  ├─────┴────────────────┴────┤│            after valid range            │
+  │  'buf' (type: 'char[5]')  ││                                         │
+  └───────────────────────────┘└─────────────────────────────────────────┘
+  ├─────────────┬─────────────┤├────────────────────┬────────────────────┤
+                │                                   │
+       ╭────────┴────────╮                ╭─────────┴─────────╮
+       │capacity: 5 bytes│                │overflow of 8 bytes│
+       ╰─────────────────╯                ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌─────┬─────┬─────┬─────┬────────┐┌────┬────┬────┬────┬────┬────┬────┬──────┐
+  │ [0] │ [1] │ [2] │ [3] │  [4]   ││[5] │[6] │[7] │[8] │[9] │[10]│[11]│ [12] │
+  ├─────┼─────┼─────┼─────┼────────┤├────┼────┼────┼────┼────┼────┼────┼──────┤
+  │0xe6 │0x96 │0x87 │0xe5 │  0xad  ││0x97│0xe5│0x8c│0x96│0xe3│0x81│0x91│ 0x00 │
+  ├─────┴─────┴─────┼─────┴────────┴┴────┼────┴────┴────┼────┴────┴────┼──────┤
+  │     U+6587      │       U+5b57       │    U+5316    │    U+3051    │U+0000│
+  ├─────────────────┼────────────────────┼──────────────┼──────────────┼──────┤
+  │       文        │         字         │      化      │      け      │ NUL  │
+  ├─────────────────┴────────────────────┴──────────────┴──────────────┴──────┤
+  │                  string literal (type: 'const char[13]')                  │
+  └───────────────────────────────────────────────────────────────────────────┘
+     │     │     │     │      │       │    │    │    │    │    │    │     │
+     │     │     │     │      │       │    │    │    │    │    │    │     │
+     v     v     v     v      v       v    v    v    v    v    v    v     v
+  ┌─────┬─────────────────┬────────┐┌─────────────────────────────────────────┐
+  │ [0] │       ...       │  [4]   ││                                         │
+  ├─────┴─────────────────┴────────┤│            after valid range            │
+  │'char buf [5]' (type: 'char[5]')││                                         │
+  └────────────────────────────────┘└─────────────────────────────────────────┘
+  ├───────────────┬────────────────┤├────────────────────┬────────────────────┤
+                  │                                      │
+         ╭────────┴────────╮                   ╭─────────┴─────────╮
+         │capacity: 5 bytes│                   │overflow of 8 bytes│
+         ╰─────────────────╯                   ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-6.c
similarity index 50%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-6.c
index 25bf9d53b2b..b2e225c256d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-6.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-6.c
@@ -28,7 +28,8 @@  test_bad_memcpy ()
   /* { dg-warning "stack-based buffer underwrite" "" { target *-*-* } .-1 } */
   /* { dg-warning "buffer under-read" "" { target *-*-* } .-2 } */
   /* { dg-warning "buffer over-read" "" { target *-*-* } .-3 } */
-  /* { dg-warning "'memcpy' writing 4096 bytes into a region of size 0 overflows the destination" "" { target *-*-* } .-4 } */
+  /* { dg-warning "'memcpy' writing 4096 bytes into a region of size 0 overflows the destination" "" { target c } .-4 } */
+  /* { dg-warning "'void\\* memcpy\\(void\\*, const void\\*, size_t\\)' writing 4096 bytes into a region of size 0 overflows the destination" "" { target c++ } .-5 } */
 }
 
 /* { dg-begin-multiline-output "" }
@@ -50,7 +51,27 @@  test_bad_memcpy ()
   │under-read of 100 bytes│    │size: 446 bytes│       │over-read of 3550 bytes│
   ╰───────────────────────╯    ╰───────────────╯       ╰───────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───────────────────────────────────────────────────────────────────────────────┐
+  │                              read of 4096 bytes                               │
+  └───────────────────────────────────────────────────────────────────────────────┘
+           ^                ^            ^             ^                 ^
+           │                │            │             │                 │
+           │                │            │             │                 │
+  ┌──────────────────┐┌────────────┬────────────┬──────────────┐┌─────────────────┐
+  │                  ││    [0]     │    ...     │    [445]     ││                 │
+  │before valid range│├────────────┴────────────┴──────────────┤│after valid range│
+  │                  ││string literal (type: 'const char[446]')││                 │
+  └──────────────────┘└────────────────────────────────────────┘└─────────────────┘
+  ├────────┬─────────┤├───────────────────┬────────────────────┤├────────┬────────┤
+           │                              │                              │
+  ╭────────┴──────────────╮       ╭───────┴───────╮          ╭───────────┴───────────╮
+  │under-read of 100 bytes│       │size: 446 bytes│          │over-read of 3550 bytes│
+  ╰───────────────────────╯       ╰───────────────╯          ╰───────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -74,7 +95,27 @@  test_bad_memcpy ()
   │underwrite of 50 bytes│
   ╰──────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───────────────────────────────────────────────────────────────────────────┐
+  │                            write of 4096 bytes                            │
+  └───────────────────────────────────────────────────────────────────────────┘
+           │                │           │           │                │
+           │                │           │           │                │
+           v                v           v           v                v
+  ┌──────────────────┐┌───────────┬───────────┬────────────┐┌─────────────────┐
+  │                  ││    [0]    │    ...    │    [99]    ││                 │
+  │before valid range│├───────────┴───────────┴────────────┤│after valid range│
+  │                  ││'char buf [100]' (type: 'char[100]')││                 │
+  └──────────────────┘└────────────────────────────────────┘└─────────────────┘
+  ├────────┬─────────┤├─────────────────┬──────────────────┤├────────┬────────┤
+           │                            │                            │
+  ╭────────┴─────────────╮    ╭─────────┴─────────╮      ╭───────────┴──────────╮
+  │underwrite of 50 bytes│    │capacity: 100 bytes│      │overflow of 3946 bytes│
+  ╰──────────────────────╯    ╰───────────────────╯      ╰──────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* The read and write diagrams are each emitted twice: once for the "before"
    and once for the "after" diagnostic.  */
@@ -98,7 +139,27 @@  test_bad_memcpy ()
   │under-read of 100 bytes│    │size: 446 bytes│       │over-read of 3550 bytes│
   ╰───────────────────────╯    ╰───────────────╯       ╰───────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───────────────────────────────────────────────────────────────────────────────┐
+  │                              read of 4096 bytes                               │
+  └───────────────────────────────────────────────────────────────────────────────┘
+           ^                ^            ^             ^                 ^
+           │                │            │             │                 │
+           │                │            │             │                 │
+  ┌──────────────────┐┌────────────┬────────────┬──────────────┐┌─────────────────┐
+  │                  ││    [0]     │    ...     │    [445]     ││                 │
+  │before valid range│├────────────┴────────────┴──────────────┤│after valid range│
+  │                  ││string literal (type: 'const char[446]')││                 │
+  └──────────────────┘└────────────────────────────────────────┘└─────────────────┘
+  ├────────┬─────────┤├───────────────────┬────────────────────┤├────────┬────────┤
+           │                              │                              │
+  ╭────────┴──────────────╮       ╭───────┴───────╮          ╭───────────┴───────────╮
+  │under-read of 100 bytes│       │size: 446 bytes│          │over-read of 3550 bytes│
+  ╰───────────────────────╯       ╰───────────────╯          ╰───────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
 
 /* { dg-begin-multiline-output "" }
 
@@ -122,4 +183,24 @@  test_bad_memcpy ()
   │underwrite of 50 bytes│
   ╰──────────────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───────────────────────────────────────────────────────────────────────────┐
+  │                            write of 4096 bytes                            │
+  └───────────────────────────────────────────────────────────────────────────┘
+           │                │           │           │                │
+           │                │           │           │                │
+           v                v           v           v                v
+  ┌──────────────────┐┌───────────┬───────────┬────────────┐┌─────────────────┐
+  │                  ││    [0]    │    ...    │    [99]    ││                 │
+  │before valid range│├───────────┴───────────┴────────────┤│after valid range│
+  │                  ││'char buf [100]' (type: 'char[100]')││                 │
+  └──────────────────┘└────────────────────────────────────┘└─────────────────┘
+  ├────────┬─────────┤├─────────────────┬──────────────────┤├────────┬────────┤
+           │                            │                            │
+  ╭────────┴─────────────╮    ╭─────────┴─────────╮      ╭───────────┴──────────╮
+  │underwrite of 50 bytes│    │capacity: 100 bytes│      │overflow of 3946 bytes│
+  ╰──────────────────────╯    ╰───────────────────╯      ╰──────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-7.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-7.c
new file mode 100644
index 00000000000..eab943f0e5a
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-7.c
@@ -0,0 +1,62 @@ 
+/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
+/* { dg-skip-if "" { powerpc-ibm-aix* } } */
+
+#include <string.h>
+
+void
+test_string_with_control_chars ()
+{
+  char buf[8];
+  strcpy (buf, "\tone\n\ttwo\n"); /* { dg-warning "stack-based buffer overflow" } */
+  /* { dg-warning "'__builtin_memcpy' writing 11 bytes into a region of size 8 overflows the destination" "" { target c } .-1 } */
+  /* { dg-warning "'void\\* __builtin_memcpy\\(void\\*, const void\\*, (long )?unsigned int\\)' writing 11 bytes into a region of size 8 overflows the destination" "" { target c++ } .-2 } */
+}
+
+/* { dg-begin-multiline-output "" }
+
+  ┌──────┬──────┬──────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬──────┐
+  │ [0]  │ [1]  │ [2]  │ [3] │ [4] │ [5] │ [6] │ [7] ││ [8] │ [9] │ [10] │
+  ├──────┼──────┼──────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼──────┤
+  │ 0x09 │ 'o'  │ 'n'  │ 'e' │0x0a │0x09 │ 't' │ 'w' ││ 'o' │0x0a │ NUL  │
+  ├──────┴──────┴──────┴─────┴─────┴─────┴─────┴─────┴┴─────┴─────┴──────┤
+  │                  string literal (type: 'char[11]')                   │
+  └──────────────────────────────────────────────────────────────────────┘
+     │      │      │      │     │     │     │     │      │     │     │
+     │      │      │      │     │     │     │     │      │     │     │
+     v      v      v      v     v     v     v     v      v     v     v
+  ┌──────┬─────────────────────────────────────┬─────┐┌──────────────────┐
+  │ [0]  │                 ...                 │ [7] ││                  │
+  ├──────┴─────────────────────────────────────┴─────┤│after valid range │
+  │             'buf' (type: 'char[8]')              ││                  │
+  └──────────────────────────────────────────────────┘└──────────────────┘
+  ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
+                           │                                   │
+                  ╭────────┴────────╮                ╭─────────┴─────────╮
+                  │capacity: 8 bytes│                │overflow of 3 bytes│
+                  ╰─────────────────╯                ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌──────┬──────┬──────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬──────┐
+  │ [0]  │ [1]  │ [2]  │ [3] │ [4] │ [5] │ [6] │ [7] ││ [8] │ [9] │ [10] │
+  ├──────┼──────┼──────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼──────┤
+  │ 0x09 │ 'o'  │ 'n'  │ 'e' │0x0a │0x09 │ 't' │ 'w' ││ 'o' │0x0a │ NUL  │
+  ├──────┴──────┴──────┴─────┴─────┴─────┴─────┴─────┴┴─────┴─────┴──────┤
+  │               string literal (type: 'const char[11]')                │
+  └──────────────────────────────────────────────────────────────────────┘
+     │      │      │      │     │     │     │     │      │     │     │
+     │      │      │      │     │     │     │     │      │     │     │
+     v      v      v      v     v     v     v     v      v     v     v
+  ┌──────┬─────────────────────────────────────┬─────┐┌──────────────────┐
+  │ [0]  │                 ...                 │ [7] ││                  │
+  ├──────┴─────────────────────────────────────┴─────┤│after valid range │
+  │         'char buf [8]' (type: 'char[8]')         ││                  │
+  └──────────────────────────────────────────────────┘└──────────────────┘
+  ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
+                           │                                   │
+                  ╭────────┴────────╮                ╭─────────┴─────────╮
+                  │capacity: 8 bytes│                │overflow of 3 bytes│
+                  ╰─────────────────╯                ╰───────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-9.c
similarity index 54%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-9.c
index bb9ad660fae..a1cd3dd82f6 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-9.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-diagram-9.c
@@ -39,4 +39,27 @@  int32_t struct_arr_read_x_element_before_start_far(void)
      │under-read of 4 bytes│  │2380 bytes│        │size: 240 bytes│
      ╰─────────────────────╯  ╰──────────╯        ╰───────────────╯
 
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+
+  ┌───────────────────────────┐
+  │read of 'int32_t' (4 bytes)│
+  └───────────────────────────┘
+                ^
+                │
+                │
+  ┌───────────────────────────┐    ┌───────────┬───────────┬─────────────┐
+  │                           │    │    [0]    │    ...    │     [9]     │
+  │    before valid range     │    ├───────────┴───────────┴─────────────┤
+  │                           │    │'st arr [10]' (type: 'struct st[10]')│
+  └───────────────────────────┘    └─────────────────────────────────────┘
+  ├─────────────┬─────────────┤├┬─┤├──────────────────┬──────────────────┤
+                │               │                     │
+                │         ╭─────┴────╮        ╭───────┴───────╮
+                │         │2380 bytes│        │size: 240 bytes│
+                │         ╰──────────╯        ╰───────────────╯
+     ╭──────────┴──────────╮
+     │under-read of 4 bytes│
+     ╰─────────────────────╯
+
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-1.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-1.c
similarity index 64%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-1.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-1.c
index ca5022d20cb..71485f92080 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-1.c
@@ -34,4 +34,22 @@  void int_arr_write_element_after_end_off_by_one(int32_t x)
            |           |
            |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
            |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   arr[10] = x;
+   ~~~~~~~~^~~
+  event 1 (depth 0)
+    |
+    | int32_t arr[10];
+    |         ^~~
+    |         |
+    |         (1) capacity: 40 bytes
+    |
+    +--> 'void int_arr_write_element_after_end_off_by_one(int32_t)': event 2 (depth 1)
+           |
+           |   arr[10] = x;
+           |   ~~~~~~~~^~~
+           |           |
+           |           (2) out-of-bounds write from byte 40 till byte 43 but 'arr' ends at byte 40
+           |
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-2.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-2.c
similarity index 62%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-2.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-2.c
index 660901ab782..a63f4bd224c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-multiline-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-multiline-2.c
@@ -29,4 +29,20 @@  void int_vla_write_element_after_end_off_by_one(int32_t x, size_t n)
     |          |
     |          (2) write of 4 bytes at offset 'n * 4' exceeds the buffer
     |
-   { dg-end-multiline-output "" } */
+   { dg-end-multiline-output "" { target c } } */
+/* { dg-begin-multiline-output "" }
+   arr[n] = x;
+   ~~~~~~~^~~
+  'void int_vla_write_element_after_end_off_by_one(int32_t, size_t)': events 1-2 (depth 1)
+    |
+    |   int32_t arr[n];
+    |           ^~~
+    |           |
+    |           (1) capacity: '(n * 4)' bytes
+    |
+    |   arr[n] = x;
+    |   ~~~~~~~~~~
+    |          |
+    |          (2) write of 4 bytes at offset '(n * 4)' exceeds the buffer
+    |
+   { dg-end-multiline-output "" { target c++ } } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-pr110387.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr110387.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-pr110387.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-pr110387.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-char-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-char-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-char-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-int-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-int-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-int-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-struct-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-struct-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-read-struct-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-read-struct-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-realloc-grow.c
similarity index 95%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-realloc-grow.c
index 707611e08a6..838e4f21d77 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-realloc-grow.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-realloc-grow.c
@@ -21,7 +21,7 @@  fread_file (FILE *stream, int flags, size_t *length)
   char *buf = NULL;
   size_t alloc = BUFSIZ;
 
-  if (!(buf = malloc (alloc)))
+  if (!(buf = (char *)malloc (alloc)))
     return NULL; /* errno is ENOMEM.  */
 
   {
@@ -44,7 +44,7 @@  fread_file (FILE *stream, int flags, size_t *length)
           else
             alloc = PTRDIFF_MAX;
 
-           if (!(new_buf = realloc (buf, alloc)))
+           if (!(new_buf = (char *)realloc (buf, alloc)))
             {
               save_errno = errno;
               break;
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-char-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-char-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-char-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-int-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-int-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-int-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-struct-arr.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-struct-arr.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-write-struct-arr.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-write-struct-arr.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-zero.c
similarity index 91%
rename from gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
rename to gcc/testsuite/c-c++-common/analyzer/out-of-bounds-zero.c
index 201ca00ebdb..16cf54c0e79 100644
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-zero.c
+++ b/gcc/testsuite/c-c++-common/analyzer/out-of-bounds-zero.c
@@ -32,7 +32,7 @@  void test3 (void)
 
 void test4 (void)
 {
-  int32_t *buf = malloc (sizeof (int32_t));
+  int32_t *buf = (int32_t *)malloc (sizeof (int32_t));
   if (!buf)
     return;
 
@@ -43,7 +43,7 @@  void test4 (void)
 
 void test5 (void)
 {
-  int32_t *buf = malloc (0);
+  int32_t *buf = (int32_t *)malloc (0);
   if (!buf)
     return;
 
@@ -57,7 +57,7 @@  void test5 (void)
 
 void test6 (void)
 {
-  int32_t *buf = malloc (0);
+  int32_t *buf = (int32_t *)malloc (0);
   if (!buf)
     return;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/params-2.c b/gcc/testsuite/c-c++-common/analyzer/params-2.c
similarity index 83%
rename from gcc/testsuite/gcc.dg/analyzer/params-2.c
rename to gcc/testsuite/c-c++-common/analyzer/params-2.c
index 433c658720f..ea378c6bb84 100644
--- a/gcc/testsuite/gcc.dg/analyzer/params-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/params-2.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 static void ensure_equal (int a, int b)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/params.c b/gcc/testsuite/c-c++-common/analyzer/params.c
similarity index 94%
rename from gcc/testsuite/gcc.dg/analyzer/params.c
rename to gcc/testsuite/c-c++-common/analyzer/params.c
index 12bba70d6e4..290c6593adc 100644
--- a/gcc/testsuite/gcc.dg/analyzer/params.c
+++ b/gcc/testsuite/c-c++-common/analyzer/params.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 static int __analyzer_called_function(int j)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1.c b/gcc/testsuite/c-c++-common/analyzer/paths-1.c
similarity index 81%
rename from gcc/testsuite/gcc.dg/analyzer/paths-1.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-1.c
index df5b3a66084..af2dc790662 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-1.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct foo
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c b/gcc/testsuite/c-c++-common/analyzer/paths-1a.c
similarity index 81%
rename from gcc/testsuite/gcc.dg/analyzer/paths-1a.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-1a.c
index a1b842ff54f..17689ee7953 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-1a.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-1a.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 union foo
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-2.c b/gcc/testsuite/c-c++-common/analyzer/paths-2.c
similarity index 87%
rename from gcc/testsuite/gcc.dg/analyzer/paths-2.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-2.c
index 3efc053ade1..8e03227b473 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-2.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int test (int a)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-3.c b/gcc/testsuite/c-c++-common/analyzer/paths-3.c
similarity index 94%
rename from gcc/testsuite/gcc.dg/analyzer/paths-3.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-3.c
index b5ab810e536..2b8015a4c55 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-3.c
@@ -1,7 +1,7 @@ 
 /* { dg-additional-options "-fanalyzer-transitivity" } */
 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 int test_1 (int a, int b)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-4.c b/gcc/testsuite/c-c++-common/analyzer/paths-4.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/paths-4.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-4.c
index b72e658739e..a886edf72f1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-4.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-4.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 struct state
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-5.c b/gcc/testsuite/c-c++-common/analyzer/paths-5.c
similarity index 85%
rename from gcc/testsuite/gcc.dg/analyzer/paths-5.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-5.c
index 21aa23067c1..5f8b2dc4d37 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-5.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-5.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 void test (int *p, int n)
 {
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-6.c b/gcc/testsuite/c-c++-common/analyzer/paths-6.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/paths-6.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-6.c
index ef1a4e6c04d..b33856bd4cc 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-6.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-6.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 /* Verify that ordering of writes doesn't matter when merging states.  */
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-7.c b/gcc/testsuite/c-c++-common/analyzer/paths-7.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/paths-7.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-7.c
index 8caaee8a3fd..49dd46b647c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-7.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-7.c
@@ -1,5 +1,5 @@ 
 #include <stdlib.h>
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int foo (int);
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/paths-8.c b/gcc/testsuite/c-c++-common/analyzer/paths-8.c
similarity index 85%
rename from gcc/testsuite/gcc.dg/analyzer/paths-8.c
rename to gcc/testsuite/c-c++-common/analyzer/paths-8.c
index b350d4d7dbd..8509a235485 100644
--- a/gcc/testsuite/gcc.dg/analyzer/paths-8.c
+++ b/gcc/testsuite/c-c++-common/analyzer/paths-8.c
@@ -1,4 +1,4 @@ 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 static void __attribute__((noinline))
 __analyzer_callee_1 (void)
diff --git a/gcc/testsuite/gcc.dg/analyzer/pattern-test-1.c b/gcc/testsuite/c-c++-common/analyzer/pattern-test-1.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/pattern-test-1.c
rename to gcc/testsuite/c-c++-common/analyzer/pattern-test-1.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c b/gcc/testsuite/c-c++-common/analyzer/pattern-test-2.c
similarity index 77%
rename from gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
rename to gcc/testsuite/c-c++-common/analyzer/pattern-test-2.c
index 5b8ff7bc2e8..d931a6339e8 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pattern-test-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pattern-test-2.c
@@ -1,6 +1,10 @@ 
 /* { dg-additional-options "-fanalyzer-checker=pattern-test -O2" } */
 // TODO: run this at every optimization level
 
+#ifdef __cplusplus 
+#define _Bool bool
+#endif
+
 extern void foo(void *);
 extern void bar(void *);
 
@@ -26,7 +30,8 @@  void test_2 (void *p, void *q)
   foo(p);
 
   /* { dg-warning "pattern match on 'p != 0'" "p != 0" { target *-*-* } cond_2 } */
-  /* { dg-warning "pattern match on 'p == 0 | q == 0 != 0'" "tmp1 | tmp2 != 0" { target *-*-* } cond_2 } */
+  /* { dg-warning "pattern match on 'p == 0 | q == 0 != 0'" "tmp1 | tmp2 != 0" { target c } cond_2 } */
+  /* { dg-warning "pattern match on '\\(\\(p == 0\\) | \\(q == 0\\)\\) != false'" "tmp1 | tmp2 != 0" { target c++ } cond_2 } */
   /* { dg-warning "pattern match on 'q != 0'" "q != 0" { target *-*-* } cond_2 } */
 }
 
@@ -42,6 +47,7 @@  void test_3 (void *p, void *q)
   foo(p);
 
   /* { dg-warning "pattern match on 'p == 0'" "p == 0" { target *-*-* } cond_3 } */
-  /* { dg-warning "pattern match on 'p == 0 & q == 0 == 0'" "tmp1 & tmp2 == 0" { target *-*-* } cond_3 } */
+  /* { dg-warning "pattern match on 'p == 0 & q == 0 == 0'" "tmp1 & tmp2 == 0" { target c } cond_3 } */
+  /* { dg-warning "pattern match on '\\(\\(p == 0\\) & \\(q == 0\\)\\) == false'" "tmp1 & tmp2 == 0" { target c++ } cond_3 } */
   /* { dg-warning "pattern match on 'q == 0'" "q == 0" { target *-*-* } cond_3 } */
 }
diff --git a/gcc/testsuite/gcc.dg/analyzer/phi-2.c b/gcc/testsuite/c-c++-common/analyzer/phi-2.c
similarity index 77%
rename from gcc/testsuite/gcc.dg/analyzer/phi-2.c
rename to gcc/testsuite/c-c++-common/analyzer/phi-2.c
index 2ab8344cfe2..c464d6e9d5d 100644
--- a/gcc/testsuite/gcc.dg/analyzer/phi-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/phi-2.c
@@ -20,7 +20,7 @@  void mbochs_close(struct list_head *dmabufs,
   while (&dmabuf->next != dmabufs)
     {
       dmabuf = tmp;
-      tmp = ((struct mbochs_dmabuf *)((void *)(tmp->next.next) - __builtin_offsetof(struct mbochs_dmabuf, next)));
+      tmp = ((struct mbochs_dmabuf *)((char *)(void *)(tmp->next.next) - (char *)__builtin_offsetof(struct mbochs_dmabuf, next)));
     }
 
   /* [...snip...] */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-1.c b/gcc/testsuite/c-c++-common/analyzer/pipe-1.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/pipe-1.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe-1.c
index 156f0114fd5..6ce5cd4ffaa 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pipe-1.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
+/* { dg-additional-options "-fno-exceptions" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int pipe(int pipefd[2]);
 extern int close(int fd);
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c b/gcc/testsuite/c-c++-common/analyzer/pipe-glibc.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe-glibc.c
index 60558a870b9..6220ee5421a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe-glibc.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pipe-glibc.c
@@ -1,6 +1,7 @@ 
 /* Example of pipe usage from glibc manual.  */
 
 /* { dg-skip-if "" { "avr-*-*" } } */
+/* { dg-additional-options "-fno-exceptions" } */
 
 #include <sys/types.h>
 #include <unistd.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-manpages.c b/gcc/testsuite/c-c++-common/analyzer/pipe-manpages.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/pipe-manpages.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe-manpages.c
index 6b9ae4d2602..ed20be6a5c5 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe-manpages.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pipe-manpages.c
@@ -26,6 +26,8 @@  the source, must acknowledge the copyright and authors of this work.
 
  */
 
+/* { dg-additional-options "-fno-exceptions" } */
+
 #include <sys/types.h>
 #include <sys/wait.h>
 #include <stdio.h>
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-pr107486.c b/gcc/testsuite/c-c++-common/analyzer/pipe-pr107486.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/pipe-pr107486.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe-pr107486.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe-void-return.c b/gcc/testsuite/c-c++-common/analyzer/pipe-void-return.c
similarity index 88%
rename from gcc/testsuite/gcc.dg/analyzer/pipe-void-return.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe-void-return.c
index 8b1822d97f9..cfba4b3137c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe-void-return.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pipe-void-return.c
@@ -1,4 +1,5 @@ 
 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
+/* { dg-additional-options "-fno-exceptions" } */
 
 extern void pipe(int pipefd[2]);
 extern int close(int fd);
diff --git a/gcc/testsuite/gcc.dg/analyzer/pipe2-1.c b/gcc/testsuite/c-c++-common/analyzer/pipe2-1.c
similarity index 92%
rename from gcc/testsuite/gcc.dg/analyzer/pipe2-1.c
rename to gcc/testsuite/c-c++-common/analyzer/pipe2-1.c
index aa0684e5c86..a5a4b355fa1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pipe2-1.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pipe2-1.c
@@ -1,6 +1,7 @@ 
 /* { dg-additional-options "-fno-analyzer-suppress-followups" } */
+/* { dg-additional-options "-fno-exceptions" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 extern int pipe2(int pipefd[2], int flags);
 extern int close(int fd);
diff --git a/gcc/testsuite/gcc.dg/analyzer/pointer-merging.c b/gcc/testsuite/c-c++-common/analyzer/pointer-merging.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/pointer-merging.c
rename to gcc/testsuite/c-c++-common/analyzer/pointer-merging.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
similarity index 93%
rename from gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-simplified.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
index 4a08f0f1f50..1083a2fe747 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-simplified.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93032-mztools-simplified.c
@@ -1,7 +1,7 @@ 
 /* { dg-do "compile" } */
 
 /* Minimal replacement of system headers.  */
-#define NULL ((void *) 0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 typedef struct _IO_FILE FILE;
 extern FILE *fopen(const char *__restrict __filename,
 		   const char *__restrict __modes);
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93290.c b/gcc/testsuite/c-c++-common/analyzer/pr93290.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/pr93290.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93290.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93352.c b/gcc/testsuite/c-c++-common/analyzer/pr93352.c
similarity index 100%
rename from gcc/testsuite/gcc.dg/analyzer/pr93352.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93352.c
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-2.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-2.c
similarity index 89%
rename from gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-2.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-2.c
index df14bea7155..944e96f0707 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-2.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-2.c
@@ -4,13 +4,12 @@ 
 
 /* { dg-do "compile" } */
 
-#include "analyzer-decls.h"
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 #define PATH_SEPARATOR ':'
 #define LOCALE_ALIAS_PATH "value for LOCALE_ALIAS_PATH"
 
-const char *
-_nl_expand_alias (void)
+void _nl_expand_alias (void)
 {
   static const char *locale_alias_path;
 
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-3.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
similarity index 97%
rename from gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-3.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
index 50d338855bc..96e30b729c1 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-feasibility-3.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-feasibility-3.c
@@ -25,7 +25,7 @@ 
 /* Minimal version of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
-#define NULL ((void *)0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef struct _IO_FILE FILE;
 extern FILE *fopen (const char *__restrict __filename,
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
similarity index 96%
rename from gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c
rename to gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
index 6f65add346b..99e6c97178a 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias-simplified.c
+++ b/gcc/testsuite/c-c++-common/analyzer/pr93355-localealias-simplified.c
@@ -23,7 +23,7 @@ 
    USA.  */
 
 /* Minimal version of system headers.  */
-#define NULL ((void *) 0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 typedef struct _IO_FILE FILE;
 extern FILE *fopen(const char *__restrict __filename,
 		   const char *__restrict __modes);
diff --git a/gcc/testsuite/gcc.dg/analyzer/attr-format-1.c b/gcc/testsuite/gcc.dg/analyzer/attr-format-1.c
deleted file mode 100644
index c7fa705585d..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/attr-format-1.c
+++ /dev/null
@@ -1,31 +0,0 @@ 
-extern int
-my_printf (void *my_object, const char *my_format, ...)
-  __attribute__ ((format (printf, 2, 3)));
-/* { dg-message "parameter 2 of 'my_printf' marked as a format string via 'format' attribute" "attr note" { target *-*-* } .-2 } */
-/* { dg-message "argument 2 of 'my_printf' must be a pointer to a null-terminated string" "arg note" { target *-*-* } .-3 } */
-
-int test_empty (void *my_object, const char *msg)
-{
-  return my_printf (my_object, "");
-}
-
-int test_percent_s (void *my_object, const char *msg)
-{
-  return my_printf (my_object, "%s\n", msg);
-}
-
-int
-test_unterminated_format (void *my_object)
-{
-  char fmt[3] = "abc";
-  return my_printf (my_object, fmt); /* { dg-warning "stack-based buffer over-read" } */
-  /* { dg-message "while looking for null terminator for argument 2 \\('&fmt'\\) of 'my_printf'..." "event" { target *-*-* } .-1 } */
-}
-
-int
-test_uninitialized_format (void *my_object)
-{
-  char fmt[10];
-  return my_printf (my_object, fmt); /* { dg-warning "use of uninitialized value 'fmt\\\[0\\\]'" } */  
-  /* { dg-message "while looking for null terminator for argument 2 \\('&fmt'\\) of 'my_printf'..." "event" { target *-*-* } .-1 } */
-}
diff --git a/gcc/testsuite/gcc.dg/analyzer/data-model-19.c b/gcc/testsuite/gcc.dg/analyzer/data-model-19.c
index 69978383d1b..f153cc0aa51 100644
--- a/gcc/testsuite/gcc.dg/analyzer/data-model-19.c
+++ b/gcc/testsuite/gcc.dg/analyzer/data-model-19.c
@@ -1,5 +1,7 @@ 
 /* { dg-additional-options "-fgimple" } */
 
+/* C only: -fgimple is no valid for C++. */
+
 typedef long long int i64;
 
 int __GIMPLE (ssa)
diff --git a/gcc/testsuite/gcc.dg/analyzer/error-2.c b/gcc/testsuite/gcc.dg/analyzer/error-2.c
index 138ab9d30c5..a684b6e78dd 100644
--- a/gcc/testsuite/gcc.dg/analyzer/error-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/error-2.c
@@ -1,4 +1,9 @@ 
-#define NULL ((void*)0)
+/* C only: C++ exceptions cause a false positive va-leak to be
+   emitted at line 42.
+   Therefore this test has been duplicated as
+   c-c++-common/analyzer/error-2-noexcept.c  */
+
+#include "analyzer-decls.h"
 typedef __SIZE_TYPE__ size_t;
 
 extern int errno;
diff --git a/gcc/testsuite/gcc.dg/analyzer/explode-4.c b/gcc/testsuite/gcc.dg/analyzer/explode-4.c
index 874b1e9c300..cb4555e54f9 100644
--- a/gcc/testsuite/gcc.dg/analyzer/explode-4.c
+++ b/gcc/testsuite/gcc.dg/analyzer/explode-4.c
@@ -3,6 +3,8 @@ 
    conjured_svalues whilst handling a long chain of external
    function calls.  */
 
+/* C only: -Wno-implicit-function-declaration and -Wno-int-conversion are not valid in C++. */
+
 /* { dg-additional-options "-Wno-implicit-function-declaration -Wno-int-conversion -Wno-analyzer-too-complex" } */
 
 #define NULL ((void *)0)
diff --git a/gcc/testsuite/gcc.dg/analyzer/file-2.c b/gcc/testsuite/gcc.dg/analyzer/file-2.c
index 9c58108a531..19ca89a2204 100644
--- a/gcc/testsuite/gcc.dg/analyzer/file-2.c
+++ b/gcc/testsuite/gcc.dg/analyzer/file-2.c
@@ -1,3 +1,8 @@ 
+/* C only: C++ exceptions cause a false positive file-leak to be
+   emitted at line 19.
+   Therefore this test has been duplicated as
+   c-c++-common/analyzer/file-2-noexcept.c  */
+
 typedef struct FILE   FILE;
 
 FILE* fopen (const char*, const char*);
@@ -17,7 +22,7 @@  void test (const char *path)
     return; /* { dg-bogus "leak of FILE" } */
 
   fclose (f.m_f);
-  fclose (f.m_f); /* { dg-warning "double 'fclose' of FILE 'f.m_f'" } */
+  fclose (f.m_f); /* { dg-warning "double 'fclose' of FILE 'f.m_f'" "" { target c } } */
 }
 
 /* Swallow -Wuse-after-free issued for the same problem
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c
deleted file mode 100644
index a0cdcbe0669..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-ascii.c
+++ /dev/null
@@ -1,41 +0,0 @@ 
-/* { dg-additional-options "-fdiagnostics-text-art-charset=ascii" } */
-/* { dg-skip-if "" { powerpc-ibm-aix* } } */
-
-#include <string.h>
-
-void
-test_non_ascii ()
-{
-  char buf[5];
-  strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target *-*-* } .-1 } */
-}
-
-/* Without unicode support, we shouldn't show the printable unicode chars.  */
-
-/* { dg-begin-multiline-output "" }
-
-  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
-  | [0] | [1] | [2] |[3] |[4] ||[5] |[6] |[7] |[8] |[9] |[10]|[11]| [12] |
-  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
-  |0xe6 |0x96 |0x87 |0xe5|0xad||0x97|0xe5|0x8c|0x96|0xe3|0x81|0x91| 0x00 |
-  +-----+-----+-----+----+----++----+----+----+----+----+----+----+------+
-  |     U+6587      |    U+5b57     |    U+5316    |    U+3051    |U+0000|
-  +-----------------+---------------+--------------+--------------+------+
-  |                  string literal (type: 'char[13]')                   |
-  +----------------------------------------------------------------------+
-     |     |     |    |    |     |    |    |    |    |    |    |     |
-     |     |     |    |    |     |    |    |    |    |    |    |     |
-     v     v     v    v    v     v    v    v    v    v    v    v     v
-  +-----+----------------+----++-----------------------------------------+
-  | [0] |      ...       |[4] ||                                         |
-  +-----+----------------+----+|            after valid range            |
-  |  'buf' (type: 'char[5]')  ||                                         |
-  +---------------------------++-----------------------------------------+
-  |~~~~~~~~~~~~~+~~~~~~~~~~~~~||~~~~~~~~~~~~~~~~~~~~+~~~~~~~~~~~~~~~~~~~~|
-                |                                   |
-       +--------+--------+                +---------+---------+
-       |capacity: 5 bytes|                |overflow of 8 bytes|
-       +-----------------+                +-------------------+
-
-   { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c
deleted file mode 100644
index 3111a6fccf2..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-5-unicode.c
+++ /dev/null
@@ -1,43 +0,0 @@ 
-/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
-/* { dg-skip-if "" { powerpc-ibm-aix* } } */
-
-#include <string.h>
-
-void
-test_non_ascii ()
-{
-  char buf[5];
-  strcpy (buf, "文字化け"); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 13 bytes into a region of size 5 overflows the destination" "" { target *-*-* } .-1 } */
-}
-
-/* With unicode support, we should show the printable unicode chars.  */
-
-/* { dg-begin-multiline-output "" }
-
-  ┌─────┬─────┬─────┬────┬────┐┌────┬────┬────┬────┬────┬────┬────┬──────┐
-  │ [0] │ [1] │ [2] │[3] │[4] ││[5] │[6] │[7] │[8] │[9] │[10]│[11]│ [12] │
-  ├─────┼─────┼─────┼────┼────┤├────┼────┼────┼────┼────┼────┼────┼──────┤
-  │0xe6 │0x96 │0x87 │0xe5│0xad││0x97│0xe5│0x8c│0x96│0xe3│0x81│0x91│ 0x00 │
-  ├─────┴─────┴─────┼────┴────┴┴────┼────┴────┴────┼────┴────┴────┼──────┤
-  │     U+6587      │    U+5b57     │    U+5316    │    U+3051    │U+0000│
-  ├─────────────────┼───────────────┼──────────────┼──────────────┼──────┤
-  │       文        │      字       │      化      │      け      │ NUL  │
-  ├─────────────────┴───────────────┴──────────────┴──────────────┴──────┤
-  │                  string literal (type: 'char[13]')                   │
-  └──────────────────────────────────────────────────────────────────────┘
-     │     │     │    │    │     │    │    │    │    │    │    │     │
-     │     │     │    │    │     │    │    │    │    │    │    │     │
-     v     v     v    v    v     v    v    v    v    v    v    v     v
-  ┌─────┬────────────────┬────┐┌─────────────────────────────────────────┐
-  │ [0] │      ...       │[4] ││                                         │
-  ├─────┴────────────────┴────┤│            after valid range            │
-  │  'buf' (type: 'char[5]')  ││                                         │
-  └───────────────────────────┘└─────────────────────────────────────────┘
-  ├─────────────┬─────────────┤├────────────────────┬────────────────────┤
-                │                                   │
-       ╭────────┴────────╮                ╭─────────┴─────────╮
-       │capacity: 5 bytes│                │overflow of 8 bytes│
-       ╰─────────────────╯                ╰───────────────────╯
-
-   { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c b/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c
deleted file mode 100644
index 5e3f9a74d31..00000000000
--- a/gcc/testsuite/gcc.dg/analyzer/out-of-bounds-diagram-7.c
+++ /dev/null
@@ -1,37 +0,0 @@ 
-/* { dg-additional-options "-fdiagnostics-text-art-charset=unicode" } */
-/* { dg-skip-if "" { powerpc-ibm-aix* } } */
-
-#include <string.h>
-
-void
-test_string_with_control_chars ()
-{
-  char buf[8];
-  strcpy (buf, "\tone\n\ttwo\n"); /* { dg-warning "stack-based buffer overflow" } */
-  /* { dg-warning "'__builtin_memcpy' writing 11 bytes into a region of size 8 overflows the destination" "" { target *-*-* } .-1 } */
-}
-
-/* { dg-begin-multiline-output "" }
-
-  ┌──────┬──────┬──────┬─────┬─────┬─────┬─────┬─────┐┌─────┬─────┬──────┐
-  │ [0]  │ [1]  │ [2]  │ [3] │ [4] │ [5] │ [6] │ [7] ││ [8] │ [9] │ [10] │
-  ├──────┼──────┼──────┼─────┼─────┼─────┼─────┼─────┤├─────┼─────┼──────┤
-  │ 0x09 │ 'o'  │ 'n'  │ 'e' │0x0a │0x09 │ 't' │ 'w' ││ 'o' │0x0a │ NUL  │
-  ├──────┴──────┴──────┴─────┴─────┴─────┴─────┴─────┴┴─────┴─────┴──────┤
-  │                  string literal (type: 'char[11]')                   │
-  └──────────────────────────────────────────────────────────────────────┘
-     │      │      │      │     │     │     │     │      │     │     │
-     │      │      │      │     │     │     │     │      │     │     │
-     v      v      v      v     v     v     v     v      v     v     v
-  ┌──────┬─────────────────────────────────────┬─────┐┌──────────────────┐
-  │ [0]  │                 ...                 │ [7] ││                  │
-  ├──────┴─────────────────────────────────────┴─────┤│after valid range │
-  │             'buf' (type: 'char[8]')              ││                  │
-  └──────────────────────────────────────────────────┘└──────────────────┘
-  ├────────────────────────┬─────────────────────────┤├────────┬─────────┤
-                           │                                   │
-                  ╭────────┴────────╮                ╭─────────┴─────────╮
-                  │capacity: 8 bytes│                │overflow of 3 bytes│
-                  ╰─────────────────╯                ╰───────────────────╯
-
-   { dg-end-multiline-output "" } */
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-signed-char.c b/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-signed-char.c
index 1f3df7c211f..37298cd7327 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-signed-char.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-signed-char.c
@@ -1,3 +1,5 @@ 
+/* C only: K&R C syntax is not supported in C++. */
+
 /* Integration test to ensure we issue FILE * leak diagnostics for
    this particular non-trivial case.
    Adapted from zlib/contrib/minizip/mztools.c, with all #includes
@@ -9,7 +11,7 @@ 
 /* Minimal replacement of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
-#define NULL ((void *) 0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef struct _IO_FILE FILE;
 extern FILE *fopen(const char *__restrict __filename,
@@ -160,7 +162,7 @@  uLong* bytesRecovered;
             dataSize = uncpsize;
           }
           if (dataSize > 0) {
-            char* data = malloc(dataSize);
+            char* data = (char *)malloc(dataSize);
             if (data != NULL) {
               if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
                 if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-unsigned-char.c b/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-unsigned-char.c
index db9678d1caa..67ae487df8c 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-unsigned-char.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93032-mztools-unsigned-char.c
@@ -1,3 +1,5 @@ 
+/* C only: K&R C syntax is not supported in C++. */
+
 /* Integration test to ensure we issue FILE * leak diagnostics for
    this particular non-trivial case.
    Adapted from zlib/contrib/minizip/mztools.c, with all #includes
@@ -9,7 +11,7 @@ 
 /* Minimal replacement of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
-#define NULL ((void *) 0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 typedef struct _IO_FILE FILE;
 extern FILE *fopen(const char *__restrict __filename,
@@ -160,7 +162,7 @@  uLong* bytesRecovered;
             dataSize = uncpsize;
           }
           if (dataSize > 0) {
-            char* data = malloc(dataSize);
+            char* data = (char *)malloc(dataSize);
             if (data != NULL) {
               if ((int)fread(data, 1, dataSize, fpZip) == dataSize) {
                 if ((int)fwrite(data, 1, dataSize, fpOut) == dataSize) {
diff --git a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c
index 88d0fc1fe43..64bcd8dcbe3 100644
--- a/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c
+++ b/gcc/testsuite/gcc.dg/analyzer/pr93355-localealias.c
@@ -1,3 +1,5 @@ 
+/* C only: K&R C syntax is not supported in C++. */
+
 /* Integration test to ensure we issue a FILE * leak diagnostic for
    this particular non-trivial case.
    Adapted from intl/localealias.c, with all #includes removed.  */
@@ -28,7 +30,7 @@ 
 /* Minimal version of system headers.  */
 
 typedef __SIZE_TYPE__ size_t;
-#define NULL ((void *) 0)
+#include "../../gcc.dg/analyzer/analyzer-decls.h"
 
 #define PATH_SEPARATOR ':'
 typedef struct _IO_FILE FILE;