dwww Home | Show directory contents | Find package

GCC 12 Release Series
Changes, New Features, and Fixes

This page is a "brief" summary of some of the huge number of improvements in
GCC 12. You may also want to check out our Porting_to_GCC_12 page and the full
GCC_documentation.

Caveats

    * An ABI incompatibility between C and C++ when passing or returning by
      value certain aggregates containing zero width bit-fields has been
      discovered on various targets. As mentioned in PR102024, since the
      PR42217 fix in GCC 4.5 the C++ front-end has been removing zero width
      bit-fields from the internal representation of the aggregates after the
      layout of those aggregates, but the C front-end kept them, so passing
      e.g. struct S { float a; int : 0; float b; } or struct T { float c; int :
      0; } by value could differ between C and C++. Starting with GCC 12 the
      C++ front-end no longer removes those bit-fields from the internal
      representation and per clarified psABI some targets have been changed, so
      that they either ignore those bit-fields in the argument passing by value
      decisions in both C and C++, or they always take them into account. x86-
      64, ARM and AArch64 will always ignore them (so there is a C ABI
      incompatibility between GCC 11 and earlier with GCC 12 or later),
      PowerPC64 ELFv2 and S/390 always take them into account (so there is a
      C++ ABI incompatibility, GCC 4.4 and earlier compatible with GCC 12 or
      later, incompatible with GCC 4.5 through GCC 11). RISC-V has changed the
      handling of these already starting with GCC 10. As the ABI requires, MIPS
      takes them into account handling function return values so there is a C++
      ABI incompatibility with GCC 4.5 through 11. For function arguments on
      MIPS, refer to the_MIPS_specific_entry. GCC 12 on the above targets will
      report such incompatibilities as warnings or other diagnostics unless -
      Wno-psabi is used.
    * C: Computed gotos require a pointer type now.
    * C++: Two non-standard std::pair constructors have been deprecated. These
      allowed the use of an rvalue and a literal 0 to construct a pair
      containing a move-only type and a pointer. The nullptr keyword should be
      used to initialize the pointer member instead of a literal 0, as this is
      portable to other C++ implementations.
    * The configuration option --enable-libstdcxx-allocator no longer supports
      the bitmap, mt, and pool arguments. Those configurations had been broken
      for some time.
    * Fortran: OpenMP code using the omp_lib.h include file can no longer be
      compiled with -std=f95 but now requires at least -std=f2003.
      Alternatively, use the omp_lib module, which still supports -std=f95 and
      is recommended to be used instead in general.
    * OpenMP offloading to Intel MIC has been deprecated and will be removed in
      a future release.
    * The cr16 target with the cr16-*-* configuration has been obsoleted and
      will be removed in a future release.
    * The hppa[12]*-*-hpux10* and hppa[12]*-*-hpux11* configurations targeting
      32-bit PA-RISC with HP-UX have been obsoleted and will be removed in a
      future release.
    * The m32c*-*-rtems* configuration has been obsoleted and will be removed
      in a future release.
    * The support for the m32r-*-linux*, m32rle-*-linux*, m68k*-*-openbsd* and
      vax-*-openbsd* configurations has been removed.
    * STABS: Support for emitting the STABS debugging format is deprecated and
      will be removed in the next release. All ports now default to emit DWARF
      (version 2 or later) debugging info or are obsoleted.
    * The optimization level -Ofast now implies -fno-semantic-interposition.


General Improvements

    * Vectorization is enabled at -O2 which is now equivalent to the original -
      O2 -ftree-vectorize -fvect-cost-model=very-cheap. Note that default
      vectorizer cost model has been changed which used to behave as -fvect-
      cost-model=cheap were specified.
    * GCC now supports the ShadowCallStack sanitizer, which can be enabled
      using the command-line option -fsanitize=shadow-call-stack. This
      sanitizer currently only works on AArch64 targets and it requires an
      environment in which all code has been compiled with -ffixed-r18. Its
      primary initial user is the Linux kernel.


