From 5910fa8090fd92f4da927ee9d8fe1e5d59fbd77f Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 22 Nov 2022 17:08:32 -0500 Subject: [PATCH] Fix -Wmismatched-dealloc documentation Also fix the detection of Sapphire Rapids in host_detect_local_cpu. Resolves: #2116635 --- gcc.spec | 7 ++- gcc11-Wmismatched-dealloc-doc.patch | 79 +++++++++++++++++++++++++++++ gcc11-detect-sapphirerapids.patch | 69 +++++++++++++++++++++++++ 3 files changed, 154 insertions(+), 1 deletion(-) create mode 100644 gcc11-Wmismatched-dealloc-doc.patch create mode 100644 gcc11-detect-sapphirerapids.patch diff --git a/gcc.spec b/gcc.spec index 847480d..ee96bce 100644 --- a/gcc.spec +++ b/gcc.spec @@ -273,6 +273,8 @@ Patch20: gcc11-relocatable-pch.patch Patch21: gcc11-dejagnu-multiline.patch Patch23: gcc11-pie.patch Patch24: gcc11-bind-now.patch +Patch25: gcc11-detect-sapphirerapids.patch +Patch26: gcc11-Wmismatched-dealloc-doc.patch Patch100: gcc11-fortran-fdec-duplicates.patch Patch101: gcc11-fortran-flogical-as-integer.patch @@ -824,6 +826,8 @@ so that there cannot be any synchronization problems. %patch21 -p1 -b .dejagnu-multiline~ %patch23 -p1 -b .pie~ %patch24 -p1 -b .now~ +%patch25 -p1 -b .detect-spr~ +%patch26 -p1 -b .Wmismatched-dealloc-doc~ %if 0%{?rhel} >= 9 %patch100 -p1 -b .fortran-fdec-duplicates~ @@ -3323,7 +3327,8 @@ end tree-optimization/106112, tree-optimization/106131, tree-optimization/106189, tree-optimization/106513, tree-optimization/106892, tree-optimization/106934 - +- fix the detection of Sapphire Rapids in host_detect_local_cpu +- fix -Wmismatched-dealloc documentation (#2116635) * Tue Jul 12 2022 Marek Polacek 11.3.1-2.1 - fix handling of invalid ranges in std::regex (#2106262) diff --git a/gcc11-Wmismatched-dealloc-doc.patch b/gcc11-Wmismatched-dealloc-doc.patch new file mode 100644 index 0000000..134fb18 --- /dev/null +++ b/gcc11-Wmismatched-dealloc-doc.patch @@ -0,0 +1,79 @@ +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 3419483c532..a2a6b1c98be 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -255,7 +255,7 @@ in the following sections. + -Wno-inherited-variadic-ctor -Wno-init-list-lifetime @gol + -Winvalid-imported-macros @gol + -Wno-invalid-offsetof -Wno-literal-suffix @gol +--Wno-mismatched-new-delete -Wmismatched-tags @gol ++-Wmismatched-new-delete -Wmismatched-tags @gol + -Wmultiple-inheritance -Wnamespaces -Wnarrowing @gol + -Wnoexcept -Wnoexcept-type -Wnon-virtual-dtor @gol + -Wpessimizing-move -Wno-placement-new -Wplacement-new=@var{n} @gol +@@ -3966,7 +3966,7 @@ The warning is inactive inside a system header file, such as the STL, so + one can still use the STL. One may also instantiate or specialize + templates. + +-@item -Wno-mismatched-new-delete @r{(C++ and Objective-C++ only)} ++@item -Wmismatched-new-delete @r{(C++ and Objective-C++ only)} + @opindex Wmismatched-new-delete + @opindex Wno-mismatched-new-delete + Warn for mismatches between calls to @code{operator new} or @code{operator +@@ -3998,7 +3998,7 @@ The related option @option{-Wmismatched-dealloc} diagnoses mismatches + involving allocation and deallocation functions other than @code{operator + new} and @code{operator delete}. + +-@option{-Wmismatched-new-delete} is enabled by default. ++@option{-Wmismatched-new-delete} is included in @option{-Wall}. + + @item -Wmismatched-tags @r{(C++ and Objective-C++ only)} + @opindex Wmismatched-tags +@@ -5543,6 +5543,8 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}. + -Wmemset-elt-size @gol + -Wmemset-transposed-args @gol + -Wmisleading-indentation @r{(only for C/C++)} @gol ++-Wmismatched-dealloc @gol ++-Wmismatched-new-delete @r{(only for C/C++)} @gol + -Wmissing-attributes @gol + -Wmissing-braces @r{(only for C/ObjC)} @gol + -Wmultistatement-macros @gol +@@ -6428,7 +6430,7 @@ Ignoring the warning can result in poorly optimized code. + disable the warning, but this is not recommended and should be done only + when non-existent profile data is justified. + +-@item -Wno-mismatched-dealloc ++@item -Wmismatched-dealloc + @opindex Wmismatched-dealloc + @opindex Wno-mismatched-dealloc + +@@ -6461,7 +6463,7 @@ void f (void) + In C++, the related option @option{-Wmismatched-new-delete} diagnoses + mismatches involving either @code{operator new} or @code{operator delete}. + +-Option @option{-Wmismatched-dealloc} is enabled by default. ++Option @option{-Wmismatched-dealloc} is included in @option{-Wall}. + + @item -Wmultistatement-macros + @opindex Wmultistatement-macros +@@ -7951,9 +7953,9 @@ Warnings controlled by the option can be disabled either by specifying + Disable @option{-Wframe-larger-than=} warnings. The option is equivalent + to @option{-Wframe-larger-than=}@samp{SIZE_MAX} or larger. + +-@item -Wno-free-nonheap-object +-@opindex Wno-free-nonheap-object ++@item -Wfree-nonheap-object + @opindex Wfree-nonheap-object ++@opindex Wno-free-nonheap-object + Warn when attempting to deallocate an object that was either not allocated + on the heap, or by using a pointer that was not returned from a prior call + to the corresponding allocation function. For example, because the call +@@ -7970,7 +7972,7 @@ void f (char *p) + @} + @end smallexample + +-@option{-Wfree-nonheap-object} is enabled by default. ++@option{-Wfree-nonheap-object} is included in @option{-Wall}. + + @item -Wstack-usage=@var{byte-size} + @opindex Wstack-usage diff --git a/gcc11-detect-sapphirerapids.patch b/gcc11-detect-sapphirerapids.patch new file mode 100644 index 0000000..c130e4b --- /dev/null +++ b/gcc11-detect-sapphirerapids.patch @@ -0,0 +1,69 @@ +commit 63dd214dce603f4f99e2cb272255b6c2b4308c3d +Author: Cui,Lili +Date: Mon Nov 7 11:25:41 2022 +0800 + + Remove AVX512_VP2INTERSECT from PTA_SAPPHIRERAPIDS + + gcc/ChangeLog: + + * config/i386/driver-i386.cc (host_detect_local_cpu): + Move sapphirerapids out of AVX512_VP2INTERSECT. + * config/i386/i386.h: Remove AVX512_VP2INTERSECT from PTA_SAPPHIRERAPIDS + * doc/invoke.texi: Remove AVX512_VP2INTERSECT from SAPPHIRERAPIDS + + (cherry picked from commit d644dfe36d9733c767af62d37250253ced6efd8c) + +diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c +index f844a168ddb..90f84aba4ee 100644 +--- a/gcc/config/i386/driver-i386.c ++++ b/gcc/config/i386/driver-i386.c +@@ -574,15 +574,12 @@ const char *host_detect_local_cpu (int argc, const char **argv) + /* This is unknown family 0x6 CPU. */ + if (has_feature (FEATURE_AVX)) + { ++ /* Assume Tiger Lake */ + if (has_feature (FEATURE_AVX512VP2INTERSECT)) +- { +- if (has_feature (FEATURE_TSXLDTRK)) +- /* Assume Sapphire Rapids. */ +- cpu = "sapphirerapids"; +- else +- /* Assume Tiger Lake */ +- cpu = "tigerlake"; +- } ++ cpu = "tigerlake"; ++ /* Assume Sapphire Rapids. */ ++ else if (has_feature (FEATURE_TSXLDTRK)) ++ cpu = "sapphirerapids"; + /* Assume Cooper Lake */ + else if (has_feature (FEATURE_AVX512BF16)) + cpu = "cooperlake"; +diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h +index ac0e5da623c..e03279bcf39 100644 +--- a/gcc/config/i386/i386.h ++++ b/gcc/config/i386/i386.h +@@ -2562,7 +2562,7 @@ constexpr wide_int_bitmask PTA_ICELAKE_SERVER = PTA_ICELAKE_CLIENT + constexpr wide_int_bitmask PTA_TIGERLAKE = PTA_ICELAKE_CLIENT | PTA_MOVDIRI + | PTA_MOVDIR64B | PTA_CLWB | PTA_AVX512VP2INTERSECT | PTA_KL | PTA_WIDEKL; + constexpr wide_int_bitmask PTA_SAPPHIRERAPIDS = PTA_ICELAKE_SERVER | PTA_MOVDIRI +- | PTA_MOVDIR64B | PTA_AVX512VP2INTERSECT | PTA_ENQCMD | PTA_CLDEMOTE ++ | PTA_MOVDIR64B | PTA_ENQCMD | PTA_CLDEMOTE + | PTA_PTWRITE | PTA_WAITPKG | PTA_SERIALIZE | PTA_TSXLDTRK | PTA_AMX_TILE + | PTA_AMX_INT8 | PTA_AMX_BF16 | PTA_UINTR | PTA_AVXVNNI | PTA_AVX512BF16; + constexpr wide_int_bitmask PTA_KNL = PTA_BROADWELL | PTA_AVX512PF +diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi +index 3419483c532..6b3afb827a5 100644 +--- a/gcc/doc/invoke.texi ++++ b/gcc/doc/invoke.texi +@@ -30236,9 +30236,9 @@ Intel sapphirerapids CPU with 64-bit extensions, MOVBE, MMX, SSE, SSE2, SSE3, + SSSE3, SSE4.1, SSE4.2, POPCNT, CX16, SAHF, FXSR, AVX, XSAVE, PCLMUL, FSGSBASE, + RDRND, F16C, AVX2, BMI, BMI2, LZCNT, FMA, MOVBE, HLE, RDSEED, ADCX, PREFETCHW, + AES, CLFLUSHOPT, XSAVEC, XSAVES, SGX, AVX512F, AVX512VL, AVX512BW, AVX512DQ, +-AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2 ++AVX512CD, PKU, AVX512VBMI, AVX512IFMA, SHA, AVX512VNNI, GFNI, VAES, AVX512VBMI2, + VPCLMULQDQ, AVX512BITALG, RDPID, AVX512VPOPCNTDQ, PCONFIG, WBNOINVD, CLWB, +-MOVDIRI, MOVDIR64B, AVX512VP2INTERSECT, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, ++MOVDIRI, MOVDIR64B, ENQCMD, CLDEMOTE, PTWRITE, WAITPKG, + SERIALIZE, TSXLDTRK, UINTR, AMX-BF16, AMX-TILE, AMX-INT8, AVX-VNNI and + AVX512BF16 instruction set support. +