Re: [PATCH/RFC] Add a new memory gathering optimization for loop (PR98598)

2021-05-06 Thread Feng Xue OS via Gcc-patches
>> gcc/ >> PR tree-optimization/98598 >> * Makefile.in (OBJS): Add tree-ssa-loop-mgo.o. >> * common.opt (-ftree-loop-mgo): New option. > > Just a quick comment - -ftree-loop-mgo is user-facing and it isn't really a > good > name. -floop-mgo would be better but still I'd

[PATCH RFC] c++: don't call 'rvalue' in coroutines code

2021-05-06 Thread Jason Merrill via Gcc-patches
A change to check glvalue_p rather than specifically for TARGET_EXPR revealed issues with the coroutines code's use of the 'rvalue' function, which shouldn't be used on class glvalues, so I've removed those calls. In build_co_await I just dropped them, because I don't see anything in the co_await

PowerPC64 ELFv2 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
PowerPC64 ELFv2 dual entry point functions have a couple of problems with -fpatchable-function-entry. One is that the nops added after the global entry land in the global entry code which is constrained to be a power of two number of instructions, and zero global entry code has special meaning

Revert "rs6000: Avoid -fpatchable-function-entry* regressions on powerpc64 be [PR98125]"

2021-05-06 Thread Alan Modra via Gcc-patches
This reverts commit b680b9049737198d010e49cf434704c6a6ed2b3f now that the PowerPC64 ELFv1 regression is fixed properly. PR testsuite/98125 * targhooks.h (default_print_patchable_function_entry_1): Delete. * targhooks.c (default_print_patchable_function_entry_1): Delete.

PowerPC64 ELFv1 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
On PowerPC64 ELFv1 function symbols are defined on function descriptors in an .opd section rather than in the function code. .opd is not split up by the PowerPC64 backend for comdat groups or other situations where per-function sections are required. Thus SECTION_LINK_ORDER can't use the function

PR98125, PowerPC64 -fpatchable-function-entry

2021-05-06 Thread Alan Modra via Gcc-patches
This series of patches fixes -fpatchable-function-entry on PowerPC64 ELFv1 so that SECTION_LINK_ORDER (.section 'o' arg) is now supported, and on PowerPC64 ELFv2 to not break the global entry code. Bootstrapped powerpc64le-linux and x86_64-linux all langs. I did see one regression on both

Re: [PATCH/RFC] combine: Tweak the condition of last_set invalidation

2021-05-06 Thread Kewen.Lin via Gcc-patches
Hi Segher, >> >> I think this should be postponed to stage 1 though? Or is there >> anything very urgent in it? >> > > Yeah, I agree that this belongs to stage1, and there isn't anything > urgent about it. Thanks for all further comments above! > Gentle ping this:

[PATCH] forwprop: Support vec perm fed by CTOR and CTOR/CST [PR99398]

2021-05-06 Thread Kewen.Lin via Gcc-patches
Hi, This patch is to teach forwprop to optimize some cases where the permutated operands of vector permutation are from two same type CTOR and CTOR or one CTOR and one VECTOR CST. It aggressively takes VIEW_CONVERT_EXPR as trivial copies and transform the vector permutation into vector CTOR.

Ping: [PATCH 1/2] correct BB frequencies after loop changed

2021-05-06 Thread guojiufu via Gcc-patches
Gentle ping. Original message: https://gcc.gnu.org/pipermail/gcc-patches/2020-October/555871.html Thanks, Jiufu Guo.

[PATCH] rs6000: Support more short/char to float conversion

2021-05-06 Thread Kewen.Lin via Gcc-patches
Hi, For some cases that when we load unsigned char/short values from the appropriate unsigned char/short memories and convert them to double/single precision floating point value, there would be implicit conversions to int first. It makes GCC not leverage the P9 instructions lxsibzx/lxsihzx.

[PATCH] rs6000: Adjust rs6000_density_test for strided_load