New Languages and Language specific improvements

    * OpenMP
          o OpenMP 5.0 support has been extended: The close map modifier and
            the affinity clause are now supported. In addition Fortran gained
            additionally the following features which were available in C and
            C++ before: declare variant is now available, depobj, mutexinoutset
            and iterator can now also be used with the depend clause,
            defaultmap has been updated for OpenMP 5.0, and the loop directive
            and combined directives involving the master directive have been
            added.
          o The following OpenMP 5.1 features have been added: support for
            expressing OpenMP directives as C++ 11 attributes, the masked and
            scope construct, the nothing and error directives, and using
            primary with the proc_bind clause and OMP_PROC_BIND environment
            variable, the reproducible and unconstrained modifiers to the order
            clause, and, for C/C++ only, the align and allocator modifiers to
            the allocate clause and the atomic extensions are now available.
            The OMP_PLACE environment variable supports the OpenMP 5.1
            features. In addition the OMP_NUM_TEAMS and OMP_TEAMS_THREAD_LIMIT
            environment variables and their associated API routines are now
            supported as well as the memory-allocation routines added for
            Fortran and extended for C/C++ in OpenMP 5.1. In Fortran code,
            strictly structured blocks can be used.
          o The OpenMP_Implementation_Status can be found in the libgomp
            manual.

    * Version 2.6 of the OpenACC specification continues to be maintained and
      improved in the C, C++ and Fortran compilers. See the implementation
      status section on the OpenACC wiki page and the run-time_library
      documentation for further information. In addition to general performance
      tuning and bug fixing, new features include:
          o OpenACC worker parallelism for AMD_GPUs (already for a long time
            supported for Nvidia_GPUs).
          o Data privatization/sharing at the OpenACC gang level.
          o Considerable improvements for the experimental OpenACC 'kernels'
            decomposition (--param_openacc-kernels=decompose).
          o A new warning flag -Wopenacc-parallelism to warn about potentially
            suboptimal choices related to OpenACC parallelism.
    * The offload target code generation for OpenMP and OpenACC can now be
      better adjusted using the new -foffload-options= flag and the pre-
      existing but now documented -foffload= flag.


Ada

    * Ada 2022
          o Added the -gnat2022 flag to indicate strict Ada 2022 compliance.
            The old -gnat2020 flag is now deprecated.
          o Support for Big Numbers (Annex G) has seen continuous improvements.
            It is now considered complete. It is compatible with SPARK, i.e.
            can be used from SPARK code.
          o Continuous improvements to the Ada 2022 standard since GCC 11.
          o Greatly improved compile time support. More functions can now have
            the with Static aspect and can be used in more contexts.
    * Ada 2022 extensions. The use of the -gnatX flag is necessary to access
      these features as they are not considered stable or standard.
          o Fixed lower bound for unconstrained arrays.
                # type Matrix is array (Natural range 0 .. <>, Natural range 0
                  .. <>) of Integer; is now valid.
                # Subtypes can also specify a lower bound: subtype String_1 is
                  String (1 .. <>);. Boundaries from slices will "slide" to the
                  correct lower bound of the subtype.
          o Generalized Object.Operand notation. The follwing code is now valid
            V.Add_Element(42);, with V being a vector, for example.
          o Additional when constructs. Keywords return, goto and raise can now
            use when in addition to the existing exit when. The following
            expression is therefore now valid raise Constraint_Error with
            "Element is null" when Element = null;
          o Pattern matching
                # The case statement has been extended to cover records and
                  arrays as well as finer grained casing on scalar types. In
                  the future it is expected to provide more compile time
                  guarantees when accessing discriminated fields. Case
                  exhaustion is supported for pattern matching. An example
                  would be
                  type Sign is (Neg, Zero, Pos);

                  function Multiply (S1, S2 : Sign) return Sign is
                    (case (S1, S2) is
                       when (Neg, Neg) | (Pos, Pos) => Pos,
                       when (Zero, <>) | (<>, Zero) => Zero,
                       when (Neg, Pos) | (Pos, Neg) => Neg);
    * gnatfind and gnatxref, which were already deprecated, have been removed.
    * Greatly expanded code covered by contracts. Thanks to this work, there
      are now several Ada standard libraries fully proven in SPARK which means
      they have no runtime nor logical errors. They are mostly numeric and
      string handling libraries.
    * Enable return-slot optimization for Pure functions.
    * General optimizations, improvements and additions to the standard
      library. Performance, correctness and in some cases stability was
      improved. Memory pools have also seen some minor enhancements.
    * Improvements to embedded-RTOS targets such as RTEMS, VxWorks and QNX.
      Older targets were removed or cleaned.
    * Added some hardening_features.


