[patch][middle-end/PR102359]Not add initialization for DECL_VALUE_EXPR variables with -ftrivial-auto-var-init

2021-10-04 Thread Qing Zhao via Gcc-patches
Hi, This is the patch to fix this issue based on our discussion. I have tested it on aarch64 with bootstrap and regtests. X86 bootstrap was done, regtests is ongoing. Okay for trunk? Thanks. Qing == >From d349ef0145512efe7f9af2c6bbd01f636475bce3 Mon Sep 17 00:00:00 2001

Re: [PATCH] c++: templated static local var has value-dep addr [PR98930]

2021-10-04 Thread Jason Merrill via Gcc-patches
On 10/4/21 17:09, Patrick Palka wrote: Here uses_template_parms is returning false for the dependent type A<::i>, which causes tsubst_aggr_type to think it's non-dependent and not bothering substituting into it, leading to breakage. This patch fixes this by making has_value_dependent_address

Re: [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-10-04 Thread Eric Gallager via Gcc-patches
On Mon, Oct 4, 2021 at 2:43 PM Martin Sebor via Gcc-patches wrote: > > While resolving the recent -Waddress enhancement request (PR > PR102103) I came across a 2007 problem report about GCC 4 having > stopped warning for using the address of inline functions in > equality comparisons with null.

Re: [PATCH RFA] vec: Fix --enable-gather-detailed-mem-stats

2021-10-04 Thread Iain Sandoe
> On 4 Oct 2021, at 22:27, Jason Merrill via Gcc-patches > wrote: > > On 10/4/21 14:37, Iain Sandoe wrote: >> Hi Jason, >>> On 4 Oct 2021, at 19:27, Jason Merrill via Gcc-patches >>> wrote: >>> >>> When r12-4038 introduced the global auto_vec save_opt_decoded_options, it >>> broke

Re: [PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-10-04 Thread Jason Merrill via Gcc-patches
On 10/4/21 14:42, Martin Sebor wrote: While resolving the recent -Waddress enhancement request (PR PR102103) I came across a 2007 problem report about GCC 4 having stopped warning for using the address of inline functions in equality comparisons with null.  With inline functions being

Re: [PATCH RFA] vec: Fix --enable-gather-detailed-mem-stats

2021-10-04 Thread Jason Merrill via Gcc-patches
On 10/4/21 14:37, Iain Sandoe wrote: Hi Jason, On 4 Oct 2021, at 19:27, Jason Merrill via Gcc-patches wrote: When r12-4038 introduced the global auto_vec save_opt_decoded_options, it broke compilers configured with --enable-gather-detailed-mem-stats, due to the memory descriptors getting

[PATCH] c++: templated static local var has value-dep addr [PR98930]

2021-10-04 Thread Patrick Palka via Gcc-patches
Here uses_template_parms is returning false for the dependent type A<::i>, which causes tsubst_aggr_type to think it's non-dependent and not bothering substituting into it, leading to breakage. This patch fixes this by making has_value_dependent_address also return true for templated static local

Re: [PATCH][i386] target: support spaces in target attribute.

2021-10-04 Thread Andrew Pinski via Gcc-patches
On Mon, Oct 4, 2021 at 8:11 AM Martin Liška wrote: > > Hello. > > The patch is about supporting target attribute values like "no-avx, sse2 ". > I'm planning doing the same change for aarch64 and other archs as well once > this one is accepted. It might be useful to skip tabs for the same

Re: [PATCH] Remove static marker for range in alloca pass.

2021-10-04 Thread Andrew MacLeod via Gcc-patches
On 10/4/21 4:15 AM, Richard Biener via Gcc-patches wrote: On Mon, Oct 4, 2021 at 8:55 AM Aldy Hernandez via Gcc-patches wrote: The m_ranges[] field in int_range are trees, so they live in GC space. Since invalid_range is static, it must be marked with GTY magic. However, calculating

[PATCH, rs6000 GCC-11 committed] Fix fusion testcase counts

2021-10-04 Thread Pat Haugen via Gcc-patches
Somehow there was an issue when a larger patch was backported, and this chunk did not make it. Tested and committed as obvious. -Pat 2021-10-04 Pat Haugen gcc/testsuite/ChangeLog: * gcc.target/powerpc/fusion-p10-ldcmpi.c: Update counts. diff --git

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-04 Thread Jonathan Wakely via Gcc-patches
On Mon, 4 Oct 2021 at 21:28, François Dumont via Libstdc++ wrote: > > On 04/10/21 10:05 pm, François Dumont wrote: > > On 02/10/21 10:24 pm, Jonathan Wakely wrote: > >> On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: > >>> I would like to propose this alternative approach. > >>> > >>> In this

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-04 Thread François Dumont via Gcc-patches
On 04/10/21 10:05 pm, François Dumont wrote: On 02/10/21 10:24 pm, Jonathan Wakely wrote: On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: I would like to propose this alternative approach. In this patch I make __normal_iterator and random iterator _Safe_iterator compatible for

Re: [committed] libstdc++: Specialize std::pointer_traits<__normal_iterator>

2021-10-04 Thread François Dumont via Gcc-patches
On 02/10/21 10:24 pm, Jonathan Wakely wrote: On Sat, 2 Oct 2021 at 18:27, François Dumont wrote: I would like to propose this alternative approach. In this patch I make __normal_iterator and random iterator _Safe_iterator compatible for pointer_traits primary template. Regarding

[r12-4143 Regression] FAIL: gfortran.dg/predict-2.f90 -O scan-tree-dump-times profile_estimate "Fortran loop preheader heuristics of edge" 2 on Linux/x86_64

2021-10-04 Thread sunil.k.pandey via Gcc-patches
On Linux/x86_64, 55a3be2f5255d69e740d61b2c5aaba1ccbc643b8 is the first bad commit commit 55a3be2f5255d69e740d61b2c5aaba1ccbc643b8 Author: Richard Biener Date: Mon Oct 4 10:57:45 2021 +0200 tree-optimization/102570 - teach VN about internal functions caused FAIL:

[PATCH] restore ancient -Waddress for weak symbols [PR33925]

2021-10-04 Thread Martin Sebor via Gcc-patches
While resolving the recent -Waddress enhancement request (PR PR102103) I came across a 2007 problem report about GCC 4 having stopped warning for using the address of inline functions in equality comparisons with null. With inline functions being commonplace in C++ this seems like an important

Re: [PATCH RFA] vec: Fix --enable-gather-detailed-mem-stats

2021-10-04 Thread Iain Sandoe
Hi Jason, > On 4 Oct 2021, at 19:27, Jason Merrill via Gcc-patches > wrote: > > When r12-4038 introduced the global auto_vec save_opt_decoded_options, it > broke compilers configured with --enable-gather-detailed-mem-stats, due to > the memory descriptors getting discarded before the

[PATCH RFA] vec: Fix --enable-gather-detailed-mem-stats

2021-10-04 Thread Jason Merrill via Gcc-patches
When r12-4038 introduced the global auto_vec save_opt_decoded_options, it broke compilers configured with --enable-gather-detailed-mem-stats, due to the memory descriptors getting discarded before the auto_vec was destroyed. Attached below are two approaches to making this work, either by

Re: [PATCH v3 0/6] rs6000: Support more SSE4 intrinsics

2021-10-04 Thread Paul A. Clarke via Gcc-patches
Ping. On Thu, Sep 16, 2021 at 09:59:39AM -0500, Paul A. Clarke via Gcc-patches wrote: > Ping. > > On Mon, Aug 23, 2021 at 02:03:04PM -0500, Paul A. Clarke via Gcc-patches > wrote: > > v3: Add "nmmintrin.h". _mm_cmpgt_epi64 is part of SSE4.2 > > and users will expect to be able to include

Re: [PATCH] middle-end/102587 - avoid auto-init for VLA vectors

2021-10-04 Thread Qing Zhao via Gcc-patches
> On Oct 4, 2021, at 12:19 PM, Richard Biener wrote: > > On October 4, 2021 7:00:10 PM GMT+02:00, Qing Zhao > wrote: >> I have several questions on this fix: >> >> 1. This fix avoided expanding “.DEFERRED_INIT” when !tree_fits_uhwi_p >> (TYPE_SIZE_UNIT (var_type)). >> As a result, this

Re: [PATCH] middle-end/102587 - avoid auto-init for VLA vectors

2021-10-04 Thread Richard Biener via Gcc-patches
On October 4, 2021 7:00:10 PM GMT+02:00, Qing Zhao wrote: >I have several questions on this fix: > >1. This fix avoided expanding “.DEFERRED_INIT” when !tree_fits_uhwi_p >(TYPE_SIZE_UNIT (var_type)). >As a result, this call to .DEFERRED_INIT will NOT be expanded at all. Yes. >Then not

Re: [PATCH] middle-end/102587 - avoid auto-init for VLA vectors

2021-10-04 Thread Qing Zhao via Gcc-patches
I have several questions on this fix: 1. This fix avoided expanding “.DEFERRED_INIT” when !tree_fits_uhwi_p (TYPE_SIZE_UNIT (var_type)). As a result, this call to .DEFERRED_INIT will NOT be expanded at all. Then not expanding .DEFERRED_INIT in RTL expanding phase will trigger more

Re: [PATCH] libiberty: prevent buffer overflow when decoding user input

2021-10-04 Thread Luís Ferreira
On Thu, 2021-09-23 at 09:50 -0600, Jeff Law wrote: > > > On 9/23/2021 4:16 AM, ibuclaw--- via Gcc-patches wrote: > > > On 22/09/2021 03:10 Luís Ferreira wrote: > > > > > >   > > > Currently a stack/heap overflow may happen if a crafted mangle is > > > maliciously used to cause denial of

Re: [committed] d: gdc driver ignores -static-libstdc++ when automatically linking libstdc++ library

2021-10-04 Thread Iain Sandoe
Hi Iain > On 4 Oct 2021, at 17:00, Iain Buclaw via Gcc-patches > wrote: > > Hi, > > This patch adds handling of `-static-libstc++' to the gdc driver, so > that libstdc++ is appropriately linked if it is either needed or seen on > the command-line. > > This is required for bootstrapping the

[PATCH] c++: odr-use argument to a function NTTP [PR53164]

2021-10-04 Thread Patrick Palka via Gcc-patches
When passing a function template as the argument to a function NTTP inside a template, we resolve it to the right specialization ahead of time via resolve_address_of_overloaded_function, though the call to mark_used within defers odr-using it until instantiation time (as usual). But at

Re: [PATCH 1v2/3][vect] Add main vectorized loop unrolling

2021-10-04 Thread Richard Sandiford via Gcc-patches
Richard Biener via Gcc-patches writes: > On Thu, 30 Sep 2021, Andre Vieira (lists) wrote: > >> Hi, >> >> >> >> That just forces trying the vector modes we've tried before. Though I >> >> might >> >> need to revisit this now I think about it. I'm afraid it might be possible >> >> for >> >> this

Re: [RFC] More jump threading restrictions in the presence of loops.

2021-10-04 Thread Michael Matz via Gcc-patches
Hello, On Mon, 4 Oct 2021, Jeff Law wrote: > And just in case it got lost.  Here's the analysis on 960218-1 on visium: > > We've got this going into ethread: > > int f (int x) > { >   int D.1420; >   int a; > > ;;   basic block 2, loop depth 0, maybe hot > ;;    prev block 0, next block 3,

Re: [PING^2][PATCH] libgcc, emutls: Allow building weak definitions of the emutls functions.

2021-10-04 Thread Richard Sandiford via Gcc-patches
Iain Sandoe writes: > Hi, > > So let’s ignore the questions for now - OK for the non-Darwin parts of the > patch ? Looks OK to me. Thanks, Richard > >> On 24 Sep 2021, at 17:57, Iain Sandoe wrote: >> > >> as noted below the non-Darwin parts of this are trivial (and a no-OP). >> I’d like to

[committed] d: gdc driver ignores -static-libstdc++ when automatically linking libstdc++ library

2021-10-04 Thread Iain Buclaw via Gcc-patches
Hi, This patch adds handling of `-static-libstc++' to the gdc driver, so that libstdc++ is appropriately linked if it is either needed or seen on the command-line. This is required for bootstrapping the self hosted D front-end, so will also be backported to all supported releases. Bootstrapped

[committed] d: Save target node before parsing optimize options in case it changes.

2021-10-04 Thread Iain Buclaw via Gcc-patches
Hi, This patch saves target node information before calling parse_optimize_options in the D "optimize" attribute handler, the same as is done for C/C++ optimize. Fixes an ICE seen on PowerPC targets with the attr_optimize*.d tests in the gdc.dg testsuite. Bootstrapped and regression tested, and

Re: [PATCH 8/8] OpenMP 5.0: [WIP, RFC] Clause ordering for OpenMP 5.0 (topological sorting by base pointer)

2021-10-04 Thread Julian Brown
On Wed, 11 Aug 2021 09:59:35 -0700 Julian Brown wrote: > This patch reimplements the omp_target_reorder_clauses function in > anticipation of supporting "deeper" struct mappings (that is, with > several structure dereference operators, or similar). FWIW, this patch has been superseded by the

Re: [RFC] More jump threading restrictions in the presence of loops.

2021-10-04 Thread Jeff Law via Gcc-patches
On 10/4/2021 7:36 AM, Aldy Hernandez wrote: Note that none of the other tests have been adjusted so it'll likely result in multiple threading regressions. Yea ;-)  So maybe we first focus on how those affect visium since that's what started us down this path. The original test of

[PATCH][i386] target: support spaces in target attribute.

2021-10-04 Thread Martin Liška
Hello. The patch is about supporting target attribute values like "no-avx, sse2 ". I'm planning doing the same change for aarch64 and other archs as well once this one is accepted. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin

Re: [PATCH] libiberty: d-demangle: use switch instead of if-else

2021-10-04 Thread Luís Ferreira
On Sun, 2021-10-03 at 15:55 -0600, Jeff Law wrote: > > > On 9/29/2021 7:08 PM, Luís Ferreira wrote: > > This patch allows the compiler to efficiently generate jump tables > > instead of > > using if-else-if. > > > > Signed-off-by: Luís Ferreira > I'm not sure this is terribly useful. 

[PATCH] tree-optimization/102570 - teach VN about internal functions

2021-10-04 Thread Richard Biener via Gcc-patches
We're now using internal functions for a lot of stuff but there's still missing VN support out of laziness. The following instantiates support and adds testcases for FRE and PRE (hoisting). Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-10-04 Richard Biener PR

Re: [committed] libstdc++: Allow visiting inherited variants [PR 90943]

2021-10-04 Thread Jonathan Wakely via Gcc-patches
On Sun, 3 Oct 2021 at 10:07, Jonathan Wakely wrote: > > > > On Sat, 2 Oct 2021, 13:50 Daniel Krügler via Libstdc++, > wrote: >> >> Am Fr., 1. Okt. 2021 um 21:57 Uhr schrieb Jonathan Wakely via >> Libstdc++ : >> > >> > Implement the changes from P2162R2 (as a DR for C++17). >> > >> >

[committed] libstdc++: Implement P1518R2 for container deduction guides

2021-10-04 Thread Jonathan Wakely via Gcc-patches
This implements the C++23 P1518R2 proposal "Stop overconstraining allocators in container deduction guides" as a fix for C++17 and C++20 too. The changes allow class template argument deduction to ignore the type of a constructor argument that initializes an allocator_type parameter if the type

[committed] libstdc++: Disable std::string{, _view} construction from nullptr (P2166R1)

2021-10-04 Thread Jonathan Wakely via Gcc-patches
Implement this C++23 feature. Because construction from a null pointer is undefined, we can implement it for C++11 and up, turning undefined behaviour into a compilation error. libstdc++-v3/ChangeLog: * include/bits/basic_string.h (basic_string(nullptr_t)): Define as deleted.

Re: [RFC][Patch][middle-end/PR102359]Not add initialization for READONLY variables with -ftrivial-auto-var-init

2021-10-04 Thread Qing Zhao via Gcc-patches
> On Oct 4, 2021, at 1:44 AM, Richard Biener wrote: > > On Fri, 1 Oct 2021, Qing Zhao wrote: > >> >> >>> On Oct 1, 2021, at 10:33 AM, Jason Merrill wrote: >>> >>> On 10/1/21 10:54, Qing Zhao wrote: > On Sep 30, 2021, at 2:31 PM, Jason Merrill wrote: > > On 9/30/21 11:42,

[PATCH] Improve integer bit test on atomic builtin return

2021-10-04 Thread H.J. Lu via Gcc-patches
commit adedd5c173388ae505470df152b9cb3947339566 Author: Jakub Jelinek Date: Tue May 3 13:37:25 2016 +0200 re PR target/49244 (__sync or __atomic builtins will not emit 'lock bts/btr/btc') optimized bit test on atomic builtin return with lock bts/btr/btc. But it works only for unsigned

Re: [RFC] More jump threading restrictions in the presence of loops.

2021-10-04 Thread Aldy Hernandez via Gcc-patches
Note that none of the other tests have been adjusted so it'll likely result in multiple threading regressions. Thanks for looking at this. Aldy On Mon, Oct 4, 2021, 15:31 Jeff Law wrote: > > > On 10/4/2021 3:43 AM, Aldy Hernandez wrote: > > It is frustrating that virtually all the regressions

Re: [RFC] More jump threading restrictions in the presence of loops.

2021-10-04 Thread Jeff Law via Gcc-patches
On 10/4/2021 3:43 AM, Aldy Hernandez wrote: It is frustrating that virtually all the regressions with the hybrid threader for VRP, have not been with the engine itself, but with the independent restrictions we have agreed upon. The following patch is a collection of discussions with Richi,

Re: [PATCH] Improve jump threading dump output.

2021-10-04 Thread Jeff Law via Gcc-patches
On 10/4/2021 6:05 AM, Aldy Hernandez wrote: On Thu, Sep 30, 2021 at 8:26 PM Jeff Law wrote: So I'm really wondering if these were caused by that patch you'd sent me privately for the visium issue. Right now we're regressing in a few places, but it's not bad. visium & bfin are the only

[PATCH] avoid hardreg autoinit

2021-10-04 Thread Richard Biener via Gcc-patches
This avoids initializating "uninitialized" hardregs like SP. Bootstrap / regtest pending on x86_64-unknown-linux-gnu. 2021-10-04 Richard Biener * gimplify.c (is_var_need_auto_init): DECL_HARD_REGISTER variables are not to be initialized. *

Re: [PATCH] debug: Handle x_flag_var_tracking_* in finish_options [PR102585]

2021-10-04 Thread Martin Liška
On 10/4/21 13:45, Jakub Jelinek wrote: On Mon, Oct 04, 2021 at 01:41:36PM +0200, Richard Biener via Gcc-patches wrote: The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly to toplev.c. Patch can bootstrap on x86_64-linux-gnu and survives regression tests.

Re: [PATCH] Improve jump threading dump output.

2021-10-04 Thread Aldy Hernandez via Gcc-patches
On Thu, Sep 30, 2021 at 8:26 PM Jeff Law wrote: > So I'm really wondering if these were caused by that patch you'd sent me > privately for the visium issue. Right now we're regressing in a few > places, but it's not bad. > > visium & bfin are the only embedded targets failing. > > visium fails:

Re: [PATCH] debug: Handle x_flag_var_tracking_* in finish_options [PR102585]

2021-10-04 Thread Jakub Jelinek via Gcc-patches
On Mon, Oct 04, 2021 at 01:41:36PM +0200, Richard Biener via Gcc-patches wrote: > > The patch sets -1 for x_flag_var_tracking and > > x_flag_var_tracking_assignments similarly > > to toplev.c. > > > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Shouldn't all those

[PATCH] middle-end/102285 - refine .DEFERRED_INIT expansion

2021-10-04 Thread Richard Biener via Gcc-patches
This refines the way we figure whether we are facing a register that cannot be initialized by emitting a memset away from inspecting expanded RTL of the LHS to using the predicates expand_assignment is using to detect decls or MEM_REFs with non-memory DECL_RTL. Bootstrapped and tested on

Re: [PATCH] debug: Handle x_flag_var_tracking_* in finish_options [PR102585]

2021-10-04 Thread Richard Biener via Gcc-patches
On Mon, Oct 4, 2021 at 12:31 PM Martin Liška wrote: > > Hello. > > The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments > similarly > to toplev.c. > > Patch can bootstrap on x86_64-linux-gnu and survives regression tests. > > Ready to be installed? > Thanks, > Martin > >

Re: [PATCH] gcov: make profile merging smarter

2021-10-04 Thread Martin Liška
On 10/4/21 13:16, Richard Biener wrote: I meant in merge_one_data do not check ->stamp or ->checksum but instead rely on the counter merging code to detect mismatches (there's read_mismatch and read_error). There's multiple things we can do when we run into those: - when we did not actually

Re: [PATCH 3/N] Come up with casm global state.

2021-10-04 Thread Martin Liška
On 9/16/21 15:12, Martin Liška wrote: This patch comes up with asm_out_state and a new global variable casm. Tested on all cross compilers. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin As explained in the '3/N' part, we will

Re: [PATCH] gcov: make profile merging smarter

2021-10-04 Thread Richard Biener via Gcc-patches
On Fri, Oct 1, 2021 at 12:53 PM Martin Liška wrote: > > On 10/1/21 12:17, Richard Biener wrote: > > On Fri, Oct 1, 2021 at 11:55 AM Martin Liška wrote: > >> > >> Support merging of profiles that are built from a different .o files > >> but belong to the same source file. Moreover, a checksum is

Re: [PATCH 3/N] Come up with casm global state.

2021-10-04 Thread Martin Liška
On 9/22/21 11:59, Richard Biener wrote: On Thu, Sep 16, 2021 at 3:12 PM Martin Liška wrote: This patch comes up with asm_out_state and a new global variable casm. Tested on all cross compilers. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed?

[PATCH] debug: Handle x_flag_var_tracking_* in finish_options [PR102585]

2021-10-04 Thread Martin Liška
Hello. The patch sets -1 for x_flag_var_tracking and x_flag_var_tracking_assignments similarly to toplev.c. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin PR debug/102585 gcc/ChangeLog: * opts.c (finish_options):

[RFC] More jump threading restrictions in the presence of loops.

2021-10-04 Thread Aldy Hernandez via Gcc-patches
It is frustrating that virtually all the regressions with the hybrid threader for VRP, have not been with the engine itself, but with the independent restrictions we have agreed upon. The following patch is a collection of discussions with Richi, Jeff, and Michael Matz regarding jump threading

[PATCH] var-tracking: Fix a wrong-debug issue caused by my r10-7665 var-tracking change [PR102441]

2021-10-04 Thread Jakub Jelinek via Gcc-patches
Hi! Since my r10-7665-g33c45e51b4914008064d9b77f2c1fc0eea1ad060 change, we get wrong-debug on e.g. the following testcase at -O2 -g on x86_64-linux for the x parameter: void bar (int *r); int foo (int x) { int r = 0; bar (); return r; } At the start of function, we have subq$24,

RE: [PATCH][GCC] arm: Add Cortex-R52+ multilib

2021-10-04 Thread Przemyslaw Wirkus via Gcc-patches
> > On Thu, Sep 30, 2021, 3:37 PM Przemyslaw Wirkus > > wrote: > > Subject: Re: [PATCH][GCC] arm: Add Cortex-R52+ multilib > > > > I think the RTEMS multilibs are based on the products that RTEMS supports, > > so this is really the RTEMS maintainers' call. > >

[PATCH] middle-end/102587 - avoid auto-init for VLA vectors

2021-10-04 Thread Richard Biener via Gcc-patches
This avoids ICEing for VLA vector auto-init by not initializing. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-10-04 Richard Biener PR middle-end/102587 * internal-fn.c (expand_DEFERRED_INIT): Guard register initialization path an avoid

[Ada] Incremental patch for restriction No_Dynamic_Accessibility_Checks

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch corrects various issues discovered during testing of the No_Dynamic_Accessibility_Checks restriction and documents the feature in the GNAT RM. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/standard_and_implementation_defined_restrictions.rst:

[Ada] Document the current behaviour of -gnateA switch

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
The runtime checks for overlaping actual parameters, which gets enabled by the -gnateA switch, were introduced to combine proof and test for the antialiasing rules of SPARK. The original implementation of these checks contained few mistakes which resulted in spurious compilation errors. These are

[Ada] Handle properly user_defined literals given by operators.

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch expands the implementation of aspects Integer_Literal, Real_Literal and String_Literal, so that the value of the aspect, which must be a function name, can be specified by an Operator_Symbol. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb

[Ada] Fix indentation in generated AST construction functions

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
In the generated nmake.adb file the "return" keyword in function declarations was printed at the start of a line. Now it is correctly indented, which makes the generated code easier to read. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gen_il-gen.adb (Put_Make_Spec):

[Ada] Implement CUDA_Device

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This commit removes entities marked with the CUDA_Device pragma from the packages specs and bodies they exist in. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gnat_cuda.adb (Remove_CUDA_Device_Entities): New function. (Expand_CUDA_Package): Call

[Ada] Completion of support for AI12-0409 (attribute Preelaborable_Initialization)

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This set of changes implements proper checking of types completing private types in a generic unit where the full type has components of formal types of the generic and the private type has a Preelaborable_Initialization aspect given by a conjunction of one or more references to

[Ada] Mark Ada.Text_IO in SPARK

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Now that access-to-constant types are supported in SPARK, type File_Access is accepted and the public interface of Ada.Text_IO can be marked in SPARK. Fix a missing save/restore for the global variable storing whether SPARK_Mode should be ignored inside instances, around the analysis of a new

[Ada] Minor comment fix in System.Regpat

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
If Data_First is set to the special value of -1 (the default), then we cannot look at Data (Data_First). Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-regpat.ads: Change Data_First to Data'First. Change "still" to "always". Similar changes for

[Ada] Refactor duplicate code for pretty-printing GNAT AST

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Remove duplicated CASE branches detected by infer; semantics is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sprint.adb (Sprint_Node_Actual): Refactor code for generic package and subprogram declarations.diff --git a/gcc/ada/sprint.adb

[Ada] Remove repeated calls to Prefix in resolution of array accesses

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Code cleanup related to recent fixes for resolution of array slices; behaviour is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_res.adb (Resolve_Indexed_Component, Resolve_Slice): Rename the local constant Name to Pref; remove repeated calls to

[Ada] Emit specific SCOs for decisions of quantified expressions

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Coverage analysis on quantified expressions now requires always processing their predicate expression as a decision. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * scos.ads: Extend the documentation. * par_sco.adb (Process_Decisions): Emit specific SCOs for

[Ada] Fix comment about expansion of slices

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Cleanup related to handling of array accesses in CodePeer mode. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb (Selected_Range_Checks): Fix style. * exp_ch4.adb (Expand_N_Slice): Fix style and comment. * sem_res.adb (Resolve_Indexed_Component):

[Ada] Add Ada RM description of Ada.Strings.Bounded as comments in the spec

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
To facilitate using the standard library, Ada RM description from section A.4.4 is added to the code as comments. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-strbou.ads: Add comments.diff --git a/gcc/ada/libgnat/a-strbou.ads b/gcc/ada/libgnat/a-strbou.ads ---

[Ada] Fix for a static Leading_Part attribute raising constraint error

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Attribute Leading_Part, when its second parameter is zero or negative, is now raising a constraint error when evaluated at compilation time just like it did when evaluated at run time. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Eval_Attribute): Evaluation

[Ada] Fix resolution of Declare_Expressions involving transient scopes

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch modifies the resolution of Declare_Expressions to avoid the use of a fake scope to perform name capture in the expression, because such a scope (needed to analyze the declarations of the construct) conflicts with the transient scopes that may be generated by the presence of calls in the

[Ada] Declaration_Node for Itypes returns Empty or declaration

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch changes Declaration_Node for Itypes so that it either returns Empty or returns a proper declaration node. If the tree structure is that of a normal type or subtype declaration, so the parent of the Itype is that declaration, then we return the declaration. Otherwise, we return Empty

[Ada] Fix handling of slices with subtype names

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
When resolving a slice with subtype name we created a shallow copy of the type range and applied range checks to this copy. This was wrong, because when applying checks we were modifying the type declaration itself (and the type could be anything, for example the predefined Integer type). Instead

[Ada] Fix missing check on slice with a subtype indication

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
A slice range can be specified either by a subtype name, regular range, or subtype indication with constraints. The compiler missed the last case. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_res.adb (Resolve_Slice): Handle range given as a subtype

[Ada] Fix handling of 'Image acting as a prefix of a slice in CodePeer

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
In CodePeer mode attribute Image is not expanded and has its Etype set as the unconstrained String type. When this attribute appears as a prefix of an indexed component, we get a check; when it appears as a prefix of a slice, we don't get a check. For indexed components, the check effectively

[Ada] Spurious non-variable error on implicitly dereferenced in-mode formal

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch corrects an issue in the compiler whereby taking 'Access of a protected subprogram based on an implicitly dereferenced protected object causes a spurious non-variable error when such an object is an in-mode access type formal. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Adjust documentation of -fdump-ada-spec in GNAT UG

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This explicitly documents the behavior for /include/-ending paths and also updates other parts of the description. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_ugn/the_gnat_compilation_model.rst (Binding generation): Document specific behavior for

[Ada] PR ada/102073

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Add missing return statements in socket.c as flagged by cppcheck. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ PR ada/102073 * socket.c (__gnat_gethostbyaddr, __gnat_inet_pton): Add missing return statements.diff --git a/gcc/ada/socket.c b/gcc/ada/socket.c

[Ada] Crash on allocator in alternative accessibility modes

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch corrects an issue in the compiler whereby the level for allocated objects of anonymous access types was calculated incorrectly. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Function_Or_Allocator_Level): Properly handle direct function

[Ada] Spurious accessibility error on renamed expression

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This patch corrects an issue in the compiler whereby a renaming of a subprogram (as opposed to an object) may cause accessibility levels to be incorrectly calculated on such renamings -- leading to spurious accessibility errors at run time. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] VxWorks inconsistent use of return type Fixup

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Fix STATUS and int return types for Vxworks6 in legacy. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnarl/s-osinte__vxworks.ads (tlsKeyCreate): Return int. * libgnarl/s-tpopsp__vxworks-rtp.adb (ERROR): Declare from System.VxWorks.Ext.ERROR.

