Re: [COMMITTED] path solver: Solve PHI imports first for ranges.

2021-11-13 Thread Aldy Hernandez via Gcc-patches
On Sat, Nov 13, 2021 at 1:51 AM Andrew MacLeod wrote: > > On 11/12/21 14:50, Richard Biener via Gcc-patches wrote: > > On November 12, 2021 8:46:25 PM GMT+01:00, Aldy Hernandez via Gcc-patches > > wrote: > >> PHIs must be resolved first while solving ranges in a block, > >> regardless of where t

[PATCH 1/2] Add cumulative_args_t variants of TARGET_FUNCTION_ROUND_BOUNDARY and friends

2021-11-13 Thread Maxim Blinov
The two target hooks responsible for informing GCC about stack parameter alignment are `TARGET_FUNCTION_ARG_BOUNDARY` and `TARGET_FUNCTION_ARG_ROUND_BOUNDARY`, which currently only consider the tree and machine_mode of a specific given argument. Create two new target hooks suffixed with '_CA', and

[PATCH 2/2] Implement TARGET_..._CA target hooks for AArch64 Darwin

2021-11-13 Thread Maxim Blinov
Note: This patch is not yet ready for trunk as its dependent on some patches that are not-yet-upstream, however it serves as motivation for the previous patch(es) which are independent. The AArch64 Darwin platform requires that named stack arguments are passed naturally-aligned, while variad

[PATCH 3/4] Add aarch64-linux support for off-stack trampolines

2021-11-13 Thread Maxim Blinov
Implement the __builtin_nested_func_ptr_{created,deleted} functions for the aarch64-linux platform. This serves to exercise the infrastructure added in libgcc (--enable-off-stack-trampolines) and gcc (-foff-stack-trampolines) in supporting off-stack trampoline generation, and is intended primarily

[PATCH 2/4] Add x86_64-linux support for off-stack trampolines

2021-11-13 Thread Maxim Blinov
Implement the __builtin_nested_func_ptr_{created,deleted} functions for the x86_64-linux platform. This serves to exercise the infrastructure added in libgcc (--enable-off-stack-trampolines) and gcc (-foff-stack-trampolines) in supporting off-stack trampoline generation, and is intended primarily f

[PATCH 1/4] Generate off-stack nested function trampolines

2021-11-13 Thread Maxim Blinov
Add support for allocating nested function trampolines on an executable heap rather than on the stack. This is motivated by targets such as AArch64 Darwin, which globally prohibit executing code on the stack. The target-specific routines for allocating and writing trampolines is to be provided in

[PATCH 4/4] Add aarch64-darwin support for off-stack trampolines

2021-11-13 Thread Maxim Blinov
Note: This patch is not yet ready for trunk as its dependent on some patches that are not-yet-upstream, however it serves as motivation for the previous patch(es) which are independent. Implement the __builtin_nested_func_ptr_{created,deleted} functions for the aarch64-darwin platform. For t

Re: [PATCH] Combine malloc + memset to calloc