C family

    * Support for __builtin_shufflevector compatible with the clang language
      extension was added.
    * Support for attribute unavailable was added.
    * A new built-in function, __builtin_assoc_barrier, was added. It can be
      used to inhibit re-association of floating-point expressions.
    * Support for __builtin_dynamic_object_size compatible with the clang
      language extension was added.
    * New warnings:
          o -Wbidi-chars warns about potentially misleading UTF-8 bidirectional
            control characters. The default is -Wbidi-chars=unpaired (PR103026)
          o -Warray-compare warns about comparisons between two operands of
            array type (PR97573)
    * Enhancements to existing warnings:
          o -Wattributes has been extended so that it's possible to use -Wno-
            attributes=ns::attr or -Wno-attributes=ns:: to suppress warnings
            about unknown scoped attributes (in C++11 and C2X). Similarly,
            #pragma GCC diagnostic ignored_attributes "vendor::attr" can be
            used to achieve the same effect (PR101940)

C

    * Some new features from the upcoming C2X revision of the ISO C standard
      are supported with -std=c2x and -std=gnu2x. Some of these features are
      also supported as extensions when compiling for older language versions.
      In addition to the features listed, some features previously supported as
      extensions and now added to the C standard are enabled by default in C2X
      mode and not diagnosed with -std=c2x -Wpedantic.
          o Digit separators (as in C++) are supported for C2X.
          o The #elifdef and #elifndef preprocessing directives are now
            supported.
          o The printf and scanf format checking with -Wformat now supports the
            %b format specified by C2X for binary integers, and the %B format
            recommended by C2X for printf.

C++

    * Several C++23 features have been implemented:
          o P1938R3, if consteval (PR100974)
          o P0849R8, auto(x): decay-copy in the language (PR103049)
          o P2242R3, Non-literal variables (and labels and gotos) in constexpr
            functions (PR102612)
          o P2334R1, Support for preprocessing directives elifdef and elifndef
            (PR102616)
          o P2360R0, Extend init-statement to allow alias-declaration
            (PR102617)
          o P2128R6, Multidimensional subscript operator
          o DR_2397, auto specifier for pointers and references to arrays
            (PR100975)
    * Several C++ Defect Reports have been resolved, e.g.:
          o DR_960, Covariant functions and lvalue/rvalue references
          o DR_1227, Mixing immediate and non-immediate contexts in deduction
            failure
          o DR_1315, Restrictions on non-type template arguments in partial
            specializations
          o DR_2082, Referring to parameters in unevaluated operands of default
            arguments
          o DR_2351, void{}
          o DR_2374, Overly permissive specification of enum direct-list-
            initialization
          o DR_2397, auto specifier for pointers and references to arrays
          o DR_2446, Questionable type-dependency of concept-ids
    * New command-line option -fimplicit-constexpr can be used to make inline
      functions implicitly constexpr (git)
    * New command-line option -ffold-simple-inlines can be used to fold calls
      to certain trivial inline functions (currently std::move, std::forward,
      std::addressof and std::as_const). In contrast to inlining such calls,
      folding means that no intermediate code or debug information will be
      generated for them; this minimizes the abstraction penalty incurred for
      using these functions versus using the fundamental operations from which
      they're defined (e.g. std::move versus static_cast). This flag is enabled
      by default when -fno-inline is not active.
    * Deduction guides can be declared at class scope (PR79501)
    * -Wuninitialized warns about using uninitialized variables in member
      initializer lists (PR19808)
    * -Wint-in-bool-context is now disabled when instantiating a template (git)
    * Stricter checking of attributes on friend declarations: if a friend
      declaration has an attribute, that declaration must be a definition.
      Moreover, a C++11 attribute cannot appear in the middle of the decl-
      specifier-seq. (PR99032)
    * New warning options for C++ language mismatches: -Wc++11-extensions, -
      Wc++14-extensions, -Wc++17-extensions, -Wc++20-extensions, and -Wc++23-
      extensions. They are enabled by default and can be used to control
      existing pedwarns about occurrences of new C++ constructs in code using
      an old C++ standard dialect.
    * New warning -Wmissing-requires warns about missing requires (git)
    * The existing std::is_constant_evaluated in if warning was extended to
      warn in more cases (PR100995)
    * -Waddress has been enhanced so that it now warns about, for instance,
      comparing the address of a nonstatic member function to null (PR102103)
    * Errors about narrowing are no longer hidden if they occur in system
      headers
    * Ordered comparison of null pointers is now rejected (PR99701)
    * Anonymous structs with bases are now rejected (git)
    * The compiler rejects taking the address of an immediate member function
      (PR102753)
    * The compiler has support for C++20 __cpp_lib_is_pointer_interconvertible
      and __cpp_lib_is_layout_compatible to help the C++ library implement
      P0466, Layout-compatibility and Pointer-interconvertibility Traits
      (PR101539)
    * Memory usage of constraint subsumption has been improved (PR100828)
    * constinit thread_local variables are optimized better (PR101786)
    * Support for C++17 std::hardware_destructive_interference_size was added,
      along with the -Winterference-size warning (git)
    * Many bugs in the CTAD handling have been fixed (PR101344, PR101883,
      PR89062, PR101233, PR88252, PR86439, PR98832, PR102933 ...)
    * Two-stage name lookup for dependent operator expressions has been
      corrected (PR51577)
    * Several issues with constrained variable templates have been fixed
      (PR98486)
    * The compiler performs less instantiating when doing speculative constant
      evaluation (git)
    * Various diagnostic improvements; e.g., a more precise caret location for
      pointer-to-member expressions
    * The new -fconstexpr-fp-except flag allows IEC559 floating point
      exceptions in constant-expressions.


