GCC 16 has been released

GCC 16 has been released

GCC 16 Release Series: Changes, New Features, and Fixes This page is a “brief” summary of some of the huge number of improvements in GCC 16. You may also want to check out our Porting to GCC 16 page and the full GCC documentation. GCC 16 发布系列:变更、新特性与修复 本页面简要总结了 GCC 16 中海量改进的一部分。您可能还需要查看我们的“移植到 GCC 16”页面以及完整的 GCC 文档。

Caveats int8_t etc. are now signed char on Solaris for conformance with the C99 standard. However, this is an incompatible change. See the porting notes for more information. The -pthread option no longer predefines _REENTRANT on Solaris. See the porting notes for more information. The so-called “json” format for -fdiagnostics-format= has been removed in this release. Users seeking machine-readable diagnostics from GCC should use SARIF. 注意事项 为了符合 C99 标准,Solaris 上的 int8_t 等类型现在被定义为 signed char。这是一个不兼容的变更,详情请参阅移植说明。-pthread 选项在 Solaris 上不再预定义 _REENTRANT,详情请参阅移植说明。本版本移除了 -fdiagnostics-format= 的所谓“json”格式。需要机器可读诊断信息的 GCC 用户应使用 SARIF。

General Improvements Link-Time Optimization now supports better handling of toplevel asm statements with -flto-toplevel-asm-heuristics. Speculative devirtualization now handles general indirect function calls and supports speculating of more than one target. The vectorizer is now more flexible in identifying in-loop parallelism of reductions. The vectorizer now supports vectorizing uncounted loops or loops for which the number of iterations could not be determined. The vectorizer now supports peeling for alignment for vector length agnostic loops using masking. The vectorizer now supports mutual peeling for alignment. The vectorizer now generates more efficient code for loops with early breaks by eliminating the vector induction computations. 常规改进 链接时优化(LTO)现在通过 -flto-toplevel-asm-heuristics 对顶层 asm 语句提供更好的处理支持。推测性去虚拟化(Speculative devirtualization)现在可以处理通用的间接函数调用,并支持对多个目标进行推测。向量化器在识别循环内归约并行性方面变得更加灵活。向量化器现在支持对未计数循环或迭代次数无法确定的循环进行向量化。向量化器现在支持使用掩码对向量长度无关(VLA)循环进行对齐剥离。向量化器现在支持相互对齐剥离。向量化器现在通过消除向量归纳计算,为带有提前中断(early breaks)的循环生成更高效的代码。

Documentation The documentation for GCC Command Options and the option index have been corrected to include many previously missing options. The documentation for GCC-specific attributes has been modernized to put more emphasis on the standard attribute syntax, which GCC accepts in all supported dialects of C and C++. The material has also been reorganized to be less repetitive, and there is a new index for attributes. Documentation for parameters and option spec files has been moved from the main GCC manual to the GCC internals manual. These features are intended for use by GCC developers and those who need to build custom GCC configurations. 文档 GCC 命令行选项文档和选项索引已修正,补全了许多之前缺失的选项。GCC 特定属性的文档已进行现代化改造,更加强调标准属性语法(GCC 在所有支持的 C 和 C++ 方言中均接受该语法)。内容也经过重组以减少重复,并新增了属性索引。参数和选项规范文件的文档已从 GCC 主手册移至 GCC 内部手册。这些功能旨在供 GCC 开发人员以及需要构建自定义 GCC 配置的用户使用。

New Languages and Language specific improvements OpenMP See the GNU Offloading and Multi-Processing Project (GOMP) page for general information. The memory allocation support has been enhanced: for allocators with the pinned trait, including ompx_gnu_pinned_mem_alloc, the CUDA API (if available) is used; this improves the performance when accessing this memory on Nvidia GPUs. The newly added ompx_gnu_managed_mem_alloc allocator and the ompx_gnu_managed_mem_space (both GNU extensions) allocate device-accessible memory on the host. Such memory is device accessible even when unified-shared memory is not supported and might have different page-migration behavior than other memory on systems even if all host memory is device accessible. 新语言与特定语言改进 OpenMP 有关常规信息,请参阅 GNU 卸载与多处理项目 (GOMP) 页面。内存分配支持得到了增强:对于具有 pinned 特性的分配器(包括 ompx_gnu_pinned_mem_alloc),如果可用,将使用 CUDA API;这提高了在 Nvidia GPU 上访问此类内存的性能。新增的 ompx_gnu_managed_mem_alloc 分配器和 ompx_gnu_managed_mem_space(均为 GNU 扩展)在主机上分配设备可访问的内存。即使在不支持统一共享内存的情况下,此类内存也是设备可访问的;即使在所有主机内存均可被设备访问的系统上,其页面迁移行为也可能与其他内存不同。