2021-05-06 Thread Kewen.Lin via Gcc-patches
Hi, We noticed that SPEC2017 503.bwaves_r run time degrades by about 8% on P8 and P9 if we enabled vectorization at O2 fast-math. Comparing to Ofast, compiler doesn't do the loop interchange on the innermost loop, it's not profitable to vectorize it then. Since with loop vectorization, the loop

[PATCH] rs6000: Make density_test only for vector version

2021-05-06 Thread Kewen.Lin via Gcc-patches
Hi, When I was investigating density_test heuristics, I noticed that the current rs6000_density_test could be used for single scalar iteration cost calculation, through the call trace: vect_compute_single_scalar_iteration_cost -> rs6000_finish_cost -> rs6000_density_test It looks

Re: [PATCH] run early sprintf warning after SSA (PR 100325)

2021-05-06 Thread Martin Sebor via Gcc-patches
On 5/6/21 8:32 AM, Aldy Hernandez wrote: On 5/5/21 9:26 AM, Richard Biener wrote: On Wed, May 5, 2021 at 1:32 AM Martin Sebor via Gcc-patches wrote: With no optimization, -Wformat-overflow and -Wformat-truncation runs early to detect a subset of simple bugs.  But as it turns out, the pass

[committed] preprocessor: Fix pp-number lexing of digit separators [PR83873, PR97604]

2021-05-06 Thread Joseph Myers
When the preprocessor lexes preprocessing numbers in lex_number, it accepts digit separators in more cases than actually permitted in pp-numbers by the standard syntax. One thing this accepts is adjacent digit separators; there is some code to reject those later, but as noted in bug 83873 it

Re: [PATCH] Hashtable PR96088

2021-05-06 Thread François Dumont via Gcc-patches
Hi     Considering your feedback on backtrace in debug mode is going to take me some time so here is another one.     Compared to latest submission I've added a _Hash_arg_t partial specialization for std::hash<>. It is not strictly necessary for the moment but when we will eventually remove

Re: [PATCH] phiopt: Optimize (x <=> y) cmp z [PR94589]

2021-05-06 Thread Marc Glisse
On Thu, 6 May 2021, Jakub Jelinek via Gcc-patches wrote: Though, (x&1) == x is equivalent to both (x&~1)==0 and to x < 2U and from the latter two it isn't obvious which one is better/more canonical. On aarch64 I don't see differences in number of insns nor in their size: 10:13001c00