Runtime Library (libstdc++)

    * Improved experimental C++20 support, including:
          o std::vector, std::basic_string, std::optional, and std::variant can
            be used in constexpr functions.
          o std::make_shared for arrays with default initialization, and std::
            atomic<std::shared_ptr<T>>.
          o Layout-compatibility and pointer-interconvertibility traits.
    * Improved experimental C++23 support, including:
          o Monadic operations for std::optional.
          o std::move_only_function
          o <spanstream>
          o std::basic_string::resize_and_overwrite
          o std::unique_ptr can be used in constexpr functions.
          o <stacktrace> (not built by default, requires linking to an extra
            library).
          o <stdatomic.h>
          o std::invoke_r
          o constexpr std::type_info::operator==

Fortran

    * WG5/N1942, "TS 29113 Further Interoperability of Fortran with C", is now
      fully supported. In addition to implementing previously missing
      functionality, such as support for character arguments of length greater
      than one in functions marked bind(c) and gaps in the handling for
      assumed-rank arrays, numerous other bugs have been fixed, and an
      extensive set of new conformance test cases has been added.
    * GCC 12 now uses OPERATION as the name of the function to the CO_REDUCE
      intrinsic for the pairwise reduction, thus conforming to the Fortran 2018
      standard. Previous versions used OPERATOR which conforms to TS 18508.
    * On POWER systems which support it, the -mabi=ieeelongdouble option now
      selects the IEEE 128-bit floating point format for REAL(KIND=16). R16_IBM
      and R16_IEEE have been added to the -fconvert option, the CONVERT
      specifyer of the OPEN statement and the GFORTRAN_CONVERT_UNIT environment
      variable.


libgccjit

    * The libgccjit API gained 30 new entry points:
          o 17 new "reflection" entrypoints for querying functions and types
            (LIBGCCJIT_ABI_16)
          o gcc_jit_lvalue_set_tls_model for supporting thread-local variables
            (LIBGCCJIT_ABI_17)
          o gcc_jit_lvalue_set_link_section for setting the link section of
            global variables, analogous to __attribute__((section(".section")))
            (LIBGCCJIT_ABI_18)
          o 4 new entrypoints for initializing global variables and creating
            constructors for rvalues (LIBGCCJIT_ABI_19)
          o Support for sized integer types, including 128-bit integers and
            helper functions for such types (LIBGCCJIT_ABI_20)
          o gcc_jit_context_new_bitcast for reinterpreting the bits of an
            rvalue as a different type (LIBGCCJIT_ABI_21)
          o gcc_jit_lvalue_set_register_name for setting a specific register
            for a variable (LIBGCCJIT_ABI_22)
          o gcc_jit_context_set_bool_print_errors_to_stderr (LIBGCCJIT_ABI_23)
          o 2 new entrypoints for setting the alignment of a variable
            (LIBGCCJIT_ABI_24)
    * libgccjit has gained support for the use of various atomic builtins
      (PR96066, PR96067)
    * gcc_jit_context_new_cast is now able to handle truncation and extension
      between different integer types (PR95498)


