Re: [PATCH v2, rs6000] Fix ICE on expand bcd__ [PR100736]

2022-06-01 Thread HAO CHEN GUI via Gcc-patches
Segher, Does BCD comparison return false when either operand is invalid coding? If yes, the result could be 3-way. We can check gt and eq bits for ge. We still can't use crnot to only check lt bit as there could be invalid coding. Also, do you think finite-math-only excludes invalid coding?

Re: [PATCH] libgccjit: Fix bug where unary_op will return an integer type instead of the correct type

2022-06-01 Thread Antoni Boucher via Gcc-patches
Also, the test gcc/testsuite/jit.dg/test-asm.cc fails and would need this line: #include Is this okay if I add it in this patch? On Wed, 2022-06-01 at 22:13 -0400, Antoni Boucher wrote: > Hi. > The attached patch fix bug 105812: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105812 > > I'm

[PATCH] libgccjit: Fix bug where unary_op will return an integer type instead of the correct type

2022-06-01 Thread Antoni Boucher via Gcc-patches
Hi. The attached patch fix bug 105812: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105812 I'm having an issue where contrib/check_GNU_style.sh doesn't seem to work, i.e. it doesn't seem to do any checking. Is there a new way to do that or am I missing something? Thanks for the review. From

Re: [PATCH] [PR/target 105666] RISC-V: Inhibit FP <--> int register moves via tune param

2022-06-01 Thread Kito Cheng via Gcc-patches
I just hesitated for a few days about backporting this, but I think it's OK to back port because 1. Simple enough 2. Good for general RISC-V core Committed with your latest testsuite fix. Thanks! On Wed, May 25, 2022 at 3:38 AM Vineet Gupta wrote: > > > > On 5/24/22 00:59, Kito Cheng wrote:

[PATCH] Simplify (B * v + C) * D -> BD* v + CD when B, C, D are all INTEGER_CST.

2022-06-01 Thread liuhongt via Gcc-patches
Similar for (v + B) * C + D -> C * v + BCD. Don't simplify it when there's overflow and overflow is UB for type v. There's new failure gcc.dg/vect/slp-11a.c scan-tree-dump-times vect "vectorizing stmts using SLP" 0 It's because the patch simplify different operations to mult + add and enables

[PATCH] c++: ICE with template NEW_EXPR [PR105803]

2022-06-01 Thread Marek Polacek via Gcc-patches
Here we ICE because value_dependent_expression_p gets a NEW_EXPR whose operand is a type, and we go to the default case which just calls v_d_e_p on each operand of the NEW_EXPR. Since one of them is a type, we crash on the new assert in t_d_e_p. t_d_e_p has code to handle {,VEC_}NEW_EXPR, which

Re: [PATCH v2, rs6000] Fix ICE on expand bcd__ [PR100736]

2022-06-01 Thread Segher Boessenkool
Hi! On Tue, May 31, 2022 at 06:56:00PM -0500, Segher Boessenkool wrote: > It's not clear to me how this can ever happen without finite_math_only? > The patch is safe, sure, but it may the real problem is elsewhere. So, it is incorrect the RTL for our bcd{add,sub} insns uses CCFP at all. CCFP

Re: [PATCH] Support multilib-aware target lib flags self-specs overriding

2022-06-01 Thread Hans-Peter Nilsson
On Fri, 20 May 2022, Alexandre Oliva via Gcc-patches wrote: > > This patch introduces -multiflags, short for multilib TFLAGS, as an > option that does nothing by default, but that can be added to TFLAGS > and mapped to useful options by driver self-specs. > > I realize -m is reserved for

Re: [PATCH] Place jump tables in RELRO only when targets require local relocation to be placed in a read-write section

2022-06-01 Thread Jeff Law via Gcc-patches
On 1/12/2022 12:20 AM, HAO CHEN GUI via Gcc-patches wrote: Hi, This patch sets "relocatable" of jump table to true when targets require local relocation to be placed in a read-write section - bit 0 is set in reloc_rw_mask. Jump tables are in local relocation, so they should be placed in