[Ada] Emit debugging information for TSD object

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
This makes the compiler emit debugging information for the Type-Specific Data object generated for tagged types, so as to make sure that debugging information is emitted for its type in ell circumstances. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_disp.adb

[Ada] Fix compiler internal error

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
In some cases with -gnat2022 enabled, an enabled postcondition containing a quantified expression containing an Old attribute reference could result in an internal error during compilation. Fix this. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb

[Ada] Improve checking for invalid index values when accessing array elements

2021-10-04 Thread Pierre-Marie de Rodat via Gcc-patches
Two improvements to the previous change on this topic: 1) Add a guard to prevent a call to Number_Of_Dimensions that would pass in a non-array type. This is needed in error cases (see ACATS test B95094C). 2) Do not generate the new validity checks in the case where the index type in

Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed

2021-10-04 Thread Andreas Schwab
On Sep 29 2021, Luís Ferreira wrote: > diff --git a/libiberty/d-demangle.c b/libiberty/d-demangle.c > index 3adf7b562d1..a05e72d8efe 100644 > --- a/libiberty/d-demangle.c > +++ b/libiberty/d-demangle.c > @@ -253,15 +253,15 @@ dlang_hexdigit (const char *mangled, char *ret) > >c =

Re: [PATCH] Remove static marker for range in alloca pass.