New Targets and Target Specific Improvements

AArch64 & arm

    * Newer revisions of the Arm Architecture are supported as arguments to the
      -march option: armv8.7-a, armv8.8-a, armv9-a.
    * The Arm Cortex-A510 CPU is now supported through the cortex-a510 argument
      to the -mcpu and -mtune options.
    * GCC can now auto-vectorize operations performing sign-differing dot-
      product operations, taking advantage of instructions in the Advanced SIMD
      (AArch64/AArch32) and SVE (AArch64) instruction sets.


AArch64
    * A number of new CPUs are supported through the -mcpu and -mtune options
      (GCC identifiers in parentheses).
          o Ampere-1 (ampere1).
          o Arm Cortex-A710 (cortex-a710).
          o Arm Cortex-X2 (cortex-x2).
    * The 64-byte atomic load/store intrinsics to accelerator memory from the
      2020_Arm_Architecture_extensions are supported through the +ls64 option
      extension.
    * Initial code generation support is supported for hardware instructions
      used to accelerate the memcpy,memmove and memset standard functions.
      These instructions can be generated when compiling with the +mopsoption
      extension.
    * The ACLE Advanced SIMD intrinsics accessible through the arm_neon.h
      header have been significantly reimplemented and generate higher-
      performing code than previous GCC versions.
    * The option -mtune=neoverse-512tvb is added to tune for Arm Neoverse cores
      that have a total vector bandwidth of 512 bits. Please refer to the
      documentation for more details.

AMD Radeon (GCN)

    * Debug experience with ROCGDB has been improved.
    * Support for the type __int128_t/integer(kind=16) was added.
    * For offloading, the limitation of using only one wavefront per compute
      unit (CU) has been lifted. Up to 40 workgroups per CU and 16 wavefronts
      per workgroup are supported (up to a limit of 40 wavefronts in total, per
      CU). Additionally, the number of used wavefronts and workgroups was tuned
      for performance.

arm

    * Support is added for accessing the stack canary value via the TLS
      register through the -fstack-protector-guard=tls and -mstack-protector-
      guard-offset= options. This intended for use in Linux kernel development.
      Please refer to the documentation for more details.

BPF

    * Support for CO-RE (compile-once, run-everywhere) has been added to the
      BPF backend. CO-RE allows to compile portable BPF programs that are able
      to run among different versions of the Linux kernel.

IA-32/x86-64

    * New ISA extension support for Intel AVX512-FP16 was added. AVX512FP16
      intrinsics are available via the -mavx512fp16 compiler switch.
    * For both C and C++ the _Float16 type is supported on x86 systems with
      SSE2 enabled. Without {-mavx512fp16}, all operations will be emulated in
      software and float instructions.
    * Mitigation against straight line speculation (SLS) for function return
      and indirect jump is supported via -mharden-sls=
      [none|all|return|indirect-jmp].
    * Add CS prefix to call and jmp to indirect thunk with branch target in r8-
      r15 registers via -mindirect-branch-cs-prefix.
    * Always use global offset table (GOT) to access external data and function
      symbols when the new -mno-direct-extern-access command-line option is
      specified.

LoongArch

    * Support for the LoongArch architecture instruction set has been added.
    * The Loongson CPU codename LA464 and LoongArch 64-bit generic CPU codename
      loongarch64 are supported through the -march= and -mtune= options (GCC
      identifiers in parentheses).
          o Loongson LA464 core (la464).
          o LoongArch 64-bit generic core (loongarch64).