Re: [Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Paul Richard Thomas via Gcc-patches
It's 46991 of course. Many thanks Paul On Thu, 6 May 2021 at 17:15, Paul Richard Thomas < paul.richard.tho...@gmail.com> wrote: > Blast! Thanks for pointing it out. The testcase is in a directory > ~/prs/pr46691, which I then took from the editor. Original sin and all > that. > > Paul > >

Re: [Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Paul Richard Thomas via Gcc-patches
Blast! Thanks for pointing it out. The testcase is in a directory ~/prs/pr46691, which I then took from the editor. Original sin and all that. Paul On Thu, 6 May 2021 at 17:06, Jonathan Wakely wrote: > PR 46691 is the wrong PR number: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46691 >

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Jakub Jelinek via Gcc-patches
On Thu, May 06, 2021 at 04:21:40PM +0200, Tobias Burnus wrote: > * omp-low.c (lower_rec_simd_input_clauses): Set max_vf = 1 if > a truth_value_p reduction variable is nonintegral. > (lower_rec_input_clauses): Also handle SIMT part > for complex/float recution with && and

Re: [PATCH] run early sprintf warning after SSA (PR 100325)

2021-05-06 Thread Aldy Hernandez via Gcc-patches
On 5/5/21 9:26 AM, Richard Biener wrote: On Wed, May 5, 2021 at 1:32 AM Martin Sebor via Gcc-patches wrote: With no optimization, -Wformat-overflow and -Wformat-truncation runs early to detect a subset of simple bugs. But as it turns out, the pass runs just a tad too early, before SSA.

Re: [Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Jonathan Wakely via Gcc-patches
PR 46691 is the wrong PR number: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=46691 The comment in the testcase is wrong, and the ChangeLog file will get auto-updated with the wrong number overnight (you can manually edit it and push the fix tomorrow after it's been generated).

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Tobias Burnus
On 06.05.21 15:12, Tom de Vries wrote: WIP patch below tries that approach and fixes the ICE, Thanks! but this simple example still doesn't work: ... #pragma omp target parallel reduction(&&: andf) Try: map(andf). [Cf. PR99928 with pending patch at

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Tom de Vries
On 5/6/21 3:12 PM, Tom de Vries wrote: > On 5/6/21 12:30 PM, Jakub Jelinek wrote: >> On Thu, May 06, 2021 at 12:17:03PM +0200, Tobias Burnus wrote: >>> OpenMP: Fix SIMT for complex/float reduction with && and || >>> >>> gcc/ChangeLog: >>> >>> * omp-low.c (lower_rec_input_clauses): Also handle

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Jakub Jelinek via Gcc-patches
On Thu, May 06, 2021 at 03:12:59PM +0200, Tom de Vries wrote: > + if (truth_value_p (OMP_CLAUSE_REDUCTION_CODE (c)) > + && TREE_CODE (TREE_TYPE (new_var)) != BOOLEAN_TYPE) I would use && !INTEGRAL_TYPE_P (TREE_TYPE (new_var)) Especially in C code using || or && with int or

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Tom de Vries
On 5/6/21 12:30 PM, Jakub Jelinek wrote: > On Thu, May 06, 2021 at 12:17:03PM +0200, Tobias Burnus wrote: >> OpenMP: Fix SIMT for complex/float reduction with && and || >> >> gcc/ChangeLog: >> >> * omp-low.c (lower_rec_input_clauses): Also handle SIMT part >> for complex/float recution

[PATCH] refactor SSA rewriting timevars

2021-05-06 Thread Richard Biener
This avoids too deep stacks of timevars during incremental SSA rewrite and basically use TV_TREE_INTO_SSA for all into-SSA rewrite work and TV_TREE_SSA_INCREMENTAL for update_ssa. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-05-06 Richard Biener * timevar.def

Re: [committed] libstdc++: Use unsigned char argument to std::isdigit

2021-05-06 Thread Jonathan Wakely via Gcc-patches
On 05/05/21 22:14 +0100, Jonathan Wakely wrote: On 05/05/21 21:57 +0200, François Dumont via Libstdc++ wrote: On 05/05/21 2:01 pm, Jonathan Wakely via Libstdc++ wrote: Passing plain char to isdigit is undefined if the value is negative. libstdc++-v3/ChangeLog: * include/std/charconv

[committed] libstdc++: Fix definition of std::remove_cvref_t

2021-05-06 Thread Jonathan Wakely via Gcc-patches
I originally defined std::remove_cvref_t in terms of the internal __remove_cvref_t trait, to avoid instantiating the remove_cvref class template. However, as described in P1715R0 that is observable by users and is thus non-conforming. This defines remove_cvref_t as specified in the standard.

[PATCH] Avoid update_ssa quadraticness in loop splitting

2021-05-06 Thread Richard Biener
We already take care to not apply loop splitting to IL produced by splitting so we should be able to delay updating SSA and loop-closed SSA that was left broken after loop versioning until after we processed all opportunities. Bootstrapped and tested on x86_64-unknown-linux-gnu, I've also built

[PATCH] tree-optimization/100434 - DSE aggregate call LHS

2021-05-06 Thread Richard Biener
This makes DSE consider aggregate LHS of calls as dead, for pure or const calls the whole stmt and for others by removing the LHS. Bootstrapped and tested on x86_64-unknown-linux-gnu. I wonder if there's a more canonical test for call LHS that cannot be removed than + if

Re: [Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Jakub Jelinek via Gcc-patches
On Thu, May 06, 2021 at 12:17:03PM +0200, Tobias Burnus wrote: > OpenMP: Fix SIMT for complex/float reduction with && and || > > gcc/ChangeLog: > > * omp-low.c (lower_rec_input_clauses): Also handle SIMT part > for complex/float recution with && and ||. > > libgomp/ChangeLog: > >

Re: [PATCH 2/2] libstdc++: Implement LWG 3533 changes to foo_view::iterator::base()

2021-05-06 Thread Jonathan Wakely via Gcc-patches
On 05/05/21 16:23 -0400, Patrick Palka via Libstdc++ wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk/10/11? Yes, thanks. libstdc++-v3/ChangeLog: * include/std/ranges (filter_view::_Iterator::base): Make the const& overload return a const reference and

Re: [PATCH 1/2] libstdc++: Implement LWG 3391 changes to move/counted_iterator::base

2021-05-06 Thread Jonathan Wakely via Gcc-patches
On 05/05/21 16:23 -0400, Patrick Palka via Libstdc++ wrote: Tested on x86_64-pc-linux-gnu, does this look OK for trunk/10/11? Yes, thanks. libstdc++-v3/ChangeLog: * include/bits/stl_iterator.h (move_iterator::base): Make the const& overload return a const reference and

Re: [PATCH] phiopt: Optimize (x <=> y) cmp z [PR94589]

2021-05-06 Thread Jakub Jelinek via Gcc-patches
On Wed, May 05, 2021 at 06:52:27PM +0200, Jakub Jelinek via Gcc-patches wrote: > On Wed, May 05, 2021 at 01:45:29PM +0200, Marc Glisse wrote: > > On Tue, 4 May 2021, Jakub Jelinek via Gcc-patches wrote: > > > > > 2) the pr94589-2.C testcase should be matching just 12 times each, but > > > runs >

[Patch] + [nvptx RFH/RFC]: OpenMP: Fix SIMT for complex/float reduction with && and ||

2021-05-06 Thread Tobias Burnus
The complex/float && and || reduction patch missed a target testcase (→ attached) which revealed that also a SIMT needed some special handling, but just runs on non-SIMT systems. The omp-low.c patch is rather simple - and I think it semantically okay. [Note to the change: It looks more completed

Re: [PATCH] phiopt: Use gphi *phi instead of gimple *phi some more

2021-05-06 Thread Richard Biener
On Thu, 6 May 2021, Jakub Jelinek wrote: > Hi! > > Various functions in phiopt are also called with a gphi * but use > gimple * argument for it. Fixed thusly, bootstrapped/regtested on > x86_64-linux and i686-linux, ok for trunk? Yes (obvious even). Richard. > 2021-05-06 Jakub Jelinek >

Re: [committed] Get avr building again

2021-05-06 Thread Senthil Kumar Selvaraj via Gcc-patches
Jeff Law via Gcc-patches writes: > Removes references to CC_STATUS_INIT from the avr port, which should get > it to the point of building again. > > > Committed to the trunk. Thanks, I was about to send a patch for that. Regards Senthil > > > Jeff

RE: [PATCH 3/4][AArch32]: Add support for sign differing dot-product usdot for NEON.

2021-05-06 Thread Tamar Christina via Gcc-patches
> -Original Message- > From: Christophe Lyon > Sent: Thursday, May 6, 2021 10:23 AM > To: Tamar Christina > Cc: gcc Patches ; nd > Subject: Re: [PATCH 3/4][AArch32]: Add support for sign differing dot- > product usdot for NEON. > > On Wed, 5 May 2021 at 19:39, Tamar Christina via

Re: [PATCH 3/4][AArch32]: Add support for sign differing dot-product usdot for NEON.

2021-05-06 Thread Christophe Lyon via Gcc-patches
On Wed, 5 May 2021 at 19:39, Tamar Christina via Gcc-patches wrote: > > Hi All, > > This adds optabs implementing usdot_prod. > > The following testcase: > > #define N 480 > #define SIGNEDNESS_1 unsigned > #define SIGNEDNESS_2 signed > #define SIGNEDNESS_3 signed > #define SIGNEDNESS_4 unsigned >

Re: [Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Andre Vehreschild via Gcc-patches
Hi Paul, this and the Changelog LGTM at least for 12. Give it a consolidation time before applying to 11. Having had some issues in the vicinity of the code you addressed I am quite happy to see how easy the fix looks. Any chances you can take a look at

Re: [PATCH] regcprop: Fix another cprop_hardreg bug [PR100342]

2021-05-06 Thread Jakub Jelinek via Gcc-patches
On Wed, May 05, 2021 at 07:44:46PM +0200, Jakub Jelinek via Gcc-patches wrote: > So perhaps just the vd->e[dr].mode in there could change to > GET_MODE (src) and drop the previous PR98694 change? I've bootstrapped/regtested that successfully on the trunk (on {x86_64,i686}-linux), though haven't

[PATCH] phiopt: Use gphi *phi instead of gimple *phi some more

2021-05-06 Thread Jakub Jelinek via Gcc-patches
Hi! Various functions in phiopt are also called with a gphi * but use gimple * argument for it. Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2021-05-06 Jakub Jelinek * tree-ssa-phiopt.c (value_replacement, minmax_replacement,

[PATCH] arm: Avoid emitting bogus CFA adjusts for CMSE nonsecure calls [PR99725]

2021-05-06 Thread Alex Coplan via Gcc-patches
Hi all, The PR shows us attaching REG_CFA_ADJUST_CFA notes to stack pointer adjustments emitted in cmse_nonsecure_call_inline_register_clear (when -march=armv8.1-m.main). However, the stack pointer is not guaranteed to be the CFA reg. If we're at -O0 or we have -fno-omit-frame-pointer, then the

Re: [PATCH] split loop for NE condition.

2021-05-06 Thread Richard Biener
On Thu, 6 May 2021, guojiufu wrote: > On 2021-05-03 20:18, Richard Biener wrote: > > On Thu, 29 Apr 2021, Jiufu Guo wrote: > > > >> When there is the possibility that overflow may happen on the loop index, > >> a few optimizations would not happen. For example code: > >> > >> foo (int *a, int

Re: [PATCH] IBM Z: Fix error checking for builtin vec_permi

2021-05-06 Thread Andreas Krebbel via Gcc-patches
On 5/6/21 9:56 AM, Marius Hillenbrand wrote: > Hi, > > this patch fixes the check of immediate operands to the builtin vec_permi and > adds a new test for this built-in. > > Reg-rested and bootstrapped on s390x. > > Is it OK for master? Is it OK for backporting to gcc-11? > > Regards, > Marius

RE: [GCC-10 backport][PATCH] arm: Fix testisms introduced with fix for pr target/95646.

2021-05-06 Thread Kyrylo Tkachov via Gcc-patches
> -Original Message- > From: Srinath Parvathaneni > Sent: 05 May 2021 14:32 > To: gcc-patches@gcc.gnu.org > Cc: Kyrylo Tkachov ; Richard Earnshaw > > Subject: [GCC-10 backport][PATCH] arm: Fix testisms introduced with fix for > pr target/95646. > > Hi, > > This is a backport to

RE: [GCC-10 backport][PATCH] arm: PR target/95646: Do not clobber callee saved registers with CMSE.

2021-05-06 Thread Kyrylo Tkachov via Gcc-patches
> -Original Message- > From: Srinath Parvathaneni > Sent: 05 May 2021 14:32 > To: gcc-patches@gcc.gnu.org > Cc: Kyrylo Tkachov ; Richard Earnshaw > > Subject: [GCC-10 backport][PATCH] arm: PR target/95646: Do not clobber > callee saved registers with CMSE. > > Hi, > > This is a

Re: [Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Paul Richard Thomas via Gcc-patches
Hi All, Please find below a corrected ChangeLog. Sorry that I didn't get it right first go. Paul Fortran: Assumed and explicit size class arrays [PR46691/99819]. 2021-05-06 Paul Thomas gcc/fortran/ChangeLog PR fortran/46691 PR fortran/99819 * class.c (gfc_build_class_symbol): Remove the

[PATCH] ipa/100373 - fix emutls lowering compare-debug issue

2021-05-06 Thread Richard Biener
emutls figured that tls uses in debug-insns need lowering but that obviously has effects on code-generation as can be seen in the following IL diff with the new testcase: [local count: 1073741824]: - a = 0; + # DEBUG BEGIN_STMT _4 = __builtin___emutls_get_address (&__emutls_v.b); + #

[PATCH] Fix IPA SRA removal of DECL_BY_REFERENCE return

2021-05-06 Thread Richard Biener
While doing bogus call LHS removal I noticed that cloning with dropping a return value creates a bogus replacement for a DECL_BY_REFERENCE DECL_RESULT, resulting in MEM_REFs of aggregates rather than pointers. The following fixes this latent issue. I don't have a testcase that ICEs without doing

[Ada] ACATS 4.1R-c611a04: Class-wide preconditions in dispatching calls

2021-05-06 Thread Pierre-Marie de Rodat
This patch is a partial implementation of the semantics mandated in AI12-0195 concerning class-wide preconditions on dispatching calls: the precondition that applies is that of the denoted subprogram entity, not that of the body that is actually executed. Tested on x86_64-pc-linux-gnu, committed

[Ada] Avoid repeated analysis of constraint ranges

2021-05-06 Thread Pierre-Marie de Rodat
Don't call Analyse just before Process_Range_Expr_In_Decl, because the latter starts with a call to Analyze_And_Resolve anyway. This fixes a violation with the required sequencing in resolution of overloaded nodes that requires the Etype being Any_Type and Is_Overloading being False before

[Ada] Bad expansion with -gnato2 and if expression

2021-05-06 Thread Pierre-Marie de Rodat
When dealing with -gnato2 inside an if expression, we might drop on the floor the If or Else_Nodes. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * exp_ch4.adb (Expand_N_If_Expression): Apply_Arithmetic_Overflow_Check will not deal with Then/Else_Actions so

[Ada] AI12-0411: Add "bool" to Interfaces.C

2021-05-06 Thread Pierre-Marie de Rodat
This AI adds in Interfaces.C a binding to the C type _Bool/bool. Note that this AI makes ambiguous the construct pragma Assert (False) when using Interfaces.C. To hopefully provide slightly better backward compatibility, we make Interfaces.C.Extensions.bool a renaming of Interfaces.C.bool so that

[Ada] In CodePeer mode, use regular-exception handling

2021-05-06 Thread Pierre-Marie de Rodat
After a change done for GNATProve in 2016, CodePeer_Mode was not using the regular exception mechanism. This resulted in imprecise control-flow graphs in some cases. Revert that change for CodePeer. And, since for GNATprove_Mode Operating_Mode is never Generate_Code, we can simplify the code a

[Ada] Missing semantic error on ineffective Others_Clause

2021-05-06 Thread Pierre-Marie de Rodat
Compiler fails to reject an Others_Clause in an aggregate for a constrained array type when previous components of the aggregate cover the full index range of the array subtype, and the expression in the Others_Clause has a type incompatible with the component type of the array. The Others_Clause

[Ada] Assert failure on pragma Inline in procedure body

2021-05-06 Thread Pierre-Marie de Rodat
Is_Inline_Pragma isn't always dealing properly with N not being a list member and Spec_Id being null. This is now fixed. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_ch6.adb (Is_Inline_Pragma): Protect against N not being a list member in both branches.diff

[Ada] Do not second-guess the hardware for underflow handling of Scaling

2021-05-06 Thread Pierre-Marie de Rodat
This defers to the hardware implementation for the handling of underflow in the Scaling routine also in the case where denormals are not supported. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-fatgen.adb (Scaling): Use single handling of underflow. Add

[Ada] Set Raises_CE flag only in Apply_Compile_Time_Constraint_Error

2021-05-06 Thread Pierre-Marie de Rodat
Routine Apply_Compile_Time_Constraint_Error, when operating in GNAT mode, always sets Raises_Constraint_Error flag, so there is no need to follow it with calls to Set_Raises_Constraint_Error. These calls only had an effect in GNATprove mode, but they were following few calls to

[Ada] Make Is_OK_Static_Subtype use Is_Static_Subtype

2021-05-06 Thread Pierre-Marie de Rodat
The reason for this change is two-fold: - There is code duplication between Is_OK_Static_Subtype and Is_Static_Subtype - Is_Static_Subtype is more correct than Is_OK_Static_Subtype (e.g. the dynamic predicate checks are more complete in Is_Static_Subtype). Tested on x86_64-pc-linux-gnu,

[Ada] Reset x87 FPU to 64-bit precision for floating-point I/O on Linux

2021-05-06 Thread Pierre-Marie de Rodat
This is basically done on all x86/x86-64 native systems except for Linux and makes it possible to work around other precision settings, e.g Java's. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * init.c (__gnat_init_float): Use full version on Linux too.diff --git

[Ada] Fix off-by-one bug in underflow handling of Scaling

2021-05-06 Thread Pierre-Marie de Rodat
Gradual underflow needs to be used for one more exponent. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-fatgen.adb (Scaling): Fix off-by-one bug for underflow.diff --git a/gcc/ada/libgnat/s-fatgen.adb b/gcc/ada/libgnat/s-fatgen.adb ---

[Ada] Spurious constraint error on conversion of access types

2021-05-06 Thread Pierre-Marie de Rodat
This patch fixes an error in the compiler whereby a spurious constraint error is raised at runtime on type conversions between access-to-discriminanted types when the object being converted is null. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * checks.adb

[Ada] Make new implementation of System.Fat_Gen.Valid more robust

2021-05-06 Thread Pierre-Marie de Rodat
The comparison of any denormalized number with 0.0 may return True on hardware not supporting denormals, so we need to do a bit comparison. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * libgnat/s-fatgen.adb (Valid): Do a bit comparison with 0.0 when denormalized

[Ada] Fix handling of PATs

2021-05-06 Thread Pierre-Marie de Rodat
When trying to compare two fields, one that's a packed array of known length and one that's a packed array of unknown length, Expand_Packed_Eq converts each side of the equality to its packed array type and then says that's enough if the types are modular integer types. That's correct, however,

[Ada] Remove hardcoded pragma Warnings from the formal vectors library

2021-05-06 Thread Pierre-Marie de Rodat
Pragma Warnings in the generic formal vectors library was only suppressing a message in one specific instantiation within one specific GNATprove test. This pragma was referring to "type T defined at line 4", which is exactly the type declared in that test; the suppression didn't work for any

[Ada] Implement tiered support for floating-point exponentiation

2021-05-06 Thread Pierre-Marie de Rodat
This changes the implementation of floating-point exponentiation from using Long_Long_Float for all floating-point types to using a base type tailored to the type being operated on. The computation is done in double precision internally, which gives more accurate results for Long_Float and

[Ada] Fix restriction No_Enumeration_Maps on both Image attributes

2021-05-06 Thread Pierre-Marie de Rodat
Restriction No_Enumeration_Maps was only checked on Value attribute (and its Wide and Wide_Wide variants). Now it is checked also on Img, Image and its Wide and Wide_Wide variants, just like described in the GNAT RM. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ *

[Ada] Remove unused initial value in Read_Library_Info_From_Full

2021-05-06 Thread Pierre-Marie de Rodat
Remove an initial value of a local variable that were never used. Static analysis tools like CodePeer should easily recognize that this variable is only accessed after being written. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * osint.adb (Read_Library_Info_From_Full):

[Ada] Crash on if_expression used as index of discriminant-dependent array

2021-05-06 Thread Pierre-Marie de Rodat
The compiler aborts on an if_expression used as an index when the object being indexed is a discriminant-dependent component, and the frontend generates an improper range check on the expression instead of the required index check. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/

[Ada] Remove excessive conditions in iterations across components

2021-05-06 Thread Pierre-Marie de Rodat
When iterating with First_Component/Next_Component we don't need to check that the Ekind of the iterator variable is E_Component. Code cleanup related to record equality and unchecked unions; behaviour is unaffected. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ *

[Ada] Remove redundant condition for Image attribute and Ada version

2021-05-06 Thread Pierre-Marie de Rodat
Routine Error_Msg_Ada_2012_Feature includes a test on Ada_Version, so there is no need to explicitly test the same condition just before the call. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * sem_attr.adb (Analyze_Image_Attribute): Remove redundant condition; add

Re: [PATCH] split loop for NE condition.

2021-05-06 Thread guojiufu via Gcc-patches
On 2021-05-03 20:18, Richard Biener wrote: On Thu, 29 Apr 2021, Jiufu Guo wrote: When there is the possibility that overflow may happen on the loop index, a few optimizations would not happen. For example code: foo (int *a, int *b, unsigned k, unsigned n) { while (++k != n) a[k] = b[k]

[PATCH] IBM Z: Fix error checking for builtin vec_permi

2021-05-06 Thread Marius Hillenbrand via Gcc-patches
Hi, this patch fixes the check of immediate operands to the builtin vec_permi and adds a new test for this built-in. Reg-rested and bootstrapped on s390x. Is it OK for master? Is it OK for backporting to gcc-11? Regards, Marius --8<--8<-8<- The builtin vec_permi is

Re: [PATCH 3/3] go: use htab_eq_string in godump

2021-05-06 Thread Richard Biener via Gcc-patches
On Thu, May 6, 2021 at 12:44 AM Tom Tromey wrote: > > This changes godump to use the new htab_eq_string function. OK. > gcc > > * godump.c (string_hash_eq): Remove. > (go_finish): Use htab_eq_string. > --- > gcc/godump.c | 14 +++--- > 1 file changed, 3 insertions(+),

Re: [PATCH 2/3] gcc: use htab_eq_string

2021-05-06 Thread Richard Biener via Gcc-patches
On Thu, May 6, 2021 at 12:43 AM Tom Tromey wrote: > > This changes one spot in GCC to use the new htab_eq_string function. OK. > gcc > > * gengtype-state.c (read_state): Use htab_eq_string. > (string_eq): Remove. > --- > gcc/gengtype-state.c | 11 +-- > 1 file changed,

Re: [PATCH 1/3] libiberty: add htab_eq_string

2021-05-06 Thread Richard Biener via Gcc-patches
On Thu, May 6, 2021 at 12:41 AM Tom Tromey wrote: > > The libiberty hash table includes a helper function for strings, but > no equality function. Consequently, this equality function has been > reimplemented a number of times in both the gcc and binutils-gdb > source trees. This patch adds the

Re: [PATCH] -Walloca-larger-than with constant sizes at -O0 (PR 100425)

2021-05-06 Thread Richard Biener via Gcc-patches
On Wed, May 5, 2021 at 7:29 PM Martin Sebor wrote: > > On 5/5/21 1:32 AM, Richard Biener wrote: > > On Wed, May 5, 2021 at 4:20 AM Martin Sebor via Gcc-patches > > wrote: > >> > >> Even when explicitly enabled, -Walloca-larger-than doesn't run > >> unless optimization is enabled as well. This

[Patch, fortran] PRs 46691 and 99819: Assumed and explicit size class arrays

2021-05-06 Thread Paul Richard Thomas via Gcc-patches
Hi All, Although I had undertaken to concentrate on PDTs, PR99819 so intrigued me that I became locked into it :-( After extensive, fruitless rummaging through decl.c and trans-decl.c, I realised that the problem was far simpler than it seemed and that it lay in class.c. After that PR was fixed,