Re: [PATCH] configure: use OBJDUMP determined by libtool [PR95648]

2022-06-01 Thread Jeff Law via Gcc-patches
On 3/15/2022 2:59 AM, David Seifert via Gcc-patches wrote: $ac_cv_prog_OBJDUMP contains the --host OBJDUMP that libtool has inferred. Current config/gcc-plugin.m4 does not respect the user's choice for OBJDUMP. config/ * gcc-plugin.m4: Use libtool's $ac_cv_prog_OBJDUMP. gcc/

Re: [PATCH] PR middle-end/95126: Expand small const structs as immediate constants.

2022-06-01 Thread Jeff Law via Gcc-patches
On 2/26/2022 2:35 PM, Roger Sayle wrote: This patch resolves PR middle-end/95126 which is a code quality regression, by teaching the RTL expander to emit small const structs/unions as integer immediate constants. The motivating example from the bugzilla PR is: struct small{ short a,b;

Re: [PATCH] libgcc: Align __EH_FRAME_BEGIN__ to pointer size

2022-06-01 Thread Jeff Law via Gcc-patches
On 1/18/2022 10:09 AM, H.J. Lu via Gcc-patches wrote: Aligne __EH_FRAME_BEGIN__ to pointer size since gcc/unwind-dw2-fde.h has /* The first few fields of a CIE. The CIE_id field is 0 for a CIE, to distinguish it from a valid FDE. FDEs are aligned to an addressing unit boundary, but

Re: [PATCH v4] DSE: Use the constant store source if possible

2022-06-01 Thread H.J. Lu via Gcc-patches
On Wed, Jun 1, 2022 at 12:20 AM Richard Sandiford wrote: > > "H.J. Lu" writes: > > On Mon, May 30, 2022 at 09:35:43AM +0100, Richard Sandiford wrote: > >> "H.J. Lu" writes: > >> > --- > >> > RTL DSE tracks redundant constant stores within a basic block. When RTL > >> > loop invariant motion

Re: [PATCH v3, rs6000] Implemented f[min/max]_optab by xs[min/max]dp [PR103605]

2022-06-01 Thread Segher Boessenkool
Hi! Some more nitpicking... On Wed, May 18, 2022 at 04:52:26PM +0800, HAO CHEN GUI wrote: >const double __builtin_vsx_xsmaxdp (double, double); > -XSMAXDP smaxdf3 {} > +XSMAXDP fmaxdf3 {} > >const double __builtin_vsx_xsmindp (double, double); > -XSMINDP smindf3 {} > +

Re: [PATCH] [PR105665] ivopts: check defs of names in base for undefs

2022-06-01 Thread Alexandre Oliva via Gcc-patches
On Jun 1, 2022, Richard Biener wrote: > On Tue, May 31, 2022 at 3:27 PM Alexandre Oliva wrote: >int i; >if (flag) > i = init; >i++; > still would (the propagation stops at i++). Uh, are you sure? That doesn't sound right. I meant for the propagation to affect the

[pushed] c++: auto and dependent member name [PR105734]

2022-06-01 Thread Jason Merrill via Gcc-patches
In r12-3643 I improved our handling of type names after . or -> when unqualified lookup doesn't find anything, but it needs to handle auto specially. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/105734 gcc/cp/ChangeLog: * parser.cc

[pushed] c++: auto function as function argument [PR105779]

2022-06-01 Thread Jason Merrill via Gcc-patches
This testcase demonstrates that the issue in PR105623 is not limited to templates, so we should do the marking in a less template-specific place. Tested x86_64-pc-linux-gnu, applying to trunk. PR c++/105779 gcc/cp/ChangeLog: * call.cc (resolve_args): Call mark_single_function

[PATCH 6/6] OpenMP: Fortran "!$omp declare mapper" support

2022-06-01 Thread Julian Brown
This patch implements "omp declare mapper" functionality for Fortran, following the equivalent support for C and C++. Fortran differs quite substantially from C and C++ in that "map" clauses are naturally represented in the gfortran front-end's own representation rather than as trees. Those are

[PATCH 5/6] OpenMP: Pointers and member mappings

2022-06-01 Thread Julian Brown
Implementing the "omp declare mapper" functionality, I noticed some cases where handling of derived type members that are pointers doesn't seem to be quite right. At present, a type such as this: type T integer, pointer, dimension(:) :: arrptr end type T type(T) :: tvar [...] !$omp

[PATCH 4/6] OpenMP: Tweak NOP handling in in omp_get_root_term and accumulate_sibling_list

2022-06-01 Thread Julian Brown
This patch strips NOPs in omp_get_root_term and accumulate_sibling_list to cover cases that came up writing tests for "omp declare mapper" functionality. I'll fold this into the originating patch series for those functions during rework. 2022-06-01 Julian Brown gcc/ * gimplify.cc

[PATCH 3/6] OpenMP: Rename strip_components_and_deref to omp_get_root_term

2022-06-01 Thread Julian Brown
This patch renames the strip_components_and_deref function to better describe what it does. I'll fold this into the originating patch series during rework. 2022-06-01 Julian Brown gcc/ * gimplify.cc (strip_components_and_deref): Rename to... (omp_get_root_term): This. ---

[PATCH 2/6] OpenMP: Templatize omp_mapper_list

2022-06-01 Thread Julian Brown
This patch parameterizes the omp_mapper_list class to allow it to use different representations for the types of mappers -- e.g., to allow Fortran to gather mappers by "gfc_typespec *" instead of tree type (in a later patch in the series). There should be no behavioural changes introduced by this

[PATCH 1/6] Fortran: Typo/unicode-o fixes

2022-06-01 Thread Julian Brown
This patch fixes a minor typo in dump output and a stray unicode character in a comment. This one probably counts as obvious. 2022-06-01 Julian Brown gcc/fortran/ * dump-parse-tree.cc (show_attr): Fix OMP-UDR-ARTIFICIAL-VAR typo. * trans-openmp.cc

[PATCH 0/6] OpenMP 5.0: Fortran "declare mapper" support

2022-06-01 Thread Julian Brown
This patch series implements "declare mapper" support for Fortran, following on from the C and C++ support for same in the currently in-review series posted here: https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591973.html Further commentary on individual patches. Tested with offloading

[PATCH] c++: value-dep but not type-dep decltype operand [PR105756]

2022-06-01 Thread Patrick Palka via Gcc-patches
r12-7564-gec0f53a3a542e7 made us instantiate non-constant non-dependent decltype operands by relaxing instantiate_non_dependent_expr to check instantiation_dependent_uneval_expression_p. But as the testcase below demonstrates, this predicate is too permissive here because it allows

Re: [PATCH] c++: find_template_parameters and PARM_DECLs [PR105797]

2022-06-01 Thread Patrick Palka via Gcc-patches
On Wed, 1 Jun 2022, Patrick Palka wrote: > As explained in r11-4959-gde6f64f9556ae3, the atom cache assumes two > equivalent expressions (according to cp_tree_equal) must use the same > template parameters (according to find_template_parameters). This > assumption turned out to not hold for

[PATCH] c++: find_template_parameters and PARM_DECLs [PR105797]

2022-06-01 Thread Patrick Palka via Gcc-patches
As explained in r11-4959-gde6f64f9556ae3, the atom cache assumes two equivalent expressions (according to cp_tree_equal) must use the same template parameters (according to find_template_parameters). This assumption turned out to not hold for TARGET_EXPR, which was addressed by that commit. But

Re: [PATCH] Update {skylake,icelake,alderlake}_cost to add a bit preference to vector store.

2022-06-01 Thread H.J. Lu via Gcc-patches
On Tue, May 31, 2022 at 10:06 PM Cui,Lili wrote: > > This patch is to update {skylake,icelake,alderlake}_cost to add a bit > preference to vector store. > Since the interger vector construction cost has changed, we need to adjust > the load and store costs for intel processers. > > With the

[RFC PATCH] RISC-V: Add Zawrs ISA extension support

2022-06-01 Thread Christoph Muellner via Gcc-patches
This patch adds support for the Zawrs ISA extension. The patch depends on the corresponding Binutils patch to be usable (see [1]) The specification can be found here: https://github.com/riscv/riscv-zawrs/blob/main/zawrs.adoc Note, that the Zawrs extension is not frozen or ratified yet. Therefore

c++: Static init guard generation

2022-06-01 Thread Nathan Sidwell
The guard generation for a static var init was overly verbose. We can use a bit of RAII and avoid some rechecking. Also in the !cxa_atexit case, the only difference is whether can become whether to use post-inc or pre-dec. nathan -- Nathan SidwellFrom 289f860fe62423a66e43989688e1d24bcdb25b5e

Re: [PATCH] gengtype: do not skip char after escape sequnce

2022-06-01 Thread Jeff Law via Gcc-patches
On 5/4/2022 1:14 PM, Martin Liška wrote: Right now, when a \$x escape sequence occures, the next character after $x is skipped, which is bogus. The code has very low coverage right now. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks,

Re: [PATCH] PR rtl-optimization/7061: Complex number arguments on x86_64-like ABIs.

2022-06-01 Thread Jeff Law via Gcc-patches
On 5/30/2022 4:06 AM, Roger Sayle wrote: This patch addresses the issue in comment #6 of PR rtl-optimization/7061 (a four digit PR number) from 2006 where on x86_64 complex number arguments are unconditionally spilled to the stack. For the test cases below: float re(float _Complex a) {

Re: [PATCH] Fold truncations of left shifts in match.pd

2022-06-01 Thread Jeff Law via Gcc-patches
On 5/30/2022 6:23 AM, Roger Sayle wrote: Whilst investigating PR 55278, I noticed that the tree-ssa optimizers aren't eliminating the promotions of shifts to "int" as inserted by the c-family front-ends, instead leaving this simplification to be left to the RTL optimizers. This patch allows

c++: Cleanup static init generation

2022-06-01 Thread Nathan Sidwell
The static init/fini generation is showing some bitrot. This cleans up several places to use C++, and also take advantage of already having checked a variable for non-nullness. nathan -- Nathan SidwellFrom c4d702fb3c1e2f6e1bc8711da81bff59543b1b19 Mon Sep 17 00:00:00 2001 From: Nathan Sidwell

c++: Make static init generation more consistent

2022-06-01 Thread Nathan Sidwell
The end-of-compilation static init code generation functions are: * Inconsistent in argument ordering (swapping 'is-init' and 'priority', wrt each other and other arguments). * Inconsistent in naming. mostly calling the is-init argument 'initp', but sometimes calling it 'constructor_p' and

Re: [PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]

2022-06-01 Thread Jeff Law via Gcc-patches
On 6/1/2022 7:55 AM, Jakub Jelinek via Gcc-patches wrote: Hi! A comparison with a constant is most likely always faster than .MUL_OVERFLOW from which we only check whether it overflowed and not the multiplication result, and even if not, it is simpler operation on GIMPLE and even if a target

[PATCH] match.pd: Optimize __builtin_mul_overflow_p (x, cst, (utype)0) to x > ~(utype)0 / cst [PR30314]

2022-06-01 Thread Jakub Jelinek via Gcc-patches
Hi! A comparison with a constant is most likely always faster than .MUL_OVERFLOW from which we only check whether it overflowed and not the multiplication result, and even if not, it is simpler operation on GIMPLE and even if a target exists where such multiplications with overflow checking are

[PATCH] tree-optimization/105786 - avoid strlen replacement for pointers

2022-06-01 Thread Richard Biener via Gcc-patches
This avoids matching strlen to a pointer result, avoiding ICEing because of an integer adjustment using PLUS_EXPR on pointers. Boostrapped and tested on x86_64-unknown-linux-gnu, pushed. 2022-06-01 Richard Biener PR tree-optimization/105786 * tree-loop-distribution.cc

Re: [PATCH 0/12] arm: Enables return address verification and branch target identification on Cortex-M

2022-06-01 Thread Andrea Corallo via Gcc-patches
Andrea Corallo via Gcc-patches writes: > Hi all, > > this series enables return address verification and branch target > identification based on Armv8.1-M Pointer Authentication and Branch > Target Identification Extension [1] for Arm Cortex-M. > > This feature is controlled by the newly

[PATCH 8/12 V2] arm: Introduce multilibs for PACBTI target feature

2022-06-01 Thread Andrea Corallo via Gcc-patches
Hi all, second iteration of the previous patch adding the following new multilibs: thumb/v8.1-m.main+pacbti/mbranch-protection/nofp thumb/v8.1-m.main+pacbti+dp/mbranch-protection/soft thumb/v8.1-m.main+pacbti+dp/mbranch-protection/hard thumb/v8.1-m.main+pacbti+fp/mbranch-protection/soft

Re: [PATCH v3] RISC-V/testsuite: constraint some of tests to hard_float

2022-06-01 Thread Maciej W. Rozycki
On Thu, 26 May 2022, Vineet Gupta wrote: > Commit 9ddd44b58649d1d ("RISC-V: Provide `fmin'/`fmax' RTL pattern") added > tests which check for hard float instructions which obviously fails on > soft-float ABI builds. Sorry to miss it and thank you for the fix! Maciej

RE: [ping][vect-patterns] Refactor widen_plus/widen_minus as internal_fns

2022-06-01 Thread Richard Biener via Gcc-patches
On Tue, 31 May 2022, Joel Hutton wrote: > > Can you post an updated patch (after the .cc renaming, and code_helper > > now already moved to tree.h). > > > > Thanks, > > Richard. > > Patches attached. They already incorporated the .cc rename, now rebased to be > after the change to tree.h @@

Re: [PATCH] [PR105665] ivopts: check defs of names in base for undefs

2022-06-01 Thread Richard Biener via Gcc-patches
On Tue, May 31, 2022 at 3:27 PM Alexandre Oliva wrote: > > On May 30, 2022, Richard Biener wrote: > > > I don't think you can rely on TREE_VISITED not set at the start of the > > pass (and you don't clear it either). > > I don't clear it, but I loop over all SSA names and set TREE_VISITED to >

[PATCH] tree-optimization/101668 - relax SLP of existing vectors

2022-06-01 Thread Richard Biener via Gcc-patches
This relaxes the conditions on SLPing extracts from existing vectors leveraging the relaxed VEC_PERM conditions on the input vs output vector type compatibility. It also handles lowpart extracts and concats without VEC_PERMs now. Bootstrap and regtest running on x86_64-unknown-linux-gnu.

Re: [PATCH 4/5] Revamp irange_allocator to handle vranges.

2022-06-01 Thread Aldy Hernandez via Gcc-patches
Final patch committed. Re-tested on x86-64 Linux. On Mon, May 30, 2022 at 3:28 PM Aldy Hernandez wrote: > > This patch revamps the range allocator to handle generic vrange's. > I've cleaned it up somehow to make it obvious the various things you > can allocate with it. I've also moved away

Re: [PATCH 3/5] Convert range-op.* to vrange.

2022-06-01 Thread Aldy Hernandez via Gcc-patches
Final patch committed. Re-tested on x86-64 Linux. On Mon, May 30, 2022 at 3:28 PM Aldy Hernandez wrote: > > This patch provides the infrastructure to make range-ops type agnostic. > > First, the range_op_handler function has been replaced with an object > of the same name. It's coded in such a

Re: [PATCH 2/5] Implement generic range temporaries.

2022-06-01 Thread Aldy Hernandez via Gcc-patches
Final patch committed. tmp_range has been renamed to Value_Range. Value_Range::init() has been renamed to set_type() which is more obvious. Default constructor for Value_Range now points the vrange to the unsupported_range object, so we always have an object available. Re-tested on x86-64

Re: [PATCH 1/5] Implement abstract vrange class.

2022-06-01 Thread Aldy Hernandez via Gcc-patches
Final patch committed. Includes support for class unsupported_range. Re-tested on x86-64 Linux. On Mon, May 30, 2022 at 3:28 PM Aldy Hernandez wrote: > > This is a series of patches making ranger type agnostic in preparation > for contributing support for other types of ranges (pointers and >

Re: [PATCH] expr.cc: Optimize if char array initialization consists of all zeros

2022-06-01 Thread Richard Biener via Gcc-patches
On Tue, May 31, 2022 at 5:37 AM Takayuki 'January June' Suwa via Gcc-patches wrote: > > Hi all, > > In some targets, initialization code for char array may be split into two > parts even if the initialization consists of all zeros: > > /* example */ > extern void foo(char*); > void test(void) { >

[Ada] Allow confirming volatile properties on No_Caching variables

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Volatile variables marked with the No_Caching aspect can now have confirming aspects for other volatile properties, with a value of False. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * contracts.adb (Check_Type_Or_Object_External_Properties): Check the validity of

[Ada] Combine system.ads file - vxworks7 kernel constants.

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/system-vxworks7-aarch64.ads (Word_Size): Compute based on Standard'Word_Size.

[Ada] Combine system.ads files - arm and aarch64 qnx

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Systemitize Word_Size and Memory_Size declarations rather than hard code with numerical values or OS specific Long_Integer size. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/system-qnx-arm.ads (Memory_Size): Compute based on Word_Size.diff --git

[Ada] Fix missing space in error message

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
On illegal code like: type T is new Positive in range 1..5; the compiler was emitting message: error: extra "in"ignored ^^ which lacked a space character. A tiny diagnostic improvement; spotted while mistakenly typing an illegal test. Tested on x86_64-pc-linux-gnu,

[Ada] Rename Returns_On_Secondary_Stack into Needs_Secondary_Stack

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
The Returns_On_Secondary_Stack predicate is a misnomer because it must be invoked on a type and types do not return; as a matter of fact, the other Returns_XXX predicates apply to functions. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch6.adb (Caller_Known_Size):

[Ada] Fix classification of Subprogram_Variant as assertion pragma

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This pragma was wrongly not recognized as an assertion pragma. Now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_prag.ads (Assertion_Expression_Pragmas): Fix value for pragma Subprogram_Variant.diff --git a/gcc/ada/sem_prag.ads b/gcc/ada/sem_prag.ads

[Ada] Do not freeze subprogram body without spec too early

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This fixes a small oddity whereby a subprogram body declared without a spec would be frozen before its entity is fully processed as an overloaded name. Now the latter step computes useful information, for example whether the body is a (late) primitive of a tagged type, which can be required during

[Ada] Bug fix in "=" function of formal doubly linked list

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Correction of a typo regarding indexes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cfdlli.adb ("="): Make the function properly loop over the right list.diff --git a/gcc/ada/libgnat/a-cfdlli.adb b/gcc/ada/libgnat/a-cfdlli.adb ---

[Ada] Fix predicate check on object declaration

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
When subtype predicate checks are added for object declarations, it could lead to a compiler crash or to an incorrect check. When the subtype for the object being declared is built later by Analyze_Object_Declaration, the predicate check can't be applied on the object instead of a copy as the

[Ada] arm-qnx-7.1: unwind goes wrong after regs restore

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Bump the pc +3 total for Thumb mode, the same calculation that as is done for arm-linux. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * init.c (__gnat_adjust_context_for_raise) [QNX][__thumb2__]: Bump the pc an extra byte.diff --git a/gcc/ada/init.c

[Ada] Enable using absolute paths in -fdiagnostics-format=json output

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This commit makes GNAT use absolute paths in -fdiagnostics-format=json's output when -gnatef is present on the command line. This makes life easier for tools that ingest GNAT's output. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ *

[Ada] Fix bad interaction between Inline_Always and -gnateV + -gnata

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
The combination of pragma/aspect Inline_Always and -gnateV -gnata runs afoul of the handling of inlining across units by gigi, which does not inline a subprogram that calls nested subprograms if these subprograms are not themselves inlined. This condition does not apply to internally generated

[Ada] Propagate null-exclusion to anonymous access types

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
When analyzing an array or record type declaration whose component has a constrained access type, e.g.: type Buffer_Acc is not null access all String; type Buffer_Rec is record Data : Buffer_Acc (1 .. 10); end record; type Buffer_Arr is array (Boolean) of Buffer_Acc (1 .. 10);

[Ada] Get rid of secondary stack for controlled components of limited types

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
The initial work didn't change anything for limited types because they use a specific return mechanism for functions called build-in-place where there is no anonymous return object, so the secondary stack was used only for the sake of consistency with the nonlimited case. This change aligns the

[Ada] Note that hardening features are experimental

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Some features haven't got customer feedback or made upstream yet. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * doc/gnat_rm/security_hardening_features.rst: Note that hardening features are experimental. * gnat_rm.texi: Regenerate.diff --git

[Ada] Another case where freezing incorrectly suppresses checks

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Avoid improperly suppressing checks for the wrapper subprogram that is built when a null type extension inherits (and does not override) a function with a controlling result. This is a follow-up to other changes already made on this ticket. Tested on x86_64-pc-linux-gnu, committed on trunk

[Ada] Adjust reference in comment

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This is needed after the creation of Returns_On_Secondary_Stack from the original Requires_Transient_Scope. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Indirect_Temp_Needed): Adjust reference in comment.diff --git a/gcc/ada/sem_util.adb

[Ada] QNX shared libraries - arm-qnx build gnatlib .so's

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Shared libraries now fully supported on arm-qnx. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * Makefile.rtl (GNATLIB_SHARED): Revert disablement for arm-qnx.diff --git a/gcc/ada/Makefile.rtl b/gcc/ada/Makefile.rtl --- a/gcc/ada/Makefile.rtl +++ b/gcc/ada/Makefile.rtl @@

[Ada] Fix composability of return on the secondary stack

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Having components that need to be returned on the secondary stack would not always force a record type to be returned on the secondary stack itself. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_util.adb (Returns_On_Secondary_Stack.Caller_Known_Size_Record):

[Ada] Adjust warning switches

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This makes tagging more accurate. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_warn.adb (Check_References): Adjust conditions under which warning messages should be emitted and their tags as well.diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb ---

[Ada] Missing discriminant checks when accessing variant field

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
In some cases, the compiler would incorrectly fail to generate discriminant checks when accessing fields declared in a variant part. Correct some such cases; detect the remaining cases and flag them as unsupported. The formerly-problematic cases that are now handled correctly involve component

[Ada] Minor tweaks to dispatching support code

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
No functional changes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_disp.ads (Expand_Interface_Thunk): Change type of Prim. * exp_disp.adb (Expand_Interface_Thunk): Declare Is_Predef_Op earlier, do not initialize Iface_Formal, use No idiom and tweaks

[Ada] Fix search for "for ... of" loop subprograms

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This patch makes the search for Get_Element_Access, Step (Next/Prev), Reference_Control_Type, and Pseudo_Reference (for optimized "for ... of" loops) more robust. In particular, we have a new Next procedure in Ada 2022, and we need to pick the right one. We have not yet added the new Next and

[Ada] Add reference counting in functional containers

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This patch adds reference counting to dynamically allocated pointers on arrays and elements used by the functional container. This is done by making both the arrays and the elements controlled. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/a-cofuba.ads,

[Ada] arm-qnx-7.1: unwind goes wrong after regs restore

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
The usual increment of the pc to pc+2 for ARM is needed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * init.c (QNX): __gnat_adjust_context_for_raise: New implementation for arm-qnx.diff --git a/gcc/ada/init.c b/gcc/ada/init.c --- a/gcc/ada/init.c +++

[Ada] Issue a warning on entity hidden in use_clause with -gnatwh

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Augment the warnings issued with switch -gnatwh, so that a warning is also issued when an entity from the package of a use_clause ends up hidden due to an existing visible homonym. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch8.adb (Use_One_Package): Possibly warn.

[Ada] Issue better error message for out-of-order keywords in record def

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Various cases of out-of-order keywords in the definition of a record were already detected. This adds a similar detection after NULL and RECORD keywords. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * par-ch3.adb (P_Known_Discriminant_Part_Opt): Reword error

[Ada] Use Actions field of freeze nodes for subprograms (continued)

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This case was missed in the previous change. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch6.adb (Freeze_Subprogram.Register_Predefined_DT_Entry): Put the actions into the Actions field of the freeze node instead of inserting them after it.diff --git

[Ada] Add inline documentation for Is_{Parenthesis,Enum_Array}_Aggregate

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
Both flags were added when square brackets for array/container aggregates have been enabled with -gnat2022 without their corresponding inline documentation. This change adds the missing documention. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sinfo.ads: Add inline

[Ada] Incorrect code for anonymous access-to-function with convention C

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
This patch fixes a bug where the compiler generates incorrect code for a call via an object with convention C, whose type is an anonymous access-to-function type. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * einfo-utils.adb (Set_Convention): Call Set_Convention

[Ada] Suppress warnings on membership test of ranges

2022-06-01 Thread Pierre-Marie de Rodat via Gcc-patches
For a membership test "X in A .. B", the compiler used to warn if it could prove that X is within one of the bounds. For example, if we know at compile time that X >= A, then the above could be replaced by "X <= B". This patch suppresses that warning, because there is really nothing wrong with

Re: [1/2] PR96463 - aarch64 specific changes

2022-06-01 Thread Richard Sandiford via Gcc-patches
Prathamesh Kulkarni writes: > On Thu, 12 May 2022 at 16:15, Richard Sandiford > wrote: >> >> Prathamesh Kulkarni writes: >> > On Wed, 11 May 2022 at 12:44, Richard Sandiford >> > wrote: >> >> >> >> Prathamesh Kulkarni writes: >> >> > On Fri, 6 May 2022 at 16:00, Richard Sandiford >> >> >

Re: [2/2] PR96463 -- changes to type checking vec_perm_expr in middle end

2022-06-01 Thread Richard Biener via Gcc-patches
On Tue, 31 May 2022, Prathamesh Kulkarni wrote: > On Mon, 23 May 2022 at 22:57, Prathamesh Kulkarni > wrote: > > > > On Mon, 9 May 2022 at 21:21, Prathamesh Kulkarni > > wrote: > > > > > > On Mon, 9 May 2022 at 19:22, Richard Sandiford > > > wrote: > > > > > > > > Prathamesh Kulkarni writes:

Re: [PATCH v4] DSE: Use the constant store source if possible

2022-06-01 Thread Richard Sandiford via Gcc-patches
"H.J. Lu" writes: > On Mon, May 30, 2022 at 09:35:43AM +0100, Richard Sandiford wrote: >> "H.J. Lu" writes: >> > --- >> > RTL DSE tracks redundant constant stores within a basic block. When RTL >> > loop invariant motion hoists a constant initialization out of the loop >> > into a separate