MIPS

    * The ABI passing arguments containing zero-width fields (for example, C/
      C++ zero-width bit-fields, GNU C/C++ zero-length arrays, and GNU C empty
      structs) has changed. Now a zero-width field will not prevent an aligned
      64-bit floating-point field next to it from being passed through FPR.
      This is compatible with LLVM, but incompatible with previous GCC
      releases. GCC 12 on MIPS will report such incompatibilities as an inform
      unless -Wno-psabi is used.
    * The ABI returning values containing C++17 empty bases has changed. Now an
      empty base will not prevent an aggregate containing only one or two
      floating-point fields from being returned through FPR. This is compatible
      with GCC 6 and earlier, but incompatible with GCC 7 through 11. GCC 12 on
      MIPS will report such incompatibilities as an inform unless -Wno-psabi is
      used.

NVPTX

    * The -march flag has been added. The -misa flag is now considered an alias
      of the -march flag.
    * Support for PTX ISA target architectures sm_53, sm_70, sm_75 and sm_80
      has been added. These can be specified using the -march flag.
    * The default PTX ISA target architecture has been set back to sm_30, to
      fix support for sm_30 boards.
    * The -march-map flag has been added. The -march-map value will be mapped
      to an valid -march flag value. For instance, -march-map=sm_50 maps to -
      march=sm_35. This can be used to specify that generated code is to be
      executed on a board with at least some specific compute capability,
      without having to know the valid values for the -march flag.
    * The -mptx flag has been added to specify the PTX ISA version for the
      generated code; permitted values are 3.1 (matches previous GCC versions),
      6.0, 6.3, and 7.0. If not specified, the used version is the minimal
      version required for -march but at least 6.0.
    * An mptx-3.1 multilib was added. This allows using older drivers which do
      not support PTX ISA version 6.0.
    * The new __PTX_SM__ predefined macro allows code to check the PTX ISA
      target architecture being targeted by the compiler.
    * The new __PTX_ISA_VERSION_MAJOR__ and __PTX_ISA_VERSION_MINOR__
      predefined macros allows code to check the PTX ISA version being targeted
      by the compiler.

PowerPC / PowerPC64 / RS6000

    * The internal implementation of Power's target-specific built-in functions
      has been rewritten to be easier and less error-prone to maintain. Every
      attempt has been made to ensure that the new behavior matches the old
      behavior, but inevitably some bugs can be expected. Please report any
      problems via GCC_Bugzilla.
    * The built-in functions __builtin_get_texasr, __builtin_get_texasru,
      __builtin_get_tfhar, __builtin_get_tfiar, __builtin_set_texasr,
      __builtin_set_texasru, __builtin_set_tfhar, and __builtin_set_tfiar now
      behave as documented in all supported configurations. On prior releases,
      the arguments and return values of these functions were treated as
      unsigned long long instead of as unsigned long, when the options -m32 -
      mpowerpc64 were in effect.
    * The overloaded built-in functions vec_cntlz_lsbb and vec_cnttz_lsbb now
      behave as documented. On prior releases, these built-in functions had
      incorrect semantics on little-endian targets.

PRU

    * The __regio_symbol variable qualifier has been added. It allows easier
      access in C programs to the __R30 and __R31 CPU I/O registers.

RISC-V

    * Default ISA spec version was bump to 20191213, more detail see this
      announcement
    * New ISA extension support for zba, zbb, zbc, zbs was added.
    * New ISA extension support for vector and scalar crypto was added, only
      support architecture testing marco and -march= parsing.
    * The option -mtune=thead-c906 is added to tune for T-HEAD c906 cores.


Operating Systems

