Gcc Mac Os X
- Doing it Right¶. Let’s install a real version of Python. Before installing Python, you’ll need to install GCC. GCC can be obtained by downloading Xcode, the smaller Command Line Tools (must have an Apple account) or the even smaller OSX-GCC-Installer package.
- I want to install pip for python 2.7 on my Mac. I think this is the python located in /usr/bin/python. Unfortunately I have already installed Anaconda, which installs python 3.6.3, and changes things so that the command python xxx.py automatically runs xxx.py using python 3.6.3.
- Other projects packaging GCC (and gfortran) binaries for Mac include: Homebrew offers the latest stable gfortran release as part of the 'gcc' package. HPC Mac OS X offers GCC builds, which include gfortran. MacPorts (package name, e.g., 'gcc48') - the fastest way to get a developer version of GCC.
- For Linux/Unix based machines, a complete instruction is available at the installation page of gcc website. For Mac users, there are more choices except for the one above (installing from source, gcc version 6.1 which can be replaced!): 1. Port Install: sudo port install gcc6 sudo port select -list gcc sudo port select -set gcc mp-gcc6.
This page gathers links to all unofficial gfortran binary packages people regularly build, based on the current development gfortran source code.
Windows
MacOS
GNU/Linux
Build GNU Fortran from source
Mac OS X v10.3の後継であり、PowerPC版でClassic環境が使える最後のOSとなった。 2005年 4月12日 公式発表され、同年 4月29日 に発売開始された。 最終セキュリティアップデートは、2009年9月10日にリリースされた Security Update 2009-005 1 2 3 である。.
Note: There do not exist any official FSF/GNU/GCC binary builds (only source packages). Most of the builds below come from gfortran maintainers but not all.
Windows
If in doubt, or if you don't know what Cygwin and MinGW are, the package for you is the MinGW ('native Windows') package!
MinGW for Win64: The Mingw-w64 project has regularly updated snapshots of compilers generating 64-bit Windows executables. They provides several compilers, which run on Windows (32-bit and 64-bit Windows), Cygwin, Linux, and Darwin/MacOS - and which generate binaries for 32bit or 64bit Windows. The file name pattern is <target>-<host>-<option-version>-<date>; thus, mingw-w64-bin_x86_64-mingw_20100527.zip is a compiler targeting 64bit Windows (mingw-w64) but also running ('host') on 64bit Windows (xx86-64-mingw); you might search for the file in Toolchains targetting Win64 (Personal Builds or Automatized Builds).
MinGW build ('native Windows' build)
Official MinGW builds (only releases), last seen was 6.3.0 (2017-05-30)
The MinGW for Win64 project has also binaries for 32bit Windows; e.g. mingw-w32-bin_i686-mingw_<date>.zip runs on and generates binaries for 32bit Windows (cf. above); you might search for the file in Toolchains targetting Win32 (Personal Builds or Automatized Builds).
TDM GCC: MinGW/MinGW-W64 Builds
MinGW 32/64bit builds by www.Equation.com (builds were announced at comp.lang.fortran; note - equation.com is not affiliated with any MinGW or GCC developer. Use at your own risk)
Cygwin: The Cygwin project offers up-to-date builds of GCC and gfortran
Octave: Octave 6.1 comes with gcc/gfortran-9.3.1. From the Windows start menu, open up Octave and you will find the bash shell. Stick it to your task bar so it's always to hand. Combined with Notepad++ (https://notepad-plus-plus.org/), you will be able to get on with fortran development using nothing but GPL tools. Alternatively, the 'system' command can be used to run gfortran from the Octave GUI together with the Octave editor.
macOS
Linux Mac Os X
The gfortran maintainers offer nice Apple-style installers for macOS: https://github.com/fxcoudert/gfortran-for-macOS/releasesDetailed instructions can be found here.
Other projects packaging GCC (and gfortran) binaries for Mac include:
Homebrew offers the latest stable gfortran release as part of the 'gcc' package.
HPC Mac OS X offers GCC builds, which include gfortran
MacPorts (package name, e.g., 'gcc48') - the fastest way to get a developer version of GCC. MacPorts comes with a packing software, but all software is compiled before installation. For the developer version, the 'Portfile' is updated approx. weekly.
Fink offers GCC packages (all released versions) - similar to MacPorts, but also offers binaries; it does not have the developer versions, just the releases.
GNU/Linux
Most Linux distributions offer gfortran packages, some have also builds for the experimental versions
Nightly builds are available at:
32-bit processors (i686)
Download from gfortran.com
Installation instructions
64-bit AMD-compatible processors (x86_64, AMD64,Intel64, em64t)
Download from gfortran.com (README, nightly builds, 4.3 to 4.9 snapshots)
gcc-4.8-infrastructure package (GCC 4.8 and later; for GCC 4.3 to 4.7 use gcc-infrastructure), which contains required libraries (GMP, MPFR, MPC, etc.) - simply unpack in the 'gcc-trunk' (or 'gcc-4.6' or ..) directory
To unpack .xz files: Use xzcat with tar. It is contained in pre-build xz package, if you don't have it.
Needs to be updated: Installation instructions
Building from Source
See also InstallingGCC and http://gcc.gnu.org/install/
- Obtain the source code either via
subversion
git Osx zip.
Bazaar
unpacking a tarball
You should have the right versions of GMP, MPFR and MPC (and optionally for Graphite: CLOOG and ISL) installed, which you can download from ftp://gcc.gnu.org/pub/gcc/infrastructure/ (They can also be automatically build with GCC.)
Note: You can use ./contrib/download_prerequisites to download them.
Follow the instructions; in a nutshell, you will do
create a build directory, e.g. gcc-build underneath the source directory
go to the build directory and run configure from there; for instance: ./configure --prefix=$HOME/gcc-trunk --enable-languages=c,fortran
run make
run make install
Useful configure options: --enable-checking=release which disables some compile-time checks which slow down the compiler; --disable-bootstrap which speeds up the build but uses the system compiler and disables some consistency checks; --disable-build-poststage1-with-cxx (for 4.7 or higher) avoids building GCC with a C++ compiler, esp. useful if no C++ should be compiled; --disable-libstdcxx-pch speeds up the compilation a bit by not creating pre-compiled header files.
This page is a 'brief' summary of some of the huge number of improvementsin GCC 11.You may also want to check out ourPorting to GCC 11 page and thefull GCC documentation.
Note: GCC 11 has not been released yet, so this document isa work-in-progress.
Caveats
- The default mode for C++ is now
-std=gnu++17
instead of-std=gnu++14
. Note that C++17 changes to template template parameter matching can be disabled independently of other features with-fno-new-ttp-matching
. - When building GCC itself, the host compiler must now support C++11, rather than C++98. In particular bootstrapping GCC 11 using an older version of GCC requires a binary of GCC 4.8 or later, rather than of GCC 3.4 or later as was the case for bootstrapping GCC 10.
- Naming and location of auxiliary and dump output files changed. If you compile multiple input files in a single command, if you enable Link Time Optimization, or if you use
-dumpbase
,-dumpdir
,-save-temps=*
, and you expect any file other than the primary output file(s) to be created as a side effect, watch out for improvements and a few surprises. See the patch, particularly its textual description, for more details about the changes. -gsplit-dwarf
no longer enables debug info generation on its own but requires a separate-g
for this.- The libstdc++ configure option
--enable-cheaders=c_std
is deprecated and will be removed in a future release. It should be possible to use--enable-cheaders=c_global
(the default) with no change in behaviour. - The front end for compiling BRIG format of Heterogeneous System Architecture Intermediate Language (HSAIL) has been deprecated and will likely be removed in a future release.
General Improvements
- ThreadSanitizer improvements to support alternative runtimes and environments. The Linux Kernel Concurrency Sanitizer (KCSAN) is now supported.
- Add
--param tsan-distinguish-volatile
to optionally emit instrumentation distinguishing volatile accesses. - Add
--param tsan-instrument-func-entry-exit
to optionally control if function entries and exits should be instrumented.
- Add
In previous releases of GCC, the 'column numbers' emitted in diagnostics were actually a count of bytes from the start of the source line. This could be problematic, both because of:
- multibyte characters (requiring more than one byte to encode), and
- multicolumn characters (requiring more than one column to display in a monospace font)
For example, the character π ('GREEK SMALL LETTER PI (U+03C0)') occupies one column, and its UTF-8 encoding requires two bytes; the character 🙂 ('SLIGHTLY SMILING FACE (U+1F642)') occupies two columns, and its UTF-8 encoding requires four bytes.
In GCC 11 the column numbers default to being column numbers, respecting multi-column characters. The old behavior can be restored using a new option
-fdiagnostics-column-unit=byte
. There is also a new option-fdiagnostics-column-origin=
, allowing the pre-existing default of the left-hand column being column 1 to be overridden if desired (e.g. for 0-based columns). The output of-fdiagnostics-format=json
has been extended to supply both byte counts and column numbers for all source locations.Additionally, in previous releases of GCC, tab characters in the source would be emitted verbatim when quoting source code, but be prefixed with whitespace or line number information, leading to misalignments in the resulting output when compared with the actual source. Tab characters are now printed as an appropriate number of spaces, using the
-ftabstop
option (which defaults to 8 spaces per tab stop).Introduce Hardware-assisted AddressSanitizer support. This sanitizer currently only works for the AArch64 target. It helps debug address problems similarly to AddressSanitizer but is based on partial hardware assistance and provides probabilistic protection to use less RAM at run time. Hardware-assisted AddressSanitizer is not production-ready for user space, and is provided mainly for use compiling the Linux Kernel.
To use this sanitizer the command line arguments are:-fsanitize=hwaddress
to instrument userspace code.-fsanitize=kernel-hwaddress
to instrument kernel code.
For targets that produce DWARF debugging information GCC now defaults to DWARF version 5 (with the exception of VxWorks and Darwin/Mac OS X which default to version 2 and AIX which defaults to version 4). This can produce up to 25% more compact debug information compared to earlier versions.
To take full advantage of DWARF version 5 GCC needs to be build against binutils version 2.35.2 or higher. When GCC is build against earlier versions of binutils GCC will still emit DWARF version 5 for most debuginfo data, but will generate version 4 debug line tables (even when explicitly given
-gdwarf-5
).The following debug information consumers can process DWARF version 5:
- GDB 8.0, or higher
- valgrind 3.17.0
- elfutils 0.172, or higher (for use with systemtap, dwarves/pahole, perf and libabigail)
- dwz 0.14
Programs embedding libbacktrace are urged to upgrade to the version shipping with GCC 11.
To make GCC 11 generate an older DWARF version use
-g
together with-gdwarf-2
,-gdwarf-3
or-gdwarf-4
.
New Languages and Language specific improvements
- GCC 11 adds support for non-rectangular loop nests in OpenMP constructs and the allocator routines of OpenMP 5.0, including initial
allocate
clause support in C/C++. TheOMP_TARGET_OFFLOAD
environment variable and the active-levels routines are now supported. For C/C++, thedeclare variant
andmap
support has been extended. For Fortran, OpenMP 4.5 is now fully supported and OpenMP 5.0 support has been extended, including the following features which were before only available in C and C++:order(concurrent)
,device_type
, memorder-clauses forflush
,lastprivate
withconditional
modifier,atomic
construct andreduction
clause extensions of OpenMP 5.0,if
clause withsimd
andcancel
modifiers,target data
withoutmap
clause, and limited support for therequires
construct.
C family
- New attributes:
- The
no_stack_protector
attribute has been added to mark functions which should not be instrumented with stack protection (-fstack-protector
). - The existing
malloc
attribute has been extended so that it can be used to identify allocator/deallocator API pairs. A pair of new-Wmismatched-dealloc
and-Wmismatched-new-delete
warnings will complain about mismatched calls, and-Wfree-nonheap-object
about deallocation calls with pointers not obtained from allocation functions. Additionally, the static analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues.
- The
- New warnings:
-Wmismatched-dealloc
, enabled by default, warns about calls to deallocation functions with pointers returned from mismatched allocation functions.-Wsizeof-array-div
, enabled by-Wall
, warns about divisions of two sizeof operators when the first one is applied to an array and the divisor does not equal the size of the array element.-Wstringop-overread
, enabled by default, warns about calls to string functions reading past the end of the arrays passed to them as arguments. In prior GCC releases most instances of his warning are diagnosed by-Wstringop-overflow
.-Wtsan
, enabled by default, warns about unsupported features in ThreadSanitizer (currentlystd::atomic_thread_fence
).
- Enhancements to existing warnings:
-Wfree-nonheap-object
detects many more instances of calls to deallocation functions with pointers not returned from a dynamic memory allocation function.-Wmaybe-uninitialized
diagnoses passing pointers or references to uninitialized memory to functions takingconst
-qualified arguments.-Wuninitialized
detects reads from uninitialized dynamically allocated memory.
For ELF targets that support the GNU or FreeBSD OSABIs, the
used
attribute will now save the symbol declaration it is applied to from linker garbage collection.To support this behavior,
used
symbols that have not been placed in specific sections (e.g. with thesection
attribute, or the-f{function,data}-sections
options) will be placed in new, unique sections.This functionality requires Binutils version 2.36 or later.
- A series of conditional expressions that compare the same variable can be transformed into a switch statement if each of them contains a comparison expression. Example: This statement can be transformed into a switch statement and then expanded into a bit-test.
- New command-line options:
-fbit-tests
, enabled by default, can be used to enable or disable switch expansion using bit-tests.
- GCOV data file format outputs smaller files by representing zero counters in a more compact way.
- Some short options of the
gcov
tool have been renamed:-i
to-j
and-j
to-H
.
C
- Several 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
.- The
BOOL_MAX
andBOOL_WIDTH
macros are provided in<limits.h>
. - As in C++, function definitions no longer need to give names for unused function parameters.
- The expansions of the
true
andfalse
macros in<stdbool.h>
have changed so that they have typebool
. - The
[[nodiscard]]
standard attribute is now supported. - The
__has_c_attribute
preprocessor operator is now supported. - Macros
INFINITY
,NAN
,FLT_SNAN
,DBL_SNAN
,LDBL_SNAN
,DEC_INFINITY
,DEC_NAN
, and corresponding signaling NaN macros for_FloatN
,_FloatNx
and_DecimalN
types, are provided in<float.h>
. There are also corresponding built-in functions__builtin_nansdN
for decimal signaling NaNs. - Macros
FLT_IS_IEC_60559
,DBL_IS_IEC_60559
andLDBL_IS_IEC_60559
are provided in<float.h>
. - The feature test macro
__STDC_WANT_IEC_60559_EXT__
is supported by<float.h>
. - Labels may appear before declarations and at the end of a compound statement.
- The
- New warnings:
-Warray-parameter
, enabled by-Wall
, warns about redeclarations of functions with ordinary array arguments declared using inconsistent forms. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.-Wvla-parameter
, enabled by-Wall
, warns redeclarations of functions with variable length array arguments declared using inconsistent forms or with mismatched bounds. The warning also enables the detection of the likely out of bounds accesses in calls to such functions with smaller arrays.
C++
- The default mode has been changed to
-std=gnu++17
. - Several C++20 features have been implemented:
- the compiler now supports
consteval virtual
functions - P2082R1, Fixing CTAD for aggregates
- P0593R6, Pseudo-destructors end object lifetimes
- P1907R1, Inconsistencies with non-type template parameters (complete implementation)
- P1975R0, Fixing the wording of parenthesized aggregate-initialization
- P1009R2, Array size deduction in new-expressions
- P1099R5,
using enum
- Modules, Requires
-fmodules-ts
and some aspects are incomplete. Refer to C++ 20 Status
- the compiler now supports
- The C++ front end has experimental support for some of the upcoming C++23 draft features with the
-std=c++23
,-std=gnu++23
,-std=c++2b
or-std=gnu++2b
flags, including- P0330R8, Literal Suffix for (signed) size_t.
- Several C++ Defect Reports have been resolved, e.g.:
- DR 625, Use of
auto
as a template-argument - DR 1512, Pointer comparison vs qualification conversions
- DR 1722, Should lambda to function pointer conversion function be
noexcept
? - DR 1914, Duplicate standard attributes
- DR 2032, Default template-arguments of variable templates
- DR 2289, Uniqueness of decomposition declaration names
- DR 2237, Can a template-id name a constructor?
- DR 2303, Partial ordering and recursive variadic inheritance
- DR 2369, Ordering between constraints and substitution
- DR 2450, braced-init-list as a template-argument
- DR 625, Use of
- G++ now performs better access checking in templates (PR41437).
reinterpret_cast
s in constexpr evaluation are now checked more completely (PR95307).- The diagnostic for
static_assert
has been improved: the compiler now shows the expression including its template arguments (if there were any), and can point to the failing clause if the condition comprised of any logical AND operators (PR97518). - New warnings:
-Wctad-maybe-unsupported
, disabled by default, warns about performing class template argument deduction on a type with no deduction guides.-Wrange-loop-construct
, enabled by-Wall
, warns when a range-based for-loop is creating unnecessary and expensive copies.-Wdeprecated-enum-enum-conversion
, enabled by default in C++20, warns about deprecated arithmetic conversions on operands of enumeration types, as outlined in [depr.arith.conv.enum].-Wdeprecated-enum-float-conversion
, enabled by default in C++20, warns about deprecated arithmetic conversions on operands where one is of enumeration type and the other is of a floating-point type, as outlined in [depr.arith.conv.enum].-Wmismatched-new-delete
, enabled by-Wall
, warns about calls to C++operator delete
with pointers returned from mismatched forms ofoperator new
or from other mismatched allocation functions.-Wvexing-parse
, enabled by default, warns about the most vexing parse rule: the cases when a declaration looks like a variable definition, but the C++ language requires it to be interpreted as a function declaration.
- Enhancements to existing warnings:
-Wnonnull
considers the implicitthis
argument of every C++ nonstatic member function to have been implicitly declared with attributenonnull
and triggers warnings for calls where the pointer is null.
Gcc For Mac Os X
Runtime Library (libstdc++)
- Improved C++17 support, including:
std::from_chars
andstd::to_chars
for floating-point types.
- Improved experimental C++20 support, including:
- Calendar additions to
<chrono>
. Thanks to Cassio Neri for optimizations. std::bit_cast
std::source_location
- Atomic wait and notify operations.
<barrier>
,<latch>
, and<semaphore>
<syncstream>
- Efficient access to
basic_stringbuf
's buffer.
- Calendar additions to
- Experimental C++23 support, including:
contains
member functions for strings, thanks to Paul Fee.std::to_underlying
,std::is_scoped_enum
- Experimental support for quality when originally added in GCC 5. Given that we have maintained API and ABI compatibility since then and it is in use by various projects, we have removed that caveat.
- libgccjit can now be built for MinGW
- The libgccjit API gained 10 new entry points:
- 9 entrypoints for directly embedding asm statements into a compile, analogous to inline
asm
in the C front end
- 9 entrypoints for directly embedding asm statements into a compile, analogous to inline
New Targets and Target Specific Improvements
AArch64 & arm
- A number of new CPUs are supported through arguments to the
-mcpu
and-mtune
options in both the arm and aarch64 backends (GCC identifiers in parentheses):- Arm Cortex-A78 (
cortex-a78
). - Arm Cortex-A78AE (
cortex-a78ae
). - Arm Cortex-A78C (
cortex-a78c
). - Arm Cortex-X1 (
cortex-x1
). - Arm Neoverse V1 (
neoverse-v1
). - Arm Neoverse N2 (
neoverse-n2
).
- Arm Cortex-A78 (
- GCC can now auto-vectorize operations performing addition, subtraction, multiplication and the accumulate/subtract variants on complex numbers, taking advantage of the Advanced SIMD instructions in the Armv8.3-a (AArch64/AArch32), SVE (AArch64), SVE2 (AArch64) and MVE (AArch32 M-profile) instruction sets.
AArch64
- In addition to the above, the following AArch64-only CPUs are now supported:
- Fujitsu A64FX (
a64fx
). - Arm Cortex-R82 (
cortex-r82
).
- Fujitsu A64FX (
- The AArch64 Armv8-R architecture is now supported through the
-march=armv8-r
option. - Mitigation against the Straight-line Speculation vulnerability is supported with the
-mharden-sls=
option. Please refer to the documentation for usage instructions. - The availability of Advanced SIMD intrinsics available through the
arm_neon.h
header is improved and GCC 11 supports the full set of intrinsics defined by ACLE Q3 2020.
AMD Radeon (GCN)
- Initial support for
gfx908
GPUs has been added.
arm
- Initial auto-vectorization is now available when targeting the MVE instruction set.
- GCC can now make use of the Low Overhead Branch instruction in Armv8.1-M to optimize loop counters and checks.
- The
-mcpu=cortex-m55
option now supports the extensions+nomve
and+nomve.fp
to control generation of MVE and MVE floating-point instructions.
IA-32/x86-64
- New ISA extension support for Intel TSXLDTRK was added to GCC. TSXLDTRK intrinsics are available via the
-mtsxldtrk
compiler switch. - New ISA extension support for Intel SERIALIZE was added to GCC. SERIALIZE intrinsics are available via the
-mserialize
compiler switch. - New ISA extension support for Intel HRESET was added to GCC. HRESET intrinsics are available via the
-mhreset
compiler switch. - New ISA extension support for Intel UINTR was added to GCC. UINTR intrinsics are available via the
-muintr
compiler switch. - New ISA extension support for Intel KEYLOCKER was added to GCC. KEYLOCKER intrinsics are available via the
-mkeylocker
compiler switch. - New ISA extension support for Intel AMX-TILE, AMX-INT8, AMX-BF16 was added to GCC. AMX-TILE, AMX-INT8, AMX-BF16 intrinsics are available via the
-mamx-tile, -mamx-int8, -mamx-bf16
compiler switches. - New ISA extension support for Intel AVX-VNNI was added to GCC. AVX-VNNI intrinsics are available via the
-mavxvnni
compiler switch. - GCC now supports the Intel CPU named Sapphire Rapids through
-march=sapphirerapids
. The switch enables the MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, SERIALIZE, PTWRITE, WAITPKG, TSXLDTRK, AMT-TILE, AMX-INT8, AMX-BF16, and AVX-VNNI ISA extensions. - GCC now supports the Intel CPU named Alderlake through
-march=alderlake
. The switch enables the CLDEMOTE, PTWRITE, WAITPKG, SERIALIZE, KEYLOCKER, AVX-VNNI, and HRESET ISA extensions.
Nios II
- The options
-mcustom-insn=N
no longer produce compiler warnings if the custom instruction is not generated due to missing optimization options such as-fno-math-errno
,-ffinite-math-only
, or-funsafe-math-optimizations
. These warnings were not consistently emitted for all custom instructions. - The
-mcustom-fpu-cfg=fph2
option has been added to enable the custom instructions supported by the Nios II Floating Point Hardware 2 Component.
NVPTX
- The
-misa
default has changed fromsm_30
tosm_35
. - The
-m32
compiler switch has been removed. - The
-msoft-stack-reserve-local
format has been fixed. Previously, it accepted-msoft-stack-reserve-local<n>
. It now accepts-msoft-stack-reserve-local=<n>
.
S/390, System z, IBM Z Systems
- The behavior when compiling with
-fexcess-precision=standard
(e.g., implied by-std=c99
) on s390(x) targets can now be controlled at configure time with the flag--enable-s390-excess-float-precision
. When enabled, GCC will maintain previous behavior and evaluate float expressions in double precision, which aligns with the definition offloat_t
asdouble
. With the flag disabled, GCC will always evaluate float expressions in single precision. In native builds and cross compiles that have target libc headers, GCC will by default match the definition offloat_t
in the installed glibc.
Operating Systems
AIX
- GCC for AIX can be built as a 64 bit application and the runtimeis built as FAT libraries containing both 32 bit and 64 bit objects.
- Support AIX Vector Extended ABI with -mabi=vec-extabi.
- Thread-Local uninitiated data placed in local common section.
- Use thread-safe access in ctype.
- Link with libc128.a when long-double-128 enabled.
Improvements to Static Analyzer
- The implementation of how program state is tracked within -fanalyzer has been completely rewritten for GCC 11, fixing numerous bugs, and allowing for the analyzer to scale to larger C source files.
- The analysis of allocations and deallocations has been generalized beyond
malloc
andfree
.- As preliminary work towards eventually supporting C++, the
malloc
/free
checking will also checknew
/delete
andnew[]
/delete[]
. However, C++ is not yet properly supported by-fanalyzer
(for example, exception-handling is unimplemented). - As noted above, the existing
malloc
attribute has been extended so that it can be used to identify allocator/deallocator API pairs. The analyzer will use these attributes when checking for leaks, double-frees, use-after-frees, and similar issues. - A new
-Wanalyzer-mismatching-deallocation
warning has been added, covering such mismatches as using scalardelete
rather vectordelete[]
.
- As preliminary work towards eventually supporting C++, the
- The analyzer has gained warnings
-Wanalyzer-shift-count-negative
,-Wanalyzer-shift-count-overflow
,-Wanalyzer-write-to-const
, and-Wanalyzer-write-to-string-literal
, all enabled by default when-fanalyzer
is enabled. - The analyzer can now be extended by GCC plugins, allowing for domain-specific path-sensitive warnings. An example of using a GCC plugin to check for misuses of CPython's global interpreter lock can be seen in the test suite
- The analyzer has gained new debugging options
-fdump-analyzer-json
and-fno-analyzer-feasibility
.
Other significant improvements
- GCC has gained a new environment variable
GCC_EXTRA_DIAGNOSTIC_OUTPUT
which can be used by IDEs to request machine-readable fix-it hints without needing to adjust build flags.
Copyright (C)Free Software Foundation, Inc.Verbatim copying and distribution of this entire article ispermitted in any medium, provided this notice is preserved.
These pages aremaintained by the GCC team.Last modified 2021-03-25.