2021-10-04 Thread Richard Biener via Gcc-patches
On Mon, Oct 4, 2021 at 8:55 AM Aldy Hernandez via Gcc-patches wrote: > > The m_ranges[] field in int_range are trees, so they live in GC > space. Since invalid_range is static, it must be marked with GTY > magic. However, calculating invalid_range is not particularly slow, > or on a critical

Re: [PATCH] libiberty: d-demangle: remove parenthesis where it is not needed

2021-10-04 Thread ibuclaw--- via Gcc-patches
> On 29/09/2021 18:26 Luís Ferreira wrote: > > > Those parenthesis doesn't increase readability at all and this patch makes the > source code a bit more consistent with the rest of the dereferencing > assignments. > OK, but can you write up a changelog entry for it? Thanks, Iain.

Re: [PATCH] libiberty: d-demangle: rename function symbols to be more consistent

2021-10-04 Thread Iain Buclaw via Gcc-patches
> On 30/09/2021 02:48 Luís Ferreira wrote: > > > There is some function names with `dlang_parse_` prefix and some with only > `dlang_` prefix that does parsing. The same happens with `dlang_decode_`. > > To make things a bit more consistent and easier to understand, this patch adds > the

Re: [PATCH] libiberty: d-demangle: use switch instead of if-else