Improvements to Static Analyzer

    * The analyzer has gained a -Wanalyzer-use-of-uninitialized-value warning,
      similar to -Wuninitialized and -Wmaybe-uninitialized, but based on an
      interprocedural path-sensitive analysis (PR95006).
      Such warnings are not disabled by the new -ftrivial-auto-var-init (see
      below), as the latter is considered a mitigation option.
    * -Wanalyzer-write-to-const and -Wanalyzer-write-to-string-literal will now
      check for __attribute___((access,_....)) on calls to externally-defined
      functions, and complain about read-only regions pointed to by arguments
      marked with a write_only or read_write attribute (PR104793).
    * The analyzer's "taint" mode, activated by -fanalyzer-checker=taint (in
      addition to -fanalyzer), has gained four new taint-based warnings:
          o -Wanalyzer-tainted-allocation-size for e.g. attacker-controlled
            malloc and alloca,
          o -Wanalyzer-tainted-divisor for detecting where an attacker can
            inject a divide-by-zero,
          o -Wanalyzer-tainted-offset for attacker-controlled pointer offsets,
          o -Wanalyzer-tainted-size for attacker-controlled values being used
            as a size parameter to calls to memset or to functions marked with
            __attribute___((access,_....)).
      The existing -Wanalyzer-tainted-array-index has been reworded to talk
      about "attacker-controlled" rather than "tainted" values, for consistency
      with the new warnings.
      A new __attribute___((tainted_args)) has been added to the C and C++
      frontends, usable on functions, and on function pointer callback fields
      in structs. The analyzer's taint mode will treat all parameters and
      buffers pointed to by parameters of such functions as being attacked-
      controlled, such as for annotating system calls in an operating system
      kernel as being an "attack surface".
    * The analyzer now respects __attribute__((const)): it will treat such
      functions as returning the same value when given the same inputs
      (PR104434), and as having no side effects (PR104576).
    * The analyzer is now able to split its analysis into multiple execution
      paths in places where there isn't a split in the control flow graph. For
      example, it now handles realloc calls by splitting the execution path
      into three possible outcomes for the call:
          o failure, returning NULL
          o success, growing the buffer in-place without moving it
          o success, allocating a new buffer, copying the content of the old
            buffer to it, and freeing the old buffer
    * The analyzer's interprocedural path exploration logic is now able to
      track calls through function pointers.
    * The analyzer now makes the assumption that if we know PTR is non-NULL,
      then (PTR + OFFSET) is also non-NULL. This isn't strictly true, but
      eliminates false positives in practice (PR101962).
    * The analyzer has gained some initial support for inline assembler code.
      This is extremely limited, and is purely to help suppress false positives
      when analyzing the Linux kernel, which makes heavy use of inline
      assembler (PR101570).
    * The way the analyzer tracks the state of memory along an execution path
      has been improved in various ways for GCC 12:
          o An optimization for representing bulk updates to memory (e.g. zero
            fills) has been removed as it never worked well. In GCC 12 it has
            been replaced with a simpler and more accurate approach,
            eliminating many false positives (PR95006).
          o Various optimizations have been added, speeding up the analysis on
            a particularly problematic source file from 4 minutes down to 17
            seconds (PR104943, PR104954, and PR104955).
          o The analyzer now tracks the sizes of dynamically-allocated regions,
            both on the heap (via malloc etc) and stack (via alloca), though
            none of the analyzer warnings make use of this yet in GCC 12.
    * The analyzer's handling of switch statements has been rewritten, fixing
      various bugs.


Other significant improvements

Eliminating uninitialized variables

    * GCC can now initialize_all_stack_variables_implicitly, including padding.
      This is intended to eliminate all classes of uninitialized stack variable
      flaws. Lack of explicit initialization will still warn when -
      Wuninitialized is active. For best debugging, use of the new command-line
      option -ftrivial-auto-var-init=pattern can be used to fill variables with
      a repeated 0xFE pattern, which tends to illuminate many bugs (e.g.
      pointers receive invalid addresses, sizes and indices are very large).
      For best production results, the new command-line option -ftrivial-auto-
      var-init=zero can be used to fill variables with 0x00, which tends to
      provide a safer state for bugs (e.g. pointers are NULL, strings are NUL
      filled, and sizes and indices are 0).

Debugging formats
    * GCC can now generate debugging information in CTF, a lightweight
      debugging format that provides information about C types and the
      association between functions and data symbols and types. This format is
      designed to be embedded in ELF files and to be very compact and simple. A
      new command-line option -gctf enables the generation of CTF.
    * GCC can now generate debugging information in BTF. This is a debugging
      format mainly used in BPF programs and the Linux kernel. The compiler can
      generate BTF for any target, when enabled with the command-line option -
      gbtf

GCC 12.1

This is the list_of_problem_reports_(PRs) from GCC's bug tracking system that
are known to be fixed in the 12.1 release. This list might not be complete
(that is, it is possible that some PRs that have been fixed are not listed
here).
https://gcc.gnu.org/bugzilla/buglist.cgi?bug_status=RESOLVED&resolution=FIXED&target_milestone=12.0

Generated by dwww version 1.15 on Sun Jun 16 08:11:36 CEST 2024.