2021-11-13 Thread Prathamesh Kulkarni via Gcc-patches
On Sat, 13 Nov 2021 at 02:00, Seija K. via Gcc-patches wrote: > > diff --git a/gcc/ada/terminals.c b/gcc/ada/terminals.c > index a2dd4895d48..25d9acda752 100644 > --- a/gcc/ada/terminals.c > +++ b/gcc/ada/terminals.c > @@ -609,8 +609,7 @@ __gnat_setup_communication (struct TTY_Process** > process_

[COMMITTED] path solver: Merge path_range_query constructors.

2021-11-13 Thread Aldy Hernandez via Gcc-patches
There's no need for two constructors, when we can do it all with one that defaults to the common behavior: path_range_query (bool resolve = true, gimple_ranger *ranger = NULL); Tested on x86-64 Linux. gcc/ChangeLog: * gimple-range-path.cc (path_range_query::path_range_query): Merge

Enable ipa-sra for functions with fnspec attribute

2021-11-13 Thread Jan Hubicka via Gcc-patches
Hi, this patch enables some ipa-sra on fortran by allowing signature changes on functions with "fn spec" attribute when ipa-modref is enabled. This is possible since ipa-modref knows how to preserve things we trace in fnspec and fnspec generated by fortran forntend are quite simple and can be a

[committed] libstdc++: Implement std::spanstream for C++23

2021-11-13 Thread Jonathan Wakely via Gcc-patches
The tests are just the two small examples from the proposal, so more tests are definitely needed. They can wait for stage 3 though. Tested powerpc64le-linux, pushed to trunk. This implements the header, as proposed for C++23 by P0448R4. libstdc++-v3/ChangeLog: * include/Makefile.am: Ad

Re: [COMMITTED] path solver: Solve PHI imports first for ranges.

2021-11-13 Thread Aldy Hernandez via Gcc-patches
On Sat, Nov 13, 2021 at 10:41 AM Aldy Hernandez wrote: > > On Sat, Nov 13, 2021 at 1:51 AM Andrew MacLeod wrote: > > > > On 11/12/21 14:50, Richard Biener via Gcc-patches wrote: > > > On November 12, 2021 8:46:25 PM GMT+01:00, Aldy Hernandez via Gcc-patches > > > wrote: > > >> PHIs must be reso

[PATCH] PCH: Make the save and restore diagnostics more robust.

2021-11-13 Thread Iain Sandoe via Gcc-patches
When saving, if we cannot obtain a suitable memory segment there is no point in continuing, so exit with an error. When reading in the PCH, we have a situation that the read-in data will replace the line tables used by the diagnostics output. However, the state of the read-in line tables is indete

[PATCH] libsanitizer: Merge with upstream

2021-11-13 Thread H.J. Lu via Gcc-patches
Merged revision: 82bc6a094e85014f1891ef9407496f44af8fe442 with the fix for PR sanitizer/102911 --- libsanitizer/MERGE| 2 +- libsanitizer/asan/asan_allocator.cpp | 17 ++- libsanitizer/asan/asan_globals.cpp| 19 +++ libsanitizer/asan/asan_inter

[PATCH][_GLIBCXX_DEBUG] Code cleanup/simplification

2021-11-13 Thread François Dumont via Gcc-patches
    libstdc++: [_GLIBCXX_DEBUG] Remove _Safe_container<>::_M_safe()     Container code cleanup to get rid of _Safe_container<>::_M_safe() and just     _Safe:: calls which use normal inheritance. Also remove several usages of _M_base()     which can be most of the time ommitted and sometimes rep

Re: [PATCH] rs6000: MMA test case emits wrong code when building a vector pair

2021-11-13 Thread Segher Boessenkool
On Wed, Oct 27, 2021 at 08:37:57PM -0500, Peter Bergner wrote: > PR102976 shows a test case where we generate wrong code when building > a vector pair from 2 vector registers. The bug here is that with unlucky > register assignments, we can clobber one of the input operands before > we write both

Re: [COMMITTED] path solver: Solve PHI imports first for ranges.

2021-11-13 Thread Richard Biener via Gcc-patches
On November 13, 2021 10:41:02 AM GMT+01:00, Aldy Hernandez wrote: >On Sat, Nov 13, 2021 at 1:51 AM Andrew MacLeod wrote: >> >> On 11/12/21 14:50, Richard Biener via Gcc-patches wrote: >> > On November 12, 2021 8:46:25 PM GMT+01:00, Aldy Hernandez via Gcc-patches >> > wrote: >> >> PHIs must be

Re: [COMMITTED] path solver: Solve PHI imports first for ranges.

2021-11-13 Thread Aldy Hernandez via Gcc-patches
On Sat, Nov 13, 2021 at 2:26 PM Richard Biener wrote: > > On November 13, 2021 10:41:02 AM GMT+01:00, Aldy Hernandez > wrote: > >On Sat, Nov 13, 2021 at 1:51 AM Andrew MacLeod wrote: > >> > >> On 11/12/21 14:50, Richard Biener via Gcc-patches wrote: > >> > On November 12, 2021 8:46:25 PM GMT+01

Re: [COMMITTED] path solver: Solve PHI imports first for ranges.

2021-11-13 Thread Aldy Hernandez via Gcc-patches
On Sat, Nov 13, 2021 at 12:55 PM Aldy Hernandez wrote: > > On Sat, Nov 13, 2021 at 10:41 AM Aldy Hernandez wrote: > > > > On Sat, Nov 13, 2021 at 1:51 AM Andrew MacLeod wrote: > > > > > > On 11/12/21 14:50, Richard Biener via Gcc-patches wrote: > > > > On November 12, 2021 8:46:25 PM GMT+01:00,

Remember fnspec EAF flags in modref summary

2021-11-13 Thread Jan Hubicka via Gcc-patches
Hi, this patch stores eaf flags from fnspec to modref summaries. THis makes them survive signature changes and also improves IPA propagation in case modref is not able to autodetect given flag. Bootstrapped/regtested x86_64-linux, comitted. Honza gcc/ChangeLog: * attr-fnspec.h (attr_fn

[committed] analyzer: add four new taint-based warnings

2021-11-13 Thread David Malcolm via Gcc-patches
The initial commit of the analyzer in GCC 10 had a single warning, -Wanalyzer-tainted-array-index and required manually enabling the taint checker with -fanalyzer-checker=taint (due to scaling issues). This patch extends the taint detection to add four new taint-based warnings: -Wanalyzer-tai

[PATCH] Ada, Darwin : Use DSYMUTIL_FOR_TARGET in libgnat/gnarl builds.

2021-11-13 Thread Iain Sandoe via Gcc-patches
Most of the time we get away with using the dsymutil that is installed with the latest Xcode, however for some cross-compilation cases that does not work. We now have the ability to specify the correct dsymutil to use for the toolchain (--with-dsymutil=) and we should use that specified tool for d

Enable more type attributes for signature changes

2021-11-13 Thread Jan Hubicka via Gcc-patches
Hi, this patch whitelists attributes that are safe for attribute changes and also makes access attribute dropped if function sigunature is changed. We could do better by updating the attribute, but doing so seems to be bit snowballing since with LTO the warnings produced seems bit confused. We woul

Re: [PATCH v2] IPA: Provide a mechanism to register static DTORs via cxa_atexit.

2021-11-13 Thread Jan Hubicka via Gcc-patches
> sheesh … EWRONGREVISEDPATCH > > > On 5 Nov 2021, at 13:08, Iain Sandoe wrote: > > > > I tried enabling this on x86-64-linux (just for interest) and it seems to > > work > > OK there too - but that testing revealed a thinko that didn’t show with a > > a normal regstrap. > > … now with the cor

Re: [PATCH] fixincludes: simplify handling for access() failure [PR21283, PR80047]

2021-11-13 Thread Bruce Korb via Gcc-patches
Perfect. On 11/12/21 1:58 PM, Xi Ruoyao wrote: diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c index 6dba2f6e830..ee57fbf61b4 100644 --- a/fixincludes/fixincl.c +++ b/fixincludes/fixincl.c @@ -1352,11 +1352,10 @@ process (void) if (access (pz_curr_file, R_OK) != 0) { -

[PATCH 2/2] Sync with binutils: Support the PGO build for binutils+gdb

2021-11-13 Thread H.J. Lu via Gcc-patches
Sync with binutils for building binutils with LTO: >From af019bfde9b13d628202fe58054ec7ff08d92a0f Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 9 Jan 2021 06:51:15 -0800 Subject: [PATCH] Support the PGO build for binutils+gdb Add the --enable-pgo-build[=lto] configure option. When binutil

[PATCH 1/2] Sync with binutils: GCC: Pass --plugin to AR and RANLIB

2021-11-13 Thread H.J. Lu via Gcc-patches
Sync with binutils for building binutils with LTO: >From 50ad1254d5030d0804cbf89c758359ae202e8d55 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Sat, 9 Jan 2021 06:43:11 -0800 Subject: [PATCH] GCC: Pass --plugin to AR and RANLIB Detect GCC LTO plugin. Pass --plugin to AR and RANLIB to support L

[PATCH 0/2] Sync with binutils for building binutils with LTO:

2021-11-13 Thread H.J. Lu via Gcc-patches
Add the --enable-pgo-build[=lto] configure option. When binutils+gdb is not built together with GCC, --enable-pgo-build enables the PGO build: 1. First build with -fprofile-generate. 2. Use "make maybe-check-*" to generate profiling data and pass -i to make to ignore errors when generating profil

Re: [committed] openmp: Add support for 2 argument num_teams clause

2021-11-13 Thread H.J. Lu via Gcc-patches
On Thu, Nov 11, 2021 at 1:12 AM Jakub Jelinek via Gcc-patches wrote: > > Hi! > > In OpenMP 5.1, num_teams clause can accept either one expression as before, > but it in that case changed meaning, rather than create <= expression > teams it is now create == expression teams. Or it accepts two expr

Cleanup modref_access_node

2021-11-13 Thread Jan Hubicka via Gcc-patches
Hi, this patch moves member functions of modref_access_node from ipa-modref-tree.h to ipa-modref-tree.c since they become long and not fitting for inlines anyway. I also cleaned up the interface by making static insert method (which handles inserting accesses into a vector and optimizing them) whic

committed: [PATCH] fixincludes: simplify handling for access() failure [PR21283, PR80047]

2021-11-13 Thread Xi Ruoyao via Gcc-patches
On Sat, 2021-11-13 at 08:13 -0800, Bruce Korb wrote: > Perfect. Committed at r12-5234 with minor format fix. > On 11/12/21 1:58 PM, Xi Ruoyao wrote: > > diff --git a/fixincludes/fixincl.c b/fixincludes/fixincl.c > > index 6dba2f6e830..ee57fbf61b4 100644 > > --- a/fixincludes/fixincl.c > > +++ b/f

[PATCH] tree-optimization: [PR103218] Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit

2021-11-13 Thread apinski--- via Gcc-patches
From: Andrew Pinski This folds Fold ((type)(a<0)) << SIGNBITOFA into ((type)a) & signbit inside match.pd. This was already handled in fold-cost by: /* A < 0 ? : 0 is simply (A & ). */ I have not removed as we only simplify "a ? POW2 : 0" at the gimple level to "a << CST1" and fold actually do

Re: [PATCH] pch: Add support for PCH for relocatable executables

2021-11-13 Thread Iain Sandoe
Hi Folks, IMO both this series - which restores the ability to work with PIE exes but requires a known address for the PCH and the series I posted - which allows a configuration to opt out of PCH anyway could be useful - for Darwin I prefer this series. of course, it would be very nice to ha

[PATCH 2/6] Add returns_zero_on_success/failure attributes

2021-11-13 Thread David Malcolm via Gcc-patches
This patch adds two new attributes. The followup patch makes use of the attributes in -fanalyzer. gcc/c-family/ChangeLog: * c-attribs.c (attr_noreturn_exclusions): Add "returns_zero_on_failure" and "returns_zero_on_success". (attr_returns_twice_exclusions): Likewise.

[PATCH 1b/6] Add __attribute__((untrusted))

2021-11-13 Thread David Malcolm via Gcc-patches
This patch adds a new: __attribute__((untrusted)) for use by the C front-end, intended for use by the Linux kernel for use with "__user", but which could be used by other operating system kernels, and potentialy by other projects. Known issues: - at least one TODO in handle_untrusted_attribute

[PATCH 4a/6] analyzer: implement region::untrusted_p in terms of custom address spaces

2021-11-13 Thread David Malcolm via Gcc-patches
gcc/analyzer/ChangeLog: (region::untrusted_p): New. gcc/testsuite/ChangeLog: * gcc.dg/analyzer/test-uaccess.h: New header. Signed-off-by: David Malcolm --- gcc/analyzer/region.cc | 13 + gcc/testsuite/gcc.dg/analyzer/test-uaccess.h | 19

[PATCH 0/6] RFC: adding support to GCC for detecting trust boundaries

2021-11-13 Thread David Malcolm via Gcc-patches
[Crossposting between gcc-patches@gcc.gnu.org and linux-toolcha...@vger.kernel.org; sorry about my lack of kernel knowledge, in case of the following seems bogus] I've been trying to turn my prototype from the LPC2021 session on "Adding kernel-specific test coverage to GCC's -fanalyzer option" ( h

[PATCH 4b/6] analyzer: implement region::untrusted_p in terms of __attribute__((untrusted))

2021-11-13 Thread David Malcolm via Gcc-patches
gcc/analyzer/ChangeLog: * region.cc (region::untrusted_p): Implement in terms of __attribute__((untrusted)). gcc/testsuite/ChangeLog: * gcc.dg/analyzer/test-uaccess.h: Change from custom_address_space pragma to __attribute__((untrusted)). Signed-off-by: David Malco

[PATCH 5/6] analyzer: use region::untrusted_p in taint detection

2021-11-13 Thread David Malcolm via Gcc-patches
This patch wires up the "untrusted" region logic to the analyzer's taint detection, so that any data copied via a __user pointer (e.g. via a suitably annotated "copy_from_user" decl) is treated as tainted. It includes a series of reproducers for detecting CVE-2011-0521. Unfortunately the analyzer

[PATCH 1a/6] RFC: Implement "#pragma GCC custom_address_space"

2021-11-13 Thread David Malcolm via Gcc-patches
This work-in-progress patch adds a new: #prgama GCC custom_address_space(NAME_OF_ADDRESS_SPACE) for use by the C front-end. Currently the custom address spaces are: - disjoint from all other address spaces, *including* the generic one - treated the same as the generic address space at the RT

[PATCH 6/6] Add __attribute__ ((tainted))

2021-11-13 Thread David Malcolm via Gcc-patches
This patch adds a new __attribute__ ((tainted)) to the C/C++ frontends. It can be used on function decls: the analyzer will treat as tainted all parameters to the function and all buffers pointed to by parameters to the function. Adding this in one place to the Linux kernel's __SYSCALL_DEFINEx ma

[PATCH 3/6] analyzer: implement infoleak detection

2021-11-13 Thread David Malcolm via Gcc-patches
This patch adds a new -Wanalyzer-exposure-through-uninit-copy, emitted by -fanalyzer if it detects copying of uninitialized data through a pointer to an untrusted region. The patch uses region::untrusted_p in the analyzer and __user in the testsuite to identify untrusted regions, but the implement

Re: [PATCH 0/6] RFC: adding support to GCC for detecting trust boundaries

2021-11-13 Thread Peter Zijlstra
On Sat, Nov 13, 2021 at 03:37:24PM -0500, David Malcolm wrote: > This approach is much less expressive that the custom addres space > approach; it would only cover the trust boundary aspect; it wouldn't > cover any differences between generic pointers and __user, vs __iomem, > __percpu, and __rcu

Fix crash in gamess

2021-11-13 Thread Jan Hubicka via Gcc-patches
Hi, this patch adds debug counters for pure/const discover and fixes somewhat embarrasing pasto I made while breaking out ipa_make_function_* helpers out of propagate_pure_const which led to wrong function being marked as pure that in turn leads to wrong code. My apologizes for that. Bootstrapped/

[PATCH] PR libgomp/103068: Optimize gomp_mutex_lock_slow for x86 target

2021-11-13 Thread Hongyu Wang via Gcc-patches
Hi, >From the CPU's point of view, getting a cache line for writing is more expensive than reading. See Appendix A.2 Spinlock in: https://www.intel.com/content/dam/www/public/us/en/documents/white-papers /xeon-lock-scaling-analysis-paper.pdf The full compare and swap will grab the cache line e

Re: [PATCH 0/6] RFC: adding support to GCC for detecting trust boundaries

2021-11-13 Thread David Malcolm via Gcc-patches
On Sun, 2021-11-14 at 00:20 +0100, Peter Zijlstra wrote: > On Sat, Nov 13, 2021 at 03:37:24PM -0500, David Malcolm wrote: > > > This approach is much less expressive that the custom addres space > > approach; it would only cover the trust boundary aspect; it > > wouldn't > > cover any differences

[r12-5236 Regression] FAIL: gcc.dg/tree-prof/merge_block.c scan-tree-dump-not optimized "Invalid sum" on Linux/x86_64

2021-11-13 Thread sunil.k.pandey via Gcc-patches
On Linux/x86_64, 5aa91072e24c1e16a5ec641b48b64c9c9f199f13 is the first bad commit commit 5aa91072e24c1e16a5ec641b48b64c9c9f199f13 Author: Jan Hubicka Date: Sat Nov 13 22:25:23 2021 +0100 Implement DSE of dead functions calls storing memory. caused FAIL: c-c++-common/tsan/free_race2.c -

Re: [PATCH 1/3] gimple-fold: Transform stp*cpy_chk to str*cpy directly

2021-11-13 Thread Siddhesh Poyarekar
On 11/12/21 22:46, Prathamesh Kulkarni wrote: On Fri, 12 Nov 2021 at 01:12, Siddhesh Poyarekar wrote: Avoid going through another folding cycle and use the ignore flag to directly transform BUILT_IN_STPCPY_CHK to BUILT_IN_STRCPY when set, likewise for BUILT_IN_STPNCPY_CHK to BUILT_IN_STPNCPY.