Re: [PATCH][libatomic] Fix return value in libat_test_and_set

2022-03-24 Thread Jakub Jelinek via Gcc-patches
On Thu, Mar 24, 2022 at 11:01:30AM +0100, Tom de Vries wrote: > > Shouldn't that be instead > >return (woldval & ((UWORD) -1 << shift)) != 0; > > or > >return (woldval & ((UWORD) ~(UWORD) 0 << shift)) != 0; > > ? > > Well, I used '(woldval & wval) == wval' based on the fact that the set >

Re: [PATCH][libatomic] Fix return value in libat_test_and_set

2022-03-24 Thread Jakub Jelinek via Gcc-patches
On Thu, Mar 24, 2022 at 01:08:56PM +0100, Tom de Vries wrote: > Ack, updated patch, added missing changelog contribution. > > OK for trunk? Yes. I guess it is a backport candidate to release branches as well (after a while). Jakub

Re: [PATCH v10 10/12] LoongArch Port: libgomp

2022-03-24 Thread Jakub Jelinek via Gcc-patches
On Thu, Mar 24, 2022 at 08:37:32PM +0800, chenglulu wrote: > libgomp/ > > * configure.tgt: Add LoongArch triplet. Ok. > diff --git a/libgomp/configure.tgt b/libgomp/configure.tgt > index d4f1e741b5a..2cd7272fcd8 100644 > --- a/libgomp/configure.tgt > +++ b/libgomp/configure.tgt > @@ -56,

[PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
Hi! On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits static real(kind=4) a[0] = {[0 ... -1]=2.0e+0}; That is an invalid RANGE_EXPR where the maximum is smaller than the minimum. The following patch fixes that. If TYPE_MAX_VALUE is smaller than TYPE_MIN_VALUE, the array is empty a

Re: [PATCH][libgomp, testsuite] Scale down some OpenACC test-cases

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 10:18:49AM +0100, Tom de Vries wrote: > When a display manager is running on an nvidia card, all CUDA kernel launches > get a 5 seconds watchdog timer. > > Consequently, when running the libgomp testsuite with nvptx accelerator and > GOMP_NVPTX_JIT=-O0 we run into a few FAI

[PATCH] recog: Return 1 from insn_invalid_p if REG_INC reg overlaps some stored reg [PR103775]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs on aarch64-linux with -g and assembles with a warning otherwise, because it emits ldrb w0,[x0,16]! instruction which sets the x0 register multiple times. Due to disabled DCE (from -Og) we end up before REE with: (insn 12 39 13 2 (set (reg:SI 1 x1 [orig:93 _2 ] [93])

Re: [PATCH] arm: Revert Auto-vectorization for MVE: add pack/unpack patterns PR target/104882

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 22, 2022 at 03:33:44PM +0100, Christophe Lyon via Gcc-patches wrote: > This reverts commit r12-1434-g046a3beb1673bf to fix PR target/104882. > > As discussed in the PR, it turns out that the MVE ISA has no natural > mapping with GCC's vec_pack_trunc / vec_unpack standard patterns, unli

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 12:16:40PM +0100, Richard Biener wrote: > On Fri, Mar 25, 2022 at 11:13 AM Tobias Burnus > wrote: > > > > On 25.03.22 09:57, Jakub Jelinek via Fortran wrote: > > > On the gfortran.dg/pr103691.f90 testcase the Fortran ICE emits > > >static real(kind=4) a[0] = {[0 ... -1

Re: [PATCH][libgomp, testsuite] Scale down some OpenACC test-cases

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 01:08:52PM +0100, Tom de Vries wrote: > On 3/25/22 11:04, Tobias Burnus wrote: > > On 25.03.22 10:27, Jakub Jelinek via Gcc-patches wrote: > > > On Fri, Mar 25, 2022 at 10:18:49AM +0100, Tom de Vries wrote: > > > > [...] > > > >

Re: [PATCH] fortran: Fix up initializers of param(0) PARAMETERs [PR103691]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 01:13:06PM +0100, Richard Biener wrote: > > Also, I think typically in the Fortran FE side-effects would go into > > se.pre and se.post sequences, not into se.expr, and this routine > > doesn't emit those se.pre/se.post sequences anywhere, so presumably it > > assumes they d

[PATCH] c++: Fix up __builtin_{bit_cast,convertvector} parsing

2022-03-25 Thread Jakub Jelinek via Gcc-patches
Hi! Jonathan reported on IRC that we don't parse __builtin_bit_cast (type, val).field etc. The problem is that for these 2 builtins we return from cp_parser_postfix_expression instead of setting postfix_expression to the cp_build_* value and falling through into the postfix regression suffix handl

[PATCH] c++: Fix up ICE when cplus_decl_attributes is called with error_mark_node attributes [PR104668]

2022-03-25 Thread Jakub Jelinek via Gcc-patches
Hi! cplus_decl_attributes can be called with attributes equal to error_mark_node, there are some spots in the function that test it or decl_attributes it calls starts with: if (TREE_TYPE (*node) == error_mark_node || attributes == error_mark_node) return NULL_TREE; But the recent PR104245 ch

[PATCH] predcom: Fix up component::component [PR105056]

2022-03-28 Thread Jakub Jelinek via Gcc-patches
Hi! The recent change didn't initialize comp_step while previously we used XCNEW to allocate it. I think RS_ANY is better than RS_INTERNAL (== 0) as the default. Bootstrappedd/regtested on x86_64-linux and i686-linux, ok for trunk? 2022-03-26 Jakub Jelinek PR tree-optimization/10505

Re: [PATCH] c++: Fix up ICE when cplus_decl_attributes is called with error_mark_node attributes [PR104668]

2022-03-28 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 07:48:33PM +0100, Jakub Jelinek wrote: > We then wouldn't propagate TREE_DEPRECATED/TREE_UNAVAILABLE from templates > to their instantiations and wouldn't diagnose static data members in OpenMP > declare target. > But perhaps that is fine, with error_mark_attribute it is err

Re: [PATCH] PR102024 - IBM Z: Add psabi diagnostics

2022-03-28 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 06:45:41PM +0100, Andreas Krebbel wrote: > gcc/ChangeLog: > PR target/102024 > * config/s390/s390-protos.h (s390_function_arg_vector): Remove > prototype. > * config/s390/s390.cc (s390_single_field_struct_p): New function. > (s390_function_arg_v

Re: [PATCH] tree-optimization/105080 - make sure SCEV is available for ranger

2022-03-28 Thread Jakub Jelinek via Gcc-patches
On Mon, Mar 28, 2022 at 03:16:24PM +0200, Richard Biener wrote: > When doing format diagnostics at -O0 we should make sure to make > SCEV available to avoid false positives due to ranges we otherwise > can trivially compute. > > Bootstrap and regtest running on x86_64-unknown-linux-gnu. > > OK if

Re: [PATCH] tree-optimization/105080 - make sure SCEV is available for ranger

2022-03-28 Thread Jakub Jelinek via Gcc-patches
On Mon, Mar 28, 2022 at 03:26:11PM +0200, Richard Biener wrote: > On Mon, 28 Mar 2022, Jakub Jelinek wrote: > > > On Mon, Mar 28, 2022 at 03:16:24PM +0200, Richard Biener wrote: > > > When doing format diagnostics at -O0 we should make sure to make > > > SCEV available to avoid false positives due

[PATCH] combine: Don't record for UNDO_MODE pointers into regno_reg_rtx array [PR104985]

2022-03-29 Thread Jakub Jelinek via Gcc-patches
Hi! The testcase in the PR fails under valgrind on mips64 (but only Martin can reproduce, I couldn't). But the problem reported there is that SUBST_MODE remembers addresses into the regno_reg_rtx array, then some splitter needs a new pseudo and calls gen_reg_rtx, which reallocates the regno_reg_rt

[PATCH] c++: Fox template-introduction tentative parsing in class bodies clear colon_corrects_to_scope_p [PR105061]

2022-03-29 Thread Jakub Jelinek via Gcc-patches
Hi! The concepts support (in particular template introductions from concepts TS) broke the following testcase, valid unnamed bitfields with dependent types (or even just typedefs) were diagnosed as typos (: instead of correct ::) in template introduction during their tentative parsing. The followi

Re: [PATCH 1/2] arm: correctly handle zero-sized bit-fields in AAPCS [PR102024]

2022-03-29 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 29, 2022 at 04:32:10PM +0100, Richard Earnshaw wrote: > > On arm the AAPCS states that an HFA is determined by the 'shape' of > the object after layout has been completed, so anything that adds no > members and does not cause the layout to be modified should be ignored > for the purpos

Re: [PATCH 2/2] aarch64: correctly handle zero-sized bit-fields in AAPCS64 [PR102024]

2022-03-29 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 29, 2022 at 04:32:11PM +0100, Richard Earnshaw wrote: > > On aarch64 the AAPCS64 states that an HFA is determined by the 'shape' of > the object after layout has been completed, so anything that adds no > members and does not cause the layout to be modified should be ignored > for the

Re: [PATCH] gimple: Wrong -Wimplicit-fallthrough with if(1) [PR103597]

2022-03-29 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 29, 2022 at 12:13:51PM -0400, Marek Polacek wrote: > This patch fixes a wrong -Wimplicit-fallthrough warning for > > case 0: > if (1) // wrong may fallthrough > return 0; > case 1: > > which in .gimple looks like > > : // case 0 > if (1 != 0) goto ; else

[committed] openmp: Ensure DECL_CONTEXT of OpenMP iterators in templates [PR105092]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
Hi! cp_parser_omp_iterators does: DECL_ARTIFICIAL (iter_var) = 1; DECL_CONTEXT (iter_var) = current_function_decl; pushdecl (iter_var); on the newly created iterator vars, but when we instantiate templates containing them, we just tsubst_decl them (which apparently for automatic

[PATCH] store-merging: Avoid ICEs on roughly ~0ULL/8 sized stores [PR105094]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
Hi! On the following testcase on 64-bit targets, store-merging sees a MEM_REF store from {} ctor with "negative" bitsize where bitoff + bitsize wraps around to very small end offset. This later confuses the code so that it allocates just a few bytes of memory but fills in huge amounts of it. Lat

[PATCH] ubsan: Fix ICE due to -fsanitize=object-size [PR105093]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs, because for a volatile X & RESULT_DECL ubsan wants to take address of that reference. instrument_object_size is called with x, so the base is equal to the access and the var is automatic, so there is no risk of an out of bounds access for it. Normally we wouldn't

[wwwdocs] Document zero width bit-field passing ABI changes in gcc-12/changes.html [PR104796]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
Hi! This patch documents the PR102024 ABI changes. The x86-64, ARM and AArch64 backends refer to this in their -Wpsabi diagnostics. Ok for wwwdocs? diff --git a/htdocs/gcc-12/changes.html b/htdocs/gcc-12/changes.html index 689feeba..dc0e4074 100644 --- a/htdocs/gcc-12/changes.html +++ b/htdocs/gc

Re: [wwwdocs] Document zero width bit-field passing ABI changes in gcc-12/changes.html [PR104796]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
On Wed, Mar 30, 2022 at 01:00:43PM +0200, Richard Biener wrote: > > --- a/htdocs/gcc-12/changes.html > > +++ b/htdocs/gcc-12/changes.html > > @@ -28,6 +28,31 @@ a work-in-progress. > > > > Caveats > > > > + > > +An ABI incompatibility between C and > > +C++ when passing or returning

rs6000 patch ping^2: [PATCH 8/8] rs6000: Fix some missing built-in attributes [PR104004]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
On Tue, Mar 15, 2022 at 02:18:00PM +0100, Jakub Jelinek via Gcc-patches wrote: > On Fri, Jan 28, 2022 at 11:50:26AM -0600, Bill Schmidt via Gcc-patches wrote: > > PR104004 caught some misses on my part in converting to the new built-in > > function infrastructure. In particular, I

[committed] testsuite: Change pr80334.C testcase to dg-do compile [PR102772]

2022-03-30 Thread Jakub Jelinek via Gcc-patches
Hi! The testcase has UB at runtime, placement new shouldn't construct an object with certain alignment requirements into an unaligned buffer. Discussed on IRC, tested on x86_64-linux -m32/-m64, committed to trunk. 2022-03-30 Jakub Jelinek PR tree-optimization/80334 PR target/

[PATCH] sh: Fix up __attribute__((optimize ("Os"))) handling on SH [PR105069]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
Hi! As mentioned in the PR, various tests on sh-elf ICE like: make check-gcc RUNTESTFLAGS="compile.exp='pr104327.c pr58332.c pr81360.c pr84425.c'" FAIL: gcc.c-torture/compile/pr104327.c -O0 (internal compiler error: 'global_options' are modified in local context) FAIL: gcc.c-torture/compile/p

[PATCH] testsuite: Add further zero size elt passing tests [PR102024]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
Hi! As discussed in PR102024, zero width bitfields might not be the only ones causing ABI issues at least on mips, zero size arrays or (in C only) zero sized (empty) structures can be problematic too. The following patch adds some coverage for it too. Tested on x86_64-linux with make check-gcc c

Re: [PATCH] mips: Ignore zero width bitfields in arguments and issue -Wpsabi warning about C zero-width bit-field ABI changes [PR102024]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 12:27:45AM +0800, Xi Ruoyao wrote: > --- a/gcc/config/mips/mips.cc > +++ b/gcc/config/mips/mips.cc > @@ -6042,11 +6042,26 @@ mips_function_arg (cumulative_args_t cum_v, const > function_arg_info &arg) > for (i = 0; i < info.reg_words; i++) > { >

Re: [PATCH] mips: Emit psabi diagnostic for return values affected by C++ zero-width bit-field ABI change [PR 102024]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 12:13:30AM +0800, Xi Ruoyao wrote: > --- a/gcc/config/mips/mips.cc > +++ b/gcc/config/mips/mips.cc > @@ -6274,10 +6274,17 @@ mips_callee_copies (cumulative_args_t, const > function_arg_info &arg) > > For n32 & n64, a structure with one or two fields is returned in >

[committed] contrib: Fix up spelling of loongarch-str.h dependency [PR105114]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
Hi! As found by Joseph, the dependency of gcc/config/loongarch/loongarch-str.h is spelled incorrectly, it should be gcc/config/loongarch/genopts/loongarch-strings but was using gcc/config/loongarch/genopts/loongarch-string Committed to trunk as obvious. 2022-03-31 Jakub Jelinek Jo

Re: [PATCH, OpenMP] Fix nested use_device_ptr

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 05:02:36PM +0800, Chung-Lin Tang wrote: > this patch fixes a bug in lower_omp_target, where for Fortran arrays, > the expanded sender assignment is wrongly using the variable in the > current ctx, instead of the one looked-up outside, which is causing > use_device_ptr/addr t

[PATCH] phiopt: Improve value_replacement [PR104645]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
Hi! The following patch fixes the P1 regression by reusing existing value_replacement code. That function already has code to handle simple preparation statements (casts, and +,&,|,^ binary assignments) before a final binary assignment (which can be much wider range of ops). When we have e.g.

Re: [PATCH][libgomp, testsuite, nvptx] Limit recursion in declare_target-{1,2}.f90

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 01:24:40PM +0200, Tom de Vries wrote: > Hi, > > When running testcases libgomp.fortran/examples-4/declare_target-{1,2}.f90 on > an RTX A2000 (sm_86) with driver 510.60.02 and with GOMP_NVPTX_JIT=-O0 I run > into: > ... > FAIL: libgomp.fortran/examples-4/declare_target-1.f90

Re: [PATCH v2] mips: Emit psabi diagnostic for return values affected by C++ zero-width bit-field ABI change [PR 102024]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 07:38:59PM +0800, Xi Ruoyao wrote: > v1 -> v2: > > * "int has_zero_width_bf" -> "bool has_cxx_zero_width_bf". "int" to > "bool" because the value is 0/1 only. Add "cxx" because it only > indicates C++ zero-width bit-fields (not those bit-fields from C). > > * Coding styl

Re: [PATCH v2] Ignore zero width fields in arguments and issue -Wpsabi warning about C zero-width field ABI changes [PR102024]

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 08:11:43PM +0800, Xi Ruoyao wrote: > v1 -> v2: > > * "int has_zero_width_bf_abi_change" -> "bool > zero_width_field_abi_change". "int" -> "bool" because it's only 0/1, > "bf" -> "field" because the change also affects zero-length arrays and > empty structs/unions, etc. >

Re: [PATCH][libgomp, testsuite, nvptx] Limit recursion in declare_target-{1,2}.f90

2022-04-01 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 01, 2022 at 05:34:50PM +0200, Tom de Vries wrote: > Do you perhaps have an idea why it's failing? Because you call on_device_arch_nvptx () outside of !$omp target region, so unless the host device is NVPTX, it will not be true. > +program e_53_1 > + use e_53_1_mod, only : fib, fib_wr

[PATCH] i386: Fix up ix86_expand_vector_init_general [PR105123]

2022-04-02 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase is miscompiled on ia32. The problem is that at -O0 we end up with: vector(4) short unsigned int _1; short unsigned int u.0_3; ... _1 = {u.0_3, u.0_3, u.0_3, u.0_3}; statement (dead) which is wrongly expanded. elt is (subreg:HI (reg:SI 83 [ u.0_3 ]) 0), tmp_mode SIm

[PATCH] libstdc++: Tweak source_location for clang trunk [PR105128]

2022-04-02 Thread Jakub Jelinek via Gcc-patches
Hi! Apparently clang trunk implemented __builtin_source_location(), but the using __builtin_ret_type = decltype(__builtin_source_location()); which has been added for it isn't enough, they also need the std::source_location::__impl class to be defined (but incomplete seems to be good enough) befor

Re: [PATCH] mips: Fix an ICE caused by r12-7962

2022-04-02 Thread Jakub Jelinek via Gcc-patches
On Sat, Apr 02, 2022 at 06:53:55PM +0800, Xi Ruoyao wrote: > I made a mistake in r12-7962 and it causes an ICE running g++.dg-struct- > layout-1 tests. The fix and a reduced test are included in this patch. > Ok for trunk? > > > > DECL_SIZE(x) is NULL if x is a flexible arra

[PATCH] aarch64: Fix aarch64-tune.md (re)generation [PR105144]

2022-04-04 Thread Jakub Jelinek via Gcc-patches
Hi! As I wrote in the PR, our Fedora trunk gcc builds likely after r12-7842 change are now failing (lto1 crashes). What happens is that when one bootstraps into an empty build directory (or set of them), mddeps.mk doesn't exist yet and so Makefile doesn't include it. When building from an empty d

[PATCH] aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144]

2022-04-04 Thread Jakub Jelinek via Gcc-patches
Hi! Normally updates to the source directory files are guarded with --enable-maintainer-mode, e.g. we don't regenerate configure, config.h, Makefile.in in directories that use automake etc. unless gcc is configured that way. Otherwise the source tree can't be e.g. stored on a read-only filesystem

Re: [PATCH] aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144]

2022-04-04 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 04, 2022 at 11:10:14AM +0100, Richard Sandiford wrote: > > Normally updates to the source directory files are guarded with > > --enable-maintainer-mode, e.g. we don't regenerate configure, config.h, > > Makefile.in in directories that use automake etc. unless gcc is configured > > that

Re: [PATCH][libgomp, testsuite, nvptx] Limit recursion in declare_target-{1,2}.f90

2022-04-04 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 04, 2022 at 01:05:12PM +0200, Tom de Vries wrote: > 2022-04-04 Tom de Vries > > * testsuite/libgomp.fortran/examples-4/on_device_arch.c: Copy from > parent dir. Wouldn't just ! { dg-additional-sources ../on_device_arch.c } work? Jakub

Re: [PATCH] aarch64: Restrict aarch64-tune.md regeneration to --enable-maintainer-mode [PR105144]

2022-04-04 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 04, 2022 at 12:32:27PM +0100, Richard Earnshaw via Gcc-patches wrote: > OK. Thanks, now committed. > I think we have a similar issue for arm with arm-tune.md and arm-tables.opt. > Perhaps we should adopt a similar approach for those as well. >From what I can see, both arm and c6x su

[PATCH] match.pd: Punt on optimizing sqrt with incorrect arg type [PR105150]

2022-04-05 Thread Jakub Jelinek via Gcc-patches
Hi! In the following testcase sqrt is declared as unprototyped function and so it depends on what type has the argument passed to it. If an argument of incorrect type is passed, the sqrt comparison simplification can create invalid GIMPLE. The patch fixes it by punting if there is a mismatch of t

Re: [PATCH] match.pd: Punt on optimizing sqrt with incorrect arg type [PR105150]

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Tue, Apr 05, 2022 at 10:50:01AM +0200, Richard Biener wrote: > > In the following testcase sqrt is declared as unprototyped function > > and so it depends on what type has the argument passed to it. > > If an argument of incorrect type is passed, the sqrt comparison > > simplification can create

Re: [PATCH] Fortran: Fix clause splitting for OMP masked taskloop directive

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 08:02:04PM -0600, Sandra Loosemore wrote: > I ran into this bug in the handling of clauses on the combined "masked > taskloop" OMP directive when I was working on something else. The fix > turned out to be a 1-liner. OK for trunk? > > -Sandra > commit 17c4fa0bd97c0709450

Re: [PATCH] Fortran: Add location info to OpenMP tree nodes

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 08:03:09PM -0600, Sandra Loosemore wrote: > I've got another patch forthcoming (stage 1 material) that adds some new > diagnostics for non-rectangular loops during gimplification of OMP nodes. > When I was working on that, I discovered that the Fortran front end wasn't > att

[PATCH] gimple.cc: Adjust gimple_call_builtin_p and gimple_call_combined_fn [PR105150]

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Tue, Apr 05, 2022 at 11:28:53AM +0200, Richard Biener wrote: > > In GIMPLE, we call: > > && gimple_builtin_call_types_compatible_p (stmt, fndecl) > > but that is insufficient, that verifies whether the arguments passed to > > GIMPLE_CALL match the fndecl argument types. But that fndecl may ve

Re: [PATCH] tree-optimization/105142 - wrong code with maybe_fold_{and,or}_comparisons

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Tue, Apr 05, 2022 at 03:07:53PM +0200, Richard Biener wrote: > The following avoids expanding definitions in regions conditionally > executed under the condition A when simplifying A && B or A || B. > This is done by passing down the basic-block of the outer condition > to maybe_fold_{and,or}_co

Re: [PATCH] testsuite/105122 - adjust testcases after memcpy folding changes

2022-04-05 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 04, 2022 at 09:01:40AM +0200, Richard Biener wrote: > After r12-7931 we again honor MOVE_MAX when folding memcpy to > a load/store pair. On i?86-*-* without SSE this now exposes the > change done in r12-2666-g29f0e955c97da0 which adjusts MOVE_MAX > from 16 to 4 on those targets. This

Re: [PATCH] gimple.cc: Adjust gimple_call_builtin_p and gimple_call_combined_fn [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 08:13:24AM +0200, Richard Biener wrote: > On Tue, 5 Apr 2022, Jakub Jelinek wrote: > > > On Tue, Apr 05, 2022 at 11:28:53AM +0200, Richard Biener wrote: > > > > In GIMPLE, we call: > > > > && gimple_builtin_call_types_compatible_p (stmt, fndecl) > > > > but that is insuff

[PATCH] tree.cc: Add tree_builtin_call_types_compatible_p [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
Hi! And here is the follow-up patch that does the argument checking on GENERIC. It ensures TYPE_MAIN_VARIANT == TYPE_MAIN_VARIANT compatibility on the arguments, except for pointer arguments like FILE *, const struct tm * etc. that would never match that way and similarly to the gimple one also c

Re: [PATCH] tree.cc: Add tree_builtin_call_types_compatible_p [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:49:25AM +0200, Richard Biener wrote: > On trees we'd use tree_[sign_]nop_conversion () instead of > useless_type_conversion_p, I think it's OK to allow all such > pointer conversions. In the end this probably means being > more forgiving than TYPE_MAIN_VARIANT equivalenc

[PATCH] combine, v2: Don't record for UNDO_MODE pointers into regno_reg_rtx array [PR104985]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Tue, Apr 05, 2022 at 04:56:55PM -0500, Segher Boessenkool wrote: > > Or there are variant patches in the PR, either a minimal version of > > this patch, or one that records regno and adjusts all SUBST_MODE uses. > > I like this one best I think :-) > > > Also, not sure I like very much a funct

Re: [PATCH] gimple.cc: Adjust gimple_call_builtin_p and gimple_call_combined_fn [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:41:44AM +0100, Richard Sandiford wrote: > But it seems like the magic incantation to detect “real” built-in > function calls is getting longer and longer. Can we not abstract this > in a single place rather than have to repeat the same long sequence in > multiple places?

Re: libgomp testsuite: Don't amend 'LD_LIBRARY_PATH' for system-provided HSA Runtime library (was: [PATCH 1/4] Remove build dependence on HSA run-time)

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 11:20:47AM +0200, Thomas Schwinge wrote: > However, the libgomp GCN plugin is unconditionally built against the > GCC-shipped 'include/hsa*.h' header files, and at run time does > 'dlopen("libhsa-runtime64.so.1")', so there is no system-provided HSA Runtime > library "used f

Re: [PATCH] gimple.cc: Adjust gimple_call_builtin_p and gimple_call_combined_fn [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 11:52:23AM +0200, Richard Biener wrote: > On Wed, 6 Apr 2022, Jakub Jelinek wrote: > > > On Wed, Apr 06, 2022 at 09:41:44AM +0100, Richard Sandiford wrote: > > > But it seems like the magic incantation to detect “real” built-in > > > function calls is getting longer and lon

Re: Move 'libgomp/plugin/cuda/cuda.h' to 'include/cuda/cuda.h' (was: [PATCH] Allow building GCC with PTX offloading even without CUDA being installed (gcc and nvptx-tools patches))

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 02:39:18PM +0200, Thomas Schwinge wrote: > ... so that it may be used by other projects that inherit GCC's 'include' > directory. > > include/ > * cuda/cuda.h: New file. > libgomp/ > * plugin/cuda/cuda.h: Remove file. > * plugin/plugin-nvptx.c

Re: [PATCH] mips: Fix C++14 vs. C++17 ABI incompatibility on mips64

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 08:33:40PM +0800, Xi Ruoyao via Gcc-patches wrote: > Another MIPS function return ABI fix. Ok for trunk? > > -- > > This fixes tmpdir-g++.dg-struct-layout-1/{t032,t059} failure. Clang++ > ignores C++17 empty bases in return values as well. > > gcc/ > * config/mips

Re: [PATCH v2] mips: Fix C++14 vs. C++17 ABI incompatibility on mips64

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:44:33PM +0800, Xi Ruoyao wrote: > @@ -6527,6 +6554,27 @@ mips_function_value_1 (const_tree valtype, const_tree > fn_decl_or_type, >if (has_cxx_zero_width_bf) > use_fpr = 0; > > + if (TARGET_HARD_FLOAT > + && warn_psabi > + && use_fpr != 0

[PATCH] c++: Handle __builtin_clear_padding on non-trivially-copyable types [PR102586]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Fri, Feb 11, 2022 at 07:55:50PM +0100, Jakub Jelinek via Gcc-patches wrote: > Something like the https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586#c16 > will still be needed with adjusted testcase from > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102586#c15

Ping Re: [PATCH] c++: Fix up ICE when cplus_decl_attributes is called with error_mark_node attributes [PR104668]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Fri, Mar 25, 2022 at 07:55:56PM +0100, Jakub Jelinek via Gcc-patches wrote: > On Fri, Mar 25, 2022 at 07:48:33PM +0100, Jakub Jelinek wrote: > > We then wouldn't propagate TREE_DEPRECATED/TREE_UNAVAILABLE from templates > > to their instantiations and wouldn't diagno

[PATCH] tree.cc, v2: Add tree_builtin_call_types_compatible_p [PR105150]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:49:25AM +0200, Richard Biener wrote: > On trees we'd use tree_[sign_]nop_conversion () instead of > useless_type_conversion_p, I think it's OK to allow all such > pointer conversions. In the end this probably means being > more forgiving than TYPE_MAIN_VARIANT equivalenc

Re: [PATCH] c++: Fix up ICE when cplus_decl_attributes is called with error_mark_node attributes [PR104668]

2022-04-06 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 11:18:32AM -0400, Jason Merrill wrote: > > Why not check at the beginning of the function? > > You just pinged this patch, but I haven't seen a response to this question. I thought the https://gcc.gnu.org/pipermail/gcc-patches/2022-March/592368.html is the response to that

Re: [PATCH] rs6000: Guard bifs {un, }pack_{longdouble, ibm128} under hard float [PR103623]

2022-04-07 Thread Jakub Jelinek via Gcc-patches
On Thu, Apr 07, 2022 at 06:09:52AM -0500, Segher Boessenkool wrote: > Hi! > > On Thu, Mar 03, 2022 at 10:11:32AM +0800, Kewen.Lin wrote: > > As PR103623 shows, it's a regression failure due to new built-in > > function framework, previously we guard __builtin_{un,}pack_{longdouble, > > ibm128} bui

[PATCH] fold-const: Fix up make_range_step [PR105189]

2022-04-07 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase is miscompiled, because fold_truth_andor incorrectly folds (unsigned) foo () >= 0U && 1 into foo () >= 0 For the unsigned comparison (which is useless in this case, as >= 0U is always true, but hasn't been folded yet), previous make_range_step derives exp (unsigned) foo

[PATCH] c: Error on va_arg with function type [PR105149]

2022-04-07 Thread Jakub Jelinek via Gcc-patches
Hi! In the PR Joseph said that the C standard for va_arg talks about pointers to object type and as a function type is not object type, it is invalid. The following patch diagnoses it in the FE, instead of ICEing later on when optimizations are turned on (and with -O0 doing something weird at run

[PATCH] c-family: Initialize ridpointers for __int128 etc. [PR105186]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs with C++ and is incorrectly rejected with C. The reason is that both FEs use ridpointers identifiers for CPP_KEYWORD and value or u.value for CPP_NAME e.g. when parsing attributes or OpenMP directives etc., like: /* Save away the identifier that indicates w

[committed] testsuite: Fix up 20050113-1.c test for i686-linux [PR105187]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 06, 2022 at 09:26:56PM -0400, Jason Merrill via Gcc-patches wrote: > gcc/testsuite/ChangeLog: > > * gcc.c-torture/compile/20050113-1.c: Moved to... > * c-c++-common/torture/20050113-1.c: ...here. The test FAILs on i686-linux if neither MMX isn't enabled, can be also reprod

Re: [PATCH v2] rs6000: Guard bifs {un,}pack_{longdouble,ibm128} under hard float [PR103623]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
On Fri, Apr 08, 2022 at 03:09:00PM +0800, Kewen.Lin wrote: > + /* Let's ignore all error messages about built-in function > + unsupported due to soft-float, since they are not test > + points here (this case is to check no ICE). */ > + /* { dg-error ".*" "pr103623" { target *-*-* } .-19

[PATCH] phiopt: Optimize (x != cst1 ? x : cst2) != cst3 [PR104639]

2022-04-08 Thread Jakub Jelinek via Gcc-patches
Hi! Here is an attempt to resolve a P1 regression, where due to threading changes we no longer optimize bool foo(int i) { while (i == 4) i += 2; return i; } to just return i != 0; by enhancing the phiopt value_replacement optimization. Normally it will optimize x != cst1 ? x : cst

[PATCH] builtins: Fix up expand_builtin_int_roundingfn_2 [PR105211]

2022-04-11 Thread Jakub Jelinek via Gcc-patches
Hi! The expansion of __builtin_iround{,f,l} etc. builtins in some cases emits calls to a different fallback builtin. To locate the right builtin it uses mathfn_built_in_1 with the type of the first argument. If its TYPE_MAIN_VARIANT is {float,double,long_double}_type_node, all is fine, but on the

[PATCH] i386: Fix ICE caused by ix86_emit_i387_log1p [PR105214]

2022-04-11 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs, because ix86_emit_i387_log1p attempts to emit something like if (cond) some_code1; else some_code2; and emits a conditional jump using emit_jump_insn (standard way in the file) and an unconditional jump using emit_jump. The problem with that is that if

[PATCH] i386: i386-expand formatting fixes

2022-04-11 Thread Jakub Jelinek via Gcc-patches
Hi! While working on the PR105214 patch, I've noticed incorrect formatting for a bunch of functions where the function names aren't at the start of lines. The following patch fixes it, though of course it isn't a regression. Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk or

[PATCH] phiopt: Fix up debug handling in the (x != cst1 ? x : cst2) != cst3 opt [PR105218]

2022-04-11 Thread Jakub Jelinek via Gcc-patches
Hi! In the PR104639 optimization, I've added code to emit # DEBUG D#1 => arg != carg ? arg : oarg instruction and replace debug uses of the phi with that debug temp, so that the debug info is still accurrate. Unfortunately, that is only correct if the middle-bb and phi bb contain 1 and 2 predece

Re: Avoid overflow in ipa-modref-tree.cc

2022-04-12 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 11, 2022 at 12:44:32AM +0200, Jan Hubicka via Gcc-patches wrote: > Hi, > the testcase triggers ICE since computation overflows on two accesses > that are very far away d->b[-144115188075855873] and d->b[144678138029277184]. > This patch makes the relevant part of modref to use poly_offs

[committed] scev: Fix a comment typo

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! When looking at the kernel __popcountdi2 issue, I've noticed a comment typo. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk as obvious. 2022-04-13 Jakub Jelinek * tree-scalar-evolution.cc (expression_expensive_p): Fix a comment typo. --- gcc/tree-scala

[committed] libgomp: Fix a documentation typo

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! This fixes a typo in the 5.0 feature support table. Bootstrapped/regtested on x86_64-linux and i686-linux, committed to trunk. 2022-04-13 Jakub Jelinek * libgomp.texi: Fix a typo - mutexinouset -> mutexinoutset. --- libgomp/libgomp.texi.jj 2022-03-14 10:34:34.444919906 +0100

[PATCH] attribs: Restrict decl_attributes DECL_FUNCTION_SPECIFIC_TARGET changes to targets that care about target attributes/pragmas [PR105234]

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! The following code is rejected e.g. on mips64el-linux (but I think many other targets which don't support target attribute or pragma). The problem is that the change to decl_attributes below is done unconditionally and with just #pragma GCC push_options/pop_options pair we have target_option_d

[PATCH] c++: Treat alignas align_expr and aligned attribute's operand as manifestly constant evaluation [PR105233]

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase fails, because we only constant evaluate the alignas argument as non-manifestly constant-evaluated and as __builtin_is_constant_evaluated appears, we make it non-constant (the reason is that we often try to evaluate some expression without manifestly_const_eval perhaps e

[PATCH] tree.cc: Use useless_type_conversion_p in tree_builtin_call_types_compatible_p while in gimple form [PR105253]

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! tree_builtin_call_types_compatible_p uses TYPE_MAIN_VARIANT comparisons or tree_nop_conversion_p to ensure a builtin has correct GENERIC arguments. Unfortunately this regressed when get_call_combined_fn is called during GIMPLE optimizations. E.g. when number_of_iterations_popcount is called,

[PATCH] simplify-rtx: Don't assume shift count has the same mode as the shift [PR105247]

2022-04-13 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs on ia64. It is UB at runtime, but we shouldn't ICE on it... The problem is that on ia64, the shift count (last operand of ASHIFT etc.) is promoted to DImode (using zero-extension), while most other targets use much narrower modes (say QImode). If we try to simplif

Re: [Patch] OpenMP/Fortran: Fix EXIT in loop diagnostic [PR105242]

2022-04-13 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 13, 2022 at 05:16:48PM +0200, Tobias Burnus wrote: > Trivial fix – after finding the issue. The LOOP directive and > several LOOP/DO/SIMD combined directives were missing in the > check. As the PR shows, this leads to an ICE on invalid code. > > OK? > > Tobias > - > Si

[PATCH] c++: Fix up CONSTRUCTOR_PLACEHOLDER_BOUNDARY handling [PR105256]

2022-04-15 Thread Jakub Jelinek via Gcc-patches
Hi! The CONSTRUCTOR_PLACEHOLDER_BOUNDARY bit is supposed to separate PLACEHOLDER_EXPRs that should be replaced by one object or subobjects of it (variable, TARGET_EXPR slot, ...) from other PLACEHOLDER_EXPRs that should be replaced by different objects or subobjects. The bit is set when finding PL

Re: [PATCH] c++: Fix up CONSTRUCTOR_PLACEHOLDER_BOUNDARY handling [PR105256]

2022-04-19 Thread Jakub Jelinek via Gcc-patches
On Mon, Apr 18, 2022 at 09:57:12AM -0400, Patrick Palka wrote: > > Hmm, Patrick made a similar change and then reverted it for PR90996. > > But it makes sense to me; when we replace placeholders, it's appropriate > > to look at the whole aggregate initialization rather than the innermost > > CONSTR

[committed] sparc: Preserve ORIGINAL_REGNO in epilogue_renumber [PR105257]

2022-04-19 Thread Jakub Jelinek via Gcc-patches
Hi! The following testcase ICEs, because the pic register is (reg:DI 24 %i0 [109]) and is used in the delay slot of a return. We invoke epilogue_renumber and that changes it to (reg:DI 8 %o0) which no longer satisfies sparc_pic_register_p predicate, so we don't recognize the insn anymore. The fol

[PATCH] cgraph: Fix up semantic_interposition handling [PR105306]

2022-04-19 Thread Jakub Jelinek via Gcc-patches
Hi! cgraph_node has a semantic_interposition flag which should mirror opt_for_fn (decl, flag_semantic_interposition). But it actually is initialized not from that, but from flag_semantic_interposition in the explicit symtab_node (symtab_type t) : type (t), resolution (LDPR_UNKNOWN), definit

Re: [PATCH] cgraph: Fix up semantic_interposition handling [PR105306]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 20, 2022 at 10:45:53AM +0200, Jan Hubicka wrote: > So this change should be unnecessary unless there are nodes that are > missing finalization stage. It also is not good enough since frontends > may change opt_for_fn between node creation and finalization of > compilation unit (so even

Re: [PATCH] cgraph: Fix up semantic_interposition handling [PR105306]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 20, 2022 at 11:06:12AM +0200, Jan Hubicka wrote: > > On Wed, Apr 20, 2022 at 10:45:53AM +0200, Jan Hubicka wrote: > > > So this change should be unnecessary unless there are nodes that are > > > missing finalization stage. It also is not good enough since frontends > > > may change opt

Re: [PATCH] cgraph: Fix up semantic_interposition handling [PR105306]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
On Wed, Apr 20, 2022 at 01:47:43PM +0200, Martin Jambor wrote: > Hi, > > On Wed, Apr 20 2022, Jan Hubicka via Gcc-patches wrote: > >> On Wed, 20 Apr 2022, Jakub Jelinek wrote: > > [...] > > >> > > >> >if ((flag_openacc || flag_openmp) > >> >&& lookup_attribute ("omp declare target"

[PATCH] emit-rtl: Fix -fcompare-debug bug with label references in debug insns [PR105203]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
Hi! When we compute LABEL_NUSES from scratch, mark_all_labels doesn't call mark_jump_label on DEBUG_INSNs: if (NONDEBUG_INSN_P (insn)) mark_jump_label (PATTERN (insn), insn, 0); and so doesn't increment LABEL_NUSES from references in DEBUG_INSNs. But, when we call emi

[PATCH] fortran: Fix up gfc_trans_oacc_construct [PR104717]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
Hi! So that move_sese_region_to_fn works properly, OpenMP/OpenACC constructs for which that function is invoked need an extra artificial BIND_EXPR around their body so that we move all variables of the bodies. The C/C++ FEs do that both for OpenMP constructs like OMP_PARALLEL, OMP_TASK or OMP_TAR

[PATCH] opts: Disable -gstatement-frontiers by default [PR103788]

2022-04-20 Thread Jakub Jelinek via Gcc-patches
Hi! As mentioned in those PRs and I think in others too, there are some long time unresolved -fcompare-debug issues with DEBUG_BEGIN_STMTs in the FEs and during gimplification, especially with statement expressions, where we end up with different code generation depending on whether there are DEBU

Re: [PATCH v2] c++: wrong error with constexpr COMPOUND_EXPR [PR105321]

2022-04-21 Thread Jakub Jelinek via Gcc-patches
On Thu, Apr 21, 2022 at 09:20:48AM -0400, Marek Polacek via Gcc-patches wrote: > --- a/gcc/cp/constexpr.cc > +++ b/gcc/cp/constexpr.cc > @@ -4566,19 +4566,18 @@ cxx_eval_bit_cast (const constexpr_ctx *ctx, tree t, > bool *non_constant_p, > static tree > cxx_eval_logical_expression (const constex

[PATCH] i386: Fix up ix86_gimplify_va_arg [PR105331]

2022-04-22 Thread Jakub Jelinek via Gcc-patches
Hi! On the following testcase we emit a bogus 'va_arg_tmp.5' may be used uninitialized warning. The reason is that when gimplifying the addr = &temp; statement, the va_arg_tmp temporary var for which we emit ADDR_EXPR is not TREE_ADDRESSABLE, prepare_gimple_addressable emits some extra code to in

<    6   7   8   9   10   11   12   13   14   15   >