2021-10-04 Thread ibuclaw--- via Gcc-patches
> On 03/10/2021 23:55 Jeff Law via Gcc-patches wrote: > > > On 9/29/2021 7:08 PM, Luís Ferreira wrote: > > This patch allows the compiler to efficiently generate jump tables instead > > of > > using if-else-if. > > > > Signed-off-by: Luís Ferreira > I'm not sure this is terribly useful. 

Remove dead code in config/rs6000/vxworks.h

2021-10-04 Thread Eric Botcazou via Gcc-patches
These lines were added last year: /* Initialize library function table. */ #undef TARGET_INIT_LIBFUNCS #define TARGET_INIT_LIBFUNCS rs6000_vxworks_init_libfuncs but TARGET_INIT_LIBFUNCS is #undef-ed in config/rs6000/rs6000.c and rs6000_vxworks_init_libfuncs is nowhere defined in any case.

[PATCH] Remove static marker for range in alloca pass.

2021-10-04 Thread Aldy Hernandez via Gcc-patches
The m_ranges[] field in int_range are trees, so they live in GC space. Since invalid_range is static, it must be marked with GTY magic. However, calculating invalid_range is not particularly slow, or on a critical path, so we can just put it in local scope and recalculate every time. Tested on

Re: [RFC][Patch][middle-end/PR102359]Not add initialization for READONLY variables with -ftrivial-auto-var-init

2021-10-04 Thread Richard Biener via Gcc-patches
On Fri, 1 Oct 2021, Qing Zhao wrote: > > > > On Oct 1, 2021, at 10:33 AM, Jason Merrill wrote: > > > > On 10/1/21 10:54, Qing Zhao wrote: > >>> On Sep 30, 2021, at 2:31 PM, Jason Merrill wrote: > >>> > >>> On 9/30/21 11:42, Qing Zhao wrote: > > On Sep 30, 2021, at 1:54 AM, Richard