OpenMP 5.0: Limited support for declare mapper has been added for C and C++, only. The uses_allocators clause is now supported, including the OpenMP 5.2 syntax changes and supporting semicolons (OpenMP 6.0); for now, only predefined allocators are supported. OpenMP 5.1: Initial support for the iterator modifier in map clauses and the target update construct has been added for C and C++. OpenMP 5.2: The begin declare variant directive for C and C++ is now supported. OpenMP 6.0: The omp_target_memset and omp_target_memset_async API routines have been added. The no_openmp_constructs assumptions clause can now be used. OpenMP Technical Report 14 (TR14): The named omp_default_device constant has been added to denote the default-device number. OpenMP 5.0:仅针对 C 和 C++ 添加了对 declare mapper 的有限支持。现在支持 uses_allocators 子句,包括 OpenMP 5.2 的语法变更及对分号的支持(OpenMP 6.0);目前仅支持预定义的分配器。OpenMP 5.1:针对 C 和 C++,在 map 子句和 target update 结构中初步支持了 iterator 修饰符。OpenMP 5.2:现在支持 C 和 C++ 的 begin declare variant 指令。OpenMP 6.0:添加了 omp_target_memset 和 omp_target_memset_async API 例程。现在可以使用 no_openmp_constructs assumptions 子句。OpenMP 技术报告 14 (TR14):添加了命名常量 omp_default_device,用于表示默认设备编号。

For OpenMP directives and clauses that have been deprecated in OpenMP 5.0, 5.1, or 5.2, a deprecation warning is shown, hinting at the to-be-used syntax; the warning is on by default and can be silenced using -Wno-deprecated-openmp. Additionally, a deprecation warning is shown when using a deprecated named constant or API routine; this warning can be silenced using -Wno-deprecated-declarations. 对于在 OpenMP 5.0、5.1 或 5.2 中已弃用的 OpenMP 指令和子句,系统会显示弃用警告,并提示应使用的语法;该警告默认开启,可通过 -Wno-deprecated-openmp 关闭。此外,当使用已弃用的命名常量或 API 例程时,也会显示弃用警告;该警告可通过 -Wno-deprecated-declarations 关闭。

OpenACC See the GCC OpenACC wiki page for general information. The acc_memcpy_device and acc_memcpy_device_async API routines have been added for C, C++ and Fortran. OpenACC 3.0: The wait directive now accepts the if clause. OpenACC 3.3: The Fortran API routines acc_attach and acc_detach now augment their OpenACC 2.6 C/C++ counterparts. OpenACC 3.4: In Fortran, named constants (PARAMETER) used as var in data clauses are now permitted by the specification and GCC for better compatibility with existing code; however, with GCC, specifying them in data clauses affects neither compile-time nor runtime behavior. OpenACC 有关常规信息,请参阅 GCC OpenACC Wiki 页面。为 C、C++ 和 Fortran 添加了 acc_memcpy_device 和 acc_memcpy_device_async API 例程。OpenACC 3.0:wait 指令现在接受 if 子句。OpenACC 3.3:Fortran API 例程 acc_attach 和 acc_detach 现在增强了其 OpenACC 2.6 C/C++ 对应功能。OpenACC 3.4:在 Fortran 中,规范和 GCC 现在允许在数据子句中将命名常量 (PARAMETER) 用作 var,以更好地兼容现有代码;但在 GCC 中,在数据子句中指定它们不会影响编译时或运行时的行为。

Ada GNAT Extensions The Constructor [RFC] and Destructor [RFC] extensions add new construction/finalization mechanisms that differ significantly from standard Ada. Those features are inspired by object-oriented programming in other widely used languages (such as C++). Implicit with allows a stand-alone use clause in the context clause of a compilation unit to imply an implicit with of the same library unit where an equivalent with clause would be allowed. Structural Generic instantiation [RFC] allows reference to an implicit instance of a generic unit, that is denoted directly by the unit’s name and actual parameters, rather than by a separately declared name. The Extended_Access aspect can be specified on a general access type declaration designating an unconstrained array subtype. It changes the pointer representation and allows easier interfacing with foreign languages when memory for the designated object is not allocated by Ada. In particular, it allows the creation of access to an array slice [RFC]. Ada GNAT 扩展 Constructor [RFC] 和 Destructor [RFC] 扩展添加了与标准 Ada 有显著差异的新构造/终结机制。这些特性受到其他广泛使用语言(如 C++)中面向对象编程的启发。Implicit with 允许编译单元上下文子句中的独立 use 子句隐含对同一库单元的隐式 with,前提是该处允许等效的 with 子句。结构化泛型实例化 [RFC] 允许引用泛型单元的隐式实例,该实例直接由单元名称和实际参数表示,而不是通过单独声明的名称。Extended_Access 特性可以在指定非约束数组子类型的通用访问类型声明上指定。它改变了指针表示,并在指定对象的内存不由 Ada 分配时,允许更轻松地与外部语言进行接口对接。特别是,它允许创建对数组切片的访问 [RFC]。

Other VAST (Verifier for the Ada Semantic Tree), enabled with -gnatd_V (or -gnatd_W for verbose mode), can be used to debug the compiler. It checks various properties of the produced Ada Semantic Tree and reports detected violations. The semantic analysis of Ada 2022’s Reduction Expressions has been enhanced. The Ada.Containers.Bounded_Indefinite_Holders unit has been added. 其他 VAST(Ada 语义树验证器,通过 -gnatd_V 或 -gnatd_W(详细模式)启用)可用于调试编译器。它检查生成的 Ada 语义树的各种属性,并报告检测到的违规情况。Ada 2022 归约表达式的语义分析得到了增强。添加了 Ada.Containers.Bounded_Indefinite_Holders 单元。