]> gcc.gnu.org Git - gcc.git/log
gcc.git
19 months agolibiberty: Fix C89-isms in configure tests
Florian Weimer [Tue, 18 Oct 2022 14:58:48 +0000 (16:58 +0200)]
libiberty: Fix C89-isms in configure tests

libiberty/

* acinclude.m4 (ac_cv_func_strncmp_works): Add missing
int return type and parameter list to the definition of main.
Include <stdlib.h> and <string.h> for prototypes.
(ac_cv_c_stack_direction): Add missing
int return type and parameter list to the definitions of
main, find_stack_direction.  Include <stdlib.h> for exit
prototype.
* configure: Regenerate.

(cherry picked from commit 885b6660c17fb91980b5682514ef54668e544b02)

19 months agolibsanitizer: Avoid implicit function declaration in configure test
Florian Weimer [Wed, 4 Jan 2023 10:13:17 +0000 (11:13 +0100)]
libsanitizer: Avoid implicit function declaration in configure test

libsanitizer/

* configure.ac (sanitizer_supported): Include <unistd.h> for
syscall prototype.
* configure: Regenerate.

(cherry picked from commit 6be2672e4ee41c566a9e072088cccca263bab5f7)

19 months agoDaily bump.
GCC Administrator [Wed, 4 Jan 2023 00:19:28 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Tue, 3 Jan 2023 00:19:51 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Mon, 2 Jan 2023 00:19:27 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Sun, 1 Jan 2023 00:19:58 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Sat, 31 Dec 2022 00:19:34 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Fri, 30 Dec 2022 00:19:27 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Thu, 29 Dec 2022 00:20:07 +0000 (00:20 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Wed, 28 Dec 2022 00:19:33 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Tue, 27 Dec 2022 00:19:32 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Mon, 26 Dec 2022 00:19:41 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Sun, 25 Dec 2022 00:19:21 +0000 (00:19 +0000)]
Daily bump.

19 months agoSkip guality tests on hppa-hpux.
John David Anglin [Sun, 13 Nov 2022 17:04:44 +0000 (17:04 +0000)]
Skip guality tests on hppa-hpux.

The guality check command hangs. This causes TCL errors in
other tests and slows testsuite execution.

2022-11-13  John David Anglin  <danglin@gcc.gnu.org>

gcc/testsuite/ChangeLog:

* g++.dg/guality/guality.exp: Skip on hppa*-*-hpux*.
* gcc.dg/guality/guality.exp: Likewise.
* gfortran.dg/guality/guality.exp: Likewise.

19 months agoDaily bump.
GCC Administrator [Sat, 24 Dec 2022 00:20:02 +0000 (00:20 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Fri, 23 Dec 2022 00:21:52 +0000 (00:21 +0000)]
Daily bump.

19 months agolibstdc++: Fix unsafe use of dirent::d_name [PR107814]
Jonathan Wakely [Tue, 22 Nov 2022 19:15:53 +0000 (19:15 +0000)]
libstdc++: Fix unsafe use of dirent::d_name [PR107814]

Copy the fix for PR 104731 to the equivalent experimental::filesystem
test.

libstdc++-v3/ChangeLog:

PR libstdc++/107814
* testsuite/experimental/filesystem/iterators/error_reporting.cc:
Use a static buffer with space after it.

(cherry picked from commit 1cac00d013856fea4cee0f13c4959c8e21afd2d9)

19 months agolto: support --jobserver-style=fifo for recent GNU make
Martin Liska [Tue, 9 Aug 2022 11:59:36 +0000 (13:59 +0200)]
lto: support --jobserver-style=fifo for recent GNU make

gcc/ChangeLog:

* opts-jobserver.h: Add one member.
* opts-common.c (jobserver_info::jobserver_info): Parse FIFO
format of --jobserver-auth.

(cherry picked from commit 53e3b2bf16a486c15c20991c6095f7be09012b55)

19 months agoFactor out jobserver_active_p.
Martin Liska [Tue, 9 Aug 2022 11:59:32 +0000 (13:59 +0200)]
Factor out jobserver_active_p.

gcc/ChangeLog:

* gcc.c (driver::detect_jobserver): Remove and move to
jobserver.h.
* lto-wrapper.c (jobserver_active_p): Likewise.
(run_gcc): Likewise.
* opts-jobserver.h: New file.
* opts-common.c (jobserver_info::jobserver_info): New function.

(cherry picked from commit 1270ccda70ca09f7d4fe76b5156dca8992bd77a6)

19 months agoDaily bump.
GCC Administrator [Thu, 22 Dec 2022 00:19:57 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Wed, 21 Dec 2022 00:19:28 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Tue, 20 Dec 2022 00:19:44 +0000 (00:19 +0000)]
Daily bump.

19 months agoDaily bump.
GCC Administrator [Mon, 19 Dec 2022 00:20:57 +0000 (00:20 +0000)]
Daily bump.

19 months agoFortran: ICE on recursive derived types with allocatable components [PR107872]
Paul Thomas [Fri, 9 Dec 2022 21:13:45 +0000 (22:13 +0100)]
Fortran: ICE on recursive derived types with allocatable components [PR107872]

gcc/fortran/ChangeLog:

PR fortran/107872
* resolve.c (derived_inaccessible): Skip over allocatable components
to prevent an infinite loop.

gcc/testsuite/ChangeLog:

PR fortran/107872
* gfortran.dg/pr107872.f90: New test.

(cherry picked from commit 01254aa2eb766c7584fd047568d7277d4d65d067)

20 months agoDaily bump.
GCC Administrator [Sun, 18 Dec 2022 00:19:45 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sat, 17 Dec 2022 00:20:33 +0000 (00:20 +0000)]
Daily bump.

20 months agoc++: quadratic constexpr behavior for left-assoc logical exprs [PR102780]
Patrick Palka [Thu, 28 Oct 2021 14:05:14 +0000 (10:05 -0400)]
c++: quadratic constexpr behavior for left-assoc logical exprs [PR102780]

In the testcase below the two left fold expressions each expand into a
constant logical expression with 1024 terms, for which potential_const_expr
takes more than a minute to return true.  This happens because p_c_e_1
performs trial evaluation of the first operand of a &&/|| in order to
determine whether to consider the potentiality of the second operand.
And because the expanded expression is left-associated, this trial
evaluation causes p_c_e_1 to be quadratic in the number of terms of the
expression.

This patch fixes this quadratic behavior by making p_c_e_1 preemptively
compute potentiality of the second operand of a &&/||, and perform trial
evaluation of the first operand only if the second operand isn't
potentially constant.  We must be careful to avoid emitting bogus
diagnostics during the preemptive computation; to that end, we perform
this shortcut only when tf_error is cleared, and when tf_error is set we
now first check potentiality of the whole expression quietly and replay
the check noisily for diagnostics.

Apart from fixing the quadraticness for left-associated logical exprs,
this change also reduces compile time for the libstdc++ testcase
20_util/variant/87619.cc by about 15% even though our <variant> uses
right folds instead of left folds.  Likewise for the testcase in the PR,
for which compile time is reduced by 30%.  The reason for these speedups
is that p_c_e_1 no longer performs expensive trial evaluation of each term
of large constant logical expressions when determining their potentiality.

PR c++/102780
PR c++/108138

gcc/cp/ChangeLog:

* constexpr.c (potential_constant_expression_1) <case TRUTH_*_EXPR>:
When tf_error isn't set, preemptively check potentiality of the
second operand before performing trial evaluation of the first
operand.
(potential_constant_expression_1): When tf_error is set, first check
potentiality quietly and return true if successful, otherwise
proceed noisily to give errors.

gcc/testsuite/ChangeLog:

* g++.dg/cpp1z/fold13.C: New test.

(cherry picked from commit 9927ecbb42d5be48fa933adc26f8601fab5007ca)

20 months agoDaily bump.
GCC Administrator [Fri, 16 Dec 2022 00:20:21 +0000 (00:20 +0000)]
Daily bump.

20 months agoAArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]
Sebastian Pop [Wed, 30 Nov 2022 19:45:24 +0000 (19:45 +0000)]
AArch64: Add UNSPECV_PATCHABLE_AREA [PR98776]

Currently patchable area is at the wrong place on AArch64.  It is placed
immediately after function label, before .cfi_startproc.  This patch
adds UNSPECV_PATCHABLE_AREA for pseudo patchable area instruction and
modifies aarch64_print_patchable_function_entry to avoid placing
patchable area before .cfi_startproc.

gcc/
PR target/98776
* config/aarch64/aarch64-protos.h (aarch64_output_patchable_area):
Declared.
* config/aarch64/aarch64.c (aarch64_print_patchable_function_entry):
Emit an UNSPECV_PATCHABLE_AREA pseudo instruction.
(aarch64_output_patchable_area): New.
* config/aarch64/aarch64.md (UNSPECV_PATCHABLE_AREA): New.
(patchable_area): Define.

gcc/testsuite/
PR target/98776
* gcc.target/aarch64/pr98776.c: New.
* gcc.target/aarch64/pr92424-2.c: Adjust pattern.
* gcc.target/aarch64/pr92424-3.c: Adjust pattern.

20 months agoDaily bump.
GCC Administrator [Thu, 15 Dec 2022 00:19:56 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Wed, 14 Dec 2022 00:21:20 +0000 (00:21 +0000)]
Daily bump.

20 months agolibphobos: Backport library and bindings fixes from mainline
Iain Buclaw [Tue, 13 Dec 2022 22:46:39 +0000 (23:46 +0100)]
libphobos: Backport library and bindings fixes from mainline

D Runtime changes:

- Fix MIPS64 bindings for CRuntime_UClibc.

Phobos changes:

- Fix std.path.expandTilde erroneously raising onOutOfMemory
  after failed call to getpwnam_r().
- Use GENERIC_IO on CRuntime_UClibc port of std.stdio.

libphobos/ChangeLog:

* libdruntime/core/stdc/fenv.d: Compile in MIPS uClibc bindings on
MIPS_Any targets.
* libdruntime/core/stdc/math.d: Likewise.
* libdruntime/core/sys/posix/dlfcn.d: Likewise.
* libdruntime/core/sys/posix/setjmp.d: Add MIPS64 definitions for
CRuntime_UClibc.
* libdruntime/core/sys/posix/sys/types.d: Likewise.
* src/std/path.d (expandTilde): Handle more errno codes that could be
left set by getpwnam_r.
* src/std/stdio.d: Set CRuntime_UClibc as GENERIC_IO target.

20 months agoDaily bump.
GCC Administrator [Tue, 13 Dec 2022 00:20:28 +0000 (00:20 +0000)]
Daily bump.

20 months agotree-optimization/107107 - tail-merging VN wrong-code
Richard Biener [Thu, 6 Oct 2022 09:20:16 +0000 (11:20 +0200)]
tree-optimization/107107 - tail-merging VN wrong-code

The following fixes an unintended(?) side-effect of the special
MODIFY_EXPR expression entries we add for tail-merging during VN.
We shouldn't value-number the virtual operand differently here.

PR tree-optimization/107107
* tree-ssa-sccvn.c (visit_reference_op_store): Do not
affect value-numbering when doing the tail merging
MODIFY_EXPR lookup.

* gcc.dg/pr107107.c: New testcase.

(cherry picked from commit 85333b9265720fc4e49397301cb16324d2b89aa7)

20 months agoDaily bump.
GCC Administrator [Mon, 12 Dec 2022 00:26:03 +0000 (00:26 +0000)]
Daily bump.

20 months agod: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050)
Iain Buclaw [Sat, 10 Dec 2022 18:12:43 +0000 (19:12 +0100)]
d: Fix internal compiler error: in visit, at d/imports.cc:72 (PR108050)

The visitor for lowering IMPORTED_DECLs did not have an override for
dealing with importing OverloadSet symbols.  This has now been
implemented in the code generator.

PR d/108050

gcc/d/ChangeLog:

* decl.cc (DeclVisitor::visit (Import *)): Handle build_import_decl
returning a TREE_LIST.
* imports.cc (ImportVisitor::visit (OverloadSet *)): New override.

gcc/testsuite/ChangeLog:

* gdc.dg/imports/pr108050/mod1.d: New.
* gdc.dg/imports/pr108050/mod2.d: New.
* gdc.dg/imports/pr108050/package.d: New.
* gdc.dg/pr108050.d: New test.

(cherry picked from commit d9d8c9674ad3ad3aa38419d24b1aaaffe31f5d3f)

20 months agoDaily bump.
GCC Administrator [Sun, 11 Dec 2022 00:20:29 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sat, 10 Dec 2022 00:20:26 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Fri, 9 Dec 2022 00:21:32 +0000 (00:21 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Thu, 8 Dec 2022 00:20:18 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Wed, 7 Dec 2022 00:21:08 +0000 (00:21 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Tue, 6 Dec 2022 00:20:17 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Mon, 5 Dec 2022 00:20:30 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sun, 4 Dec 2022 00:19:33 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sat, 3 Dec 2022 00:20:09 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Fri, 2 Dec 2022 00:20:41 +0000 (00:20 +0000)]
Daily bump.

20 months agoFix unrecognizable insn due to illegal immediate_operand (const_int 255) of QImode.
liuhongt [Mon, 28 Nov 2022 01:59:47 +0000 (09:59 +0800)]
Fix unrecognizable insn due to illegal immediate_operand (const_int 255) of QImode.

For __builtin_ia32_vec_set_v16qi (a, -1, 2) with
!flag_signed_char. it's transformed to
__builtin_ia32_vec_set_v16qi (_4, 255, 2) in the gimple,
and expanded to (const_int 255) in the rtl. But for immediate_operand,
it expects (const_int 255) to be signed extended to
(const_int -1). The mismatch caused an unrecognizable insn error.

The patch converts (const_int 255) to (const_int -1) in the backend
expander.

gcc/ChangeLog:

PR target/107863
* config/i386/i386-expand.c (ix86_expand_vec_set_builtin):
Convert op1 to target mode whenever mode mismatch.

gcc/testsuite/ChangeLog:

* gcc.target/i386/pr107863.c: New test.

20 months agoDaily bump.
GCC Administrator [Thu, 1 Dec 2022 00:20:13 +0000 (00:20 +0000)]
Daily bump.

20 months agod: Fix ICE on named continue label in an unrolled loop [PR107592]
Iain Buclaw [Fri, 11 Nov 2022 23:54:47 +0000 (00:54 +0100)]
d: Fix ICE on named continue label in an unrolled loop [PR107592]

Continue labels in an unrolled loop require a unique label per
iteration.  Previously this used the Statement body node for each
unrolled iteration to generate a new entry in the label hash table.
This does not work when the continue label has an identifier, as said
named label is pointing to the outer UnrolledLoopStatement node.

What would happen is that during the lowering of `continue label', an
automatic label associated with the unrolled loop would be generated,
and a jump to that label inserted, but because it was never pushed by
the visitor for the loop itself, it subsequently never gets emitted.

To fix, correctly use the UnrolledLoopStatement as the key to look up
and store the break/continue label pair, but remove the continue label
from the value entry after every loop to force a new label to be
generated by the next call to `push_continue_label'

PR d/107592

gcc/d/ChangeLog:

* toir.cc (IRVisitor::push_unrolled_continue_label): New method.
(IRVisitor::pop_unrolled_continue_label): New method.
(IRVisitor::visit (UnrolledLoopStatement *)): Use them instead of
push_continue_label and pop_continue_label.

gcc/testsuite/ChangeLog:

* gdc.dg/pr107592.d: New test.

(cherry picked from commit 031d3f095520f0e1ee03e29b7ad5067c2a3f96e0)

20 months agoFix addvdi3 and subvdi3 patterns
John David Anglin [Wed, 30 Nov 2022 18:40:10 +0000 (18:40 +0000)]
Fix addvdi3 and subvdi3 patterns

While most PA 2.0 instructions support both 32 and 64-bit traps
and conditions, the addi and subi instructions only support 32-bit
traps and conditions. Thus, we need to force immediate operands
to register operands on the 64-bit target and use the add/sub
instructions which can trap on 64-bit signed overflow.

2022-11-30  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

* config/pa/pa.md (addvdi3): Force operand 2 to a register.
Remove "addi,tsv,*" instruction from unamed pattern.
(subvdi3): Force operand 1 to a register.
Remove "subi,tsv" instruction from from unamed pattern.

20 months agoDaily bump.
GCC Administrator [Wed, 30 Nov 2022 00:20:30 +0000 (00:20 +0000)]
Daily bump.

20 months agogcc: fix PR rtl-optimization/107482
Max Filippov [Mon, 7 Nov 2022 21:58:49 +0000 (13:58 -0800)]
gcc: fix PR rtl-optimization/107482

gcc/
PR rtl-optimization/107482
* ira-color.c (assign_hard_reg): Only call
update_costs_from_copies when retry_p is false.

(cherry picked from commit e581490f0cfa80c58d2b648d71a44a597fbe3008)

20 months agoDaily bump.
GCC Administrator [Tue, 29 Nov 2022 00:20:53 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Mon, 28 Nov 2022 00:19:21 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sun, 27 Nov 2022 00:19:11 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Sat, 26 Nov 2022 00:19:33 +0000 (00:19 +0000)]
Daily bump.

20 months agoFortran: reject NULL actual argument without explicit interface [PR107576]
Harald Anlauf [Thu, 17 Nov 2022 20:36:49 +0000 (21:36 +0100)]
Fortran: reject NULL actual argument without explicit interface [PR107576]

gcc/fortran/ChangeLog:

PR fortran/107576
* interface.c (gfc_procedure_use): Reject NULL as actual argument
when there is no explicit procedure interface.

gcc/testsuite/ChangeLog:

PR fortran/107576
* gfortran.dg/null_actual_3.f90: New test.

(cherry picked from commit 820c25c83561085f54268bd536f9d216d03c3e18)

20 months agoDaily bump.
GCC Administrator [Fri, 25 Nov 2022 10:05:53 +0000 (10:05 +0000)]
Daily bump.

20 months agoFix thinko in operator_bitwise_xor::op1_range
Eric Botcazou [Fri, 25 Nov 2022 09:49:20 +0000 (10:49 +0100)]
Fix thinko in operator_bitwise_xor::op1_range

There is a thinko in the op1_range method of ranger's operator_bitwise_xor
class in a boolean context: if the result is known to be true, it may infer
that a specific operand is false without any basis.

gcc/
* range-op.cc (operator_bitwise_xor::op1_range): Fix thinko.

gcc/testsuite/
* gnat.dg/opt100.adb: New test.
* gnat.dg/opt100_pkg.adb, gnat.dg/opt100_pkg.ads: New helper.

20 months agoFix wrong array type conversion with different storage orde
Eric Botcazou [Tue, 22 Nov 2022 18:03:49 +0000 (19:03 +0100)]
Fix wrong array type conversion with different storage orde

When two arrays of scalars have a different storage order in Ada, the
front-end makes sure that the conversion is performed component-wise
so that each component can be reversed.  So it's a little bit counter
productive that the ldist pass performs the opposite transformation
and synthesizes a memcpy/memmove in this case.

gcc/
* tree-loop-distribution.c (loop_distribution::classify_builtin_ldst):
Bail out if source and destination do not have the same storage order.

gcc/testsuite/
* gnat.dg/sso18.adb: New test.

20 months agoDaily bump.
GCC Administrator [Thu, 24 Nov 2022 00:20:18 +0000 (00:20 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Wed, 23 Nov 2022 00:19:44 +0000 (00:19 +0000)]
Daily bump.

20 months agoDaily bump.
GCC Administrator [Tue, 22 Nov 2022 00:20:21 +0000 (00:20 +0000)]
Daily bump.

20 months agoi386: Uglify some local identifiers in *intrin.h [PR107748]
Jakub Jelinek [Mon, 21 Nov 2022 09:28:27 +0000 (10:28 +0100)]
i386: Uglify some local identifiers in *intrin.h [PR107748]

While reporting PR107748 (where is a problem with non-uglified names,
but I've left it out because it needs fixing anyway), I've noticed
various spots where identifiers in *intrin.h headers weren't uglified.
The following patch fixed those that are related to unions (I've grepped
for [a-zA-Z]\.[a-zA-Z] spots).
The reason we need those to be uglified is the same as why the arguments
of the inlines are __ prefixed and most of automatic vars in the inlines
- say a, v or u aren't part of implementation namespace and so users could
 #define u whatever->something
 #include <x86intrin.h>
and it should still work, as long as u is not e.g. one of the names
of the functions/macros the header provides (_mm* etc.).

2022-11-21  Jakub Jelinek  <jakub@redhat.com>

PR target/107748
* config/i386/smmintrin.h (_mm_extract_ps): Uglify names of local
variables and union members.

(cherry picked from commit ec8ec09f9414be871e322fecf4ebf53e3687bd22)

20 months agoreg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]
Jakub Jelinek [Sun, 20 Nov 2022 16:42:42 +0000 (17:42 +0100)]
reg-stack: Fix a -fcompare-debug bug in reg-stack [PR107183]

As the following testcase shows, the swap_rtx_condition function
in reg-stack can result in different code generation between -g and -g0.
The function is doing the changes as it goes, so does analysis and
changes together, which makes it harder to deal with DEBUG_INSNs,
where normally analysis phase ignores them and the later phase
doesn't.
swap_rtx_condition walks instructions two different ways, one is
using next_flags_user function which stops on non-call instructions
that mention the flags register, and the other is a loop on fnstsw
where it stops on instructions mentioning it and tries to find
sahf instruction that uses it (in both cases calls stop it and so
does end of basic block).
Now both of these currently stop on DEBUG_INSNs that mention
the flags register resp. the fnstsw result register.
On success the function recurses on next flags user instruction
if still live and if the recursion failed, reverts the changes
it did too and fails.
If it were just for the next_flags_user case, the fix could be
just not doing
      INSN_CODE (insn) = -1;
      if (recog_memoized (insn) == -1)
        fail = 1;
on DEBUG_INSNs (assuming all changes to those are fine),
swap_rtx_condition_1 just changes one comparison to a different
one.  But due to the possibility of fnstsw result being used
in theory before sahf in some DEBUG_INSNs, this patch takes
a different approach.  swap_rtx_condition has now a new argument
and two modes.  The first mode is when debug_seen is >= 0, in this
case both next_flags_user and the loop for fnstsw -> sahf will
ignore but note DEBUG_INSNs (that mention flags register or fnstsw
result).  If no such DEBUG_INSN is found during the whole call
including recursive invocations (so e.g. for -g0 but probably most
often for -g as well), it behaves as before, if it returns true
all the changes are done and nothing further needs to be done later.
If any DEBUG_INSNs are seen along the way, even when returning success
all the changes are reverted, so it just reports that the function
would be successful if DEBUG_INSNs were ignored.
In this case, compare_for_stack_reg needs to call it again in
debug_seen = -1 mode, which tells the function to update everything
including DEBUG_INSNs.  For the fnstsw -> sahf case which I hope
will be very rare I just reset the DEBUG_INSNs, I don't really
know how to express it easily otherwise.  For the rest
swap_rtx_condition_1 is done even on the DEBUG_INSNs.

2022-11-20  Jakub Jelinek  <jakub@redhat.com>

PR target/107183
* reg-stack.c (next_flags_user): Add DEBUG_SEEN argument.
If >= 0 and a DEBUG_INSN would be otherwise returned, set
DEBUG_SEEN to 1 and ignore it.
(swap_rtx_condition): Add DEBUG_SEEN argument.  In >= 0
mode only set DEBUG_SEEN to 1 if problematic DEBUG_ISNSs
were seen and revert all changes on success in that case.
Don't try to recog_memoized DEBUG_INSNs.
(compare_for_stack_reg): Adjust swap_rtx_condition caller.
If it returns true and debug_seen is 1, call swap_rtx_condition
again with debug_seen -1.

* gcc.dg/ubsan/pr107183.c: New test.

(cherry picked from commit 6b5c98c1c0003bd470a4428bede6c862637a94b8)

20 months agolibatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]
Jakub Jelinek [Tue, 15 Nov 2022 07:14:45 +0000 (08:14 +0100)]
libatomic: Handle AVX+CX16 AMD like Intel for 16b atomics [PR104688]

We got a response from AMD in
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104688#c10
so the following patch starts treating AMD with AVX and CMPXCHG16B
ISAs like Intel by using vmovdqa for atomic load/store in libatomic.
We still don't have confirmation from Zhaoxin and VIA (anything else
with CPUs featuring AVX and CX16?).

2022-11-15  Jakub Jelinek  <jakub@redhat.com>

PR target/104688
* config/x86/init.c (__libat_feat1_init): Don't clear
bit_AVX on AMD CPUs.

(cherry picked from commit 4a7a846687e076eae58ad3ea959245b2bf7fdc07)

20 months agoDaily bump.
GCC Administrator [Mon, 21 Nov 2022 00:19:57 +0000 (00:19 +0000)]
Daily bump.

20 months agonvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'
Thomas Schwinge [Fri, 18 Nov 2022 22:57:52 +0000 (23:57 +0100)]
nvptx: In 'STARTFILE_SPEC', fix 'crt0.o' for '-mmainkernel'

A recent nvptx-tools change: commit 886a95faf66bf66a82fc0fe7d2a9fd9e9fec2820
"ld: Don't search for input files in '-L'directories" (of
<https://github.com/MentorEmbedded/nvptx-tools/pull/38>
"Match standard 'ld' "search" behavior") in GCC/nvptx target testing
generally causes linking to fail with:

    error opening crt0.o
    collect2: error: ld returned 1 exit status
    compiler exited with status 1

Indeed per GCC '-v' output, there is an undecorated 'crt0.o' on the linker
('collect2') command line:

     [...]/build-gcc/./gcc/collect2 -o [...] crt0.o [...]

This is due to:

    gcc/config/nvptx/nvptx.h:#define STARTFILE_SPEC "%{mmainkernel:crt0.o}"

..., and the fix, as used by numerous other GCC targets, is to instead use
'crt0.o%s'; for '%s' means, per 'gcc/gcc.cc', "The Specs Language":

     %s     current argument is the name of a library or startup file of some sort.
            Search for that file in a standard list of directories
            and substitute the full name found.

With that, we get the expected path to 'crt0.o'.

gcc/
* config/nvptx/nvptx.h (STARTFILE_SPEC): Fix 'crt0.o' for
'-mmainkernel'.

(cherry picked from commit dda43e1ef0c9f6c32ad022d3a08ce7651e42a129)

20 months agoDaily bump.
GCC Administrator [Fri, 18 Nov 2022 18:11:34 +0000 (18:11 +0000)]
Daily bump.

21 months agoc++: constinit on pointer to function [PR104066]
Marek Polacek [Thu, 17 Nov 2022 16:59:29 +0000 (11:59 -0500)]
c++: constinit on pointer to function [PR104066]

[dcl.constinit]: "The constinit specifier shall be applied only to
a declaration of a variable with static or thread storage duration."

Thus, this ought to be OK:

  constinit void (*p)() = nullptr;

but the error message I introduced when implementing constinit was
not looking at funcdecl_p, so the code above was rejected.

Fixed thus.  I'm checking constinit_p first because I think that's
far more likely to be false than funcdecl_p.

PR c++/104066

gcc/cp/ChangeLog:

* decl.c (grokdeclarator): Check funcdecl_p before complaining
about constinit.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constinit18.C: New test.

(cherry picked from commit 7b3b2f50953c5143d4b14b59d322d8a793f411dd)

21 months agoDaily bump.
GCC Administrator [Thu, 17 Nov 2022 00:19:07 +0000 (00:19 +0000)]
Daily bump.

21 months agoaarch64: Add support for Ampere-1A (-mcpu=ampere1a) CPU
Philipp Tomsich [Mon, 7 Nov 2022 13:22:21 +0000 (14:22 +0100)]
aarch64: Add support for Ampere-1A (-mcpu=ampere1a) CPU

This patch adds support for Ampere-1A CPU:
 - recognize the name of the core and provide detection for -mcpu=native,
 - updated extra_costs,
 - adds a new fusion pair for (A+B+1 and A-B-1).

Ampere-1A and Ampere-1 have more timing difference than the extra
costs indicate, but these don't propagate through to the headline
items in our extra costs (e.g. the change in latency for scalar sqrt
doesn't have a corresponding table entry).

gcc/ChangeLog:

* config/aarch64/aarch64-cores.def (AARCH64_CORE): Add ampere1a.
* config/aarch64/aarch64-cost-tables.h: Add ampere1a_extra_costs.
* config/aarch64/aarch64-fusion-pairs.def (AARCH64_FUSION_PAIR):
Define a new fusion pair for A+B+1/A-B-1 (i.e., add/subtract two
registers and then +1/-1).
* config/aarch64/aarch64-tune.md: Regenerate.
* config/aarch64/aarch64.c (aarch_macro_fusion_pair_p): Implement
idiom-matcher for the new fusion pair.
* doc/invoke.texi: Add ampere1a.

(cherry picked from commit 590a06afbf0e96813b5879742f38f3665512c854)

21 months agoDaily bump.
GCC Administrator [Wed, 16 Nov 2022 00:19:20 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Tue, 15 Nov 2022 00:19:36 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Mon, 14 Nov 2022 00:19:59 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 13 Nov 2022 00:19:51 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sat, 12 Nov 2022 00:19:50 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Fri, 11 Nov 2022 00:19:16 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Thu, 10 Nov 2022 00:22:25 +0000 (00:22 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Wed, 9 Nov 2022 00:22:18 +0000 (00:22 +0000)]
Daily bump.

21 months agoAlways use TYPE_MODE instead of DECL_MODE for vector field
H.J. Lu [Wed, 19 Oct 2022 19:53:35 +0000 (12:53 -0700)]
Always use TYPE_MODE instead of DECL_MODE for vector field

e034c5c8957 re PR target/78643 (ICE in convert_move, at expr.c:230)

fixed the case where DECL_MODE of a vector field is BLKmode and its
TYPE_MODE is a vector mode because of target attribute.  Remove the
BLKmode check for the case where DECL_MODE of a vector field is a vector
mode and its TYPE_MODE isn't a vector mode because of target attribute.

gcc/

PR target/107304
* expr.c (get_inner_reference): Always use TYPE_MODE for vector
field with vector raw mode.

gcc/testsuite/

PR target/107304
* gcc.target/i386/pr107304.c: New test.

(cherry picked from commit 1c64aba8cdf6509533f554ad86640f274cdbe37f)

21 months agolibstdc++: Remove empty <author> elements in manual
Jonathan Wakely [Mon, 7 Nov 2022 22:27:08 +0000 (22:27 +0000)]
libstdc++: Remove empty <author> elements in manual

This fixes a spurious comma before the list of authors in the PDF
version of the libstdc++ manual.

Also fix the commented-out examples which should show <personblurb> not
<authorblurb>.

libstdc++-v3/ChangeLog:

* doc/xml/authors.xml: Remove empty author element.
* doc/xml/manual/spine.xml: Likewise.
* doc/html/*: Regenerate.

(cherry picked from commit 4596339d9fabdcbd66b5a7430fa56544f75ecef1)

21 months agoDaily bump.
GCC Administrator [Tue, 8 Nov 2022 00:20:28 +0000 (00:20 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Mon, 7 Nov 2022 00:19:31 +0000 (00:19 +0000)]
Daily bump.

21 months agoDaily bump.
GCC Administrator [Sun, 6 Nov 2022 11:08:02 +0000 (11:08 +0000)]
Daily bump.

21 months agodoc: Document correct -fwide-exec-charset defaults [PR41041]
Jonathan Wakely [Fri, 4 Nov 2022 12:10:32 +0000 (12:10 +0000)]
doc: Document correct -fwide-exec-charset defaults [PR41041]

As shown in the PR, the default is not UTF-32 but rather UTF-32BE or
UTF-32LE, avoiding the need for a byte order mark in literals.

gcc/ChangeLog:

PR c/41041
* doc/cppopts.texi: Document -fwide-exec-charset defaults
correctly.

(cherry picked from commit e50ea3a42f058c14ee29327d5277ab0435e3d36b)

21 months agoFix recent thinko in operand_equal_p
Eric Botcazou [Fri, 4 Nov 2022 10:23:12 +0000 (11:23 +0100)]
Fix recent thinko in operand_equal_p

There is a thinko in a recent improvement made to operand_equal_p where
the code just looks at operand 2 of COMPONENT_REF, if it is present, to
compare addresses.  That's wrong because operand 2 contains the number of
DECL_OFFSET_ALIGN-bit-sized words so, when DECL_OFFSET_ALIGN > 8, not all
the  bytes are included and some of them are in DECL_FIELD_BIT_OFFSET, see
get_inner_reference for the model computation.

In other words, you would need to compare operand 2 and DECL_OFFSET_ALIGN
and DECL_FIELD_BIT_OFFSET in this situation, but I'm not sure this is worth
the hassle in practice so the fix just removes this alternate handling.

gcc/
* fold-const.c (operand_compare::operand_equal_p) <COMPONENT_REF>:
Do not take into account operand 2.
(operand_compare::hash_operand) <COMPONENT_REF>: Likewise.

gcc/testsuite/
* gnat.dg/opt99.adb: New test.
* gnat.dg/opt99_pkg1.ads, gnat.dg/opt99_pkg1.adb: New helper.
* gnat.dg/opt99_pkg2.ads: Likewise.

21 months agoc, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358]
Jakub Jelinek [Mon, 24 Oct 2022 15:53:16 +0000 (17:53 +0200)]
c, c++: Fix up excess precision handling of scalar_to_vector conversion [PR107358]

As mentioned earlier in the C++ excess precision support mail, the following
testcase is broken with excess precision both in C and C++ (though just in C++
it was triggered in real-world code).
scalar_to_vector is called in both FEs after the excess precision promotions
(or stripping of EXCESS_PRECISION_EXPR), so we can then get invalid
diagnostics that say float vector + float involves truncation (on ia32
from long double to float).

The following patch fixes that by calling scalar_to_vector on the operands
before the excess precision promotions, let scalar_to_vector just do the
diagnostics (it does e.g. fold_for_warn so it will fold
EXCESS_PRECISION_EXPR around REAL_CST to constants etc.) but will then
do the actual conversions using the excess precision promoted operands
(so say if we have vector double + (float + float) we don't actually do
vector double + (float) ((long double) float + (long double) float)
but
vector double + (double) ((long double) float + (long double) float)

2022-10-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/107358
gcc/c/
* c-typeck.c (build_binary_op): Pass operands before excess precision
promotions to scalar_to_vector call.
gcc/testsuite/
* c-c++-common/pr107358.c: New test.

(cherry picked from commit 65e3274e363cb2c6bfe6b5e648916eb7696f7e2f)

21 months agoc++: Fix up constexpr handling of char/signed char/short pre/post inc/decrement ...
Jakub Jelinek [Mon, 24 Oct 2022 14:25:29 +0000 (16:25 +0200)]
c++: Fix up constexpr handling of char/signed char/short pre/post inc/decrement [PR105774]

signed char, char or short int pre/post inc/decrement are represented by
normal {PRE,POST}_{INC,DEC}REMENT_EXPRs in the FE and only gimplification
ensures that the {PLUS,MINUS}_EXPR is done in unsigned version of those
types:
    case PREINCREMENT_EXPR:
    case PREDECREMENT_EXPR:
    case POSTINCREMENT_EXPR:
    case POSTDECREMENT_EXPR:
      {
        tree type = TREE_TYPE (TREE_OPERAND (*expr_p, 0));
        if (INTEGRAL_TYPE_P (type) && c_promoting_integer_type_p (type))
          {
            if (!TYPE_OVERFLOW_WRAPS (type))
              type = unsigned_type_for (type);
            return gimplify_self_mod_expr (expr_p, pre_p, post_p, 1, type);
          }
        break;
      }
This means during constant evaluation we need to do it similarly (either
using unsigned_type_for or using widening to integer_type_node).
The following patch does the latter.

2022-10-24  Jakub Jelinek  <jakub@redhat.com>

PR c++/105774
* constexpr.c (cxx_eval_increment_expression): For signed types
that promote to int, evaluate PLUS_EXPR or MINUS_EXPR in int type.

* g++.dg/cpp1y/constexpr-105774.C: New test.

(cherry picked from commit da8c362c4c18cff2f2dfd5c4706bdda7576899a4)

21 months agolibgomp: Fix up creation of artificial teams
Jakub Jelinek [Wed, 12 Oct 2022 15:54:08 +0000 (17:54 +0200)]
libgomp: Fix up creation of artificial teams

When not in explicit parallel/target/teams construct, we in some cases create
an artificial parallel with a single thread (either to handle target nowait
or for task reduction purposes).  In those cases, it handled again artificially
created implicit task (created by gomp_new_icv for cases where we needed to write
to some ICVs), but as the testcases show, didn't take into account possibility
of this being done from explicit task(s).  The code would destroy/free the previous
task and replace it with the new implicit task.  If task is an explicit task
(when teams is NULL, all explicit tasks behave like if (0)), it is a pointer to
a local stack variable, so freeing it doesn't work, and additionally we shouldn't
lose the explicit tasks - the new implicit task should instead replace the
ancestor task which is the first implicit one.

2022-10-12  Jakub Jelinek  <jakub@redhat.com>

* task.c (gomp_create_artificial_team): Fix up handling of invocations
from within explicit task.
* target.c (GOMP_target_ext): Likewise.
* testsuite/libgomp.c/task-7.c: New test.
* testsuite/libgomp.c/task-8.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-17.c: New test.
* testsuite/libgomp.c-c++-common/task-reduction-18.c: New test.

(cherry picked from commit a58a965eb73253759f6a3e1c7380392557da89c8)

21 months agoopenmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]
Jakub Jelinek [Sat, 24 Sep 2022 07:24:26 +0000 (09:24 +0200)]
openmp: Fix ICE with taskgroup at -O0 -fexceptions [PR107001]

The following testcase ICEs because with -O0 -fexceptions GOMP_taskgroup_end
call isn't directly followed by GOMP_RETURN statement, but there are some
conditionals to handle exceptions and we fail to find the correct GOMP_RETURN.

The fix is to treat taskgroup similarly to target data, both of these constructs
emit a try { body } finally { end_call } around the construct's body during
gimplification and we need to see proper construct nesting during gimplification
and omp lowering (including nesting of regions checks), but during omp expansion
we don't really need their nesting anymore, all we need is emit something at
the start of the region and the end of the region is the end API call we've
already emitted during gimplification.  For target data, we weren't adding
GOMP_RETURN statement during omp lowering, so after that pass it is treated
merely like stand-alone omp directives.  This patch does the same for
taskgroup too.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/107001
* omp-low.c (lower_omp_taskgroup): Don't add GOMP_RETURN statement
at the end.
* omp-expand.c (build_omp_regions_1): Clarify GF_OMP_TARGET_KIND_DATA
is not stand-alone directive.  For GIMPLE_OMP_TASKGROUP, also don't
update parent.
(omp_make_gimple_edges) <case GIMPLE_OMP_TASKGROUP>: Reset
cur_region back after new_omp_region.

* c-c++-common/gomp/pr107001.c: New test.

(cherry picked from commit ad2aab5c816a6fd56b46210c0a4a4c6243da1de9)

21 months agoopenmp, c: Tighten up c_tree_equal [PR106981]
Jakub Jelinek [Sat, 24 Sep 2022 07:19:26 +0000 (09:19 +0200)]
openmp, c: Tighten up c_tree_equal [PR106981]

This patch changes c_tree_equal to work more like cp_tree_equal, be
more strict in what it accepts.  The ICE on the first testcase was
due to INTEGER_CST wi::wide (t1) == wi::wide (t2) comparison which
ICEs if the two constants have different precision, but as the second
testcase shows, being too lenient in it can also lead to miscompilation
of valid OpenMP programs where we think certain expression is the same
even when it isn't and can be guaranteed at runtime to represent different
memory location.  So, the patch looks through only NON_LVALUE_EXPRs
and for constants as well as casts requires that the types match before
actually comparing the constant values or recursing on the cast operands.

2022-09-24  Jakub Jelinek  <jakub@redhat.com>

PR c/106981
gcc/c/
* c-typeck.c (c_tree_equal): Only strip NON_LVALUE_EXPRs at the
start.  For CONSTANT_CLASS_P or CASE_CONVERT: return false if t1 and
t2 have different types.
gcc/testsuite/
* c-c++-common/gomp/pr106981.c: New test.
libgomp/
* testsuite/libgomp.c-c++-common/pr106981.c: New test.

(cherry picked from commit 3c5bccb608c665ac3f62adb1817c42c845812428)

21 months agoi386: Fix up mode iterators that weren't expanded [PR106721]
Jakub Jelinek [Wed, 24 Aug 2022 07:57:09 +0000 (09:57 +0200)]
i386: Fix up mode iterators that weren't expanded [PR106721]

Currently, when md file reader sees <something> and something is valid mode
(or code) attribute but which doesn't include case for the current mode
(or code), it just keeps the <something> untouched.
I went through all cases matching <[a-zA-Z] in tmp-mddump.md after make mddump.
One of the cases was related to the V*HF mode additions and there was one typo.

2022-08-24  Jakub Jelinek  <jakub@redhat.com>

PR target/106721
* config/i386/sse.md
(avx512er_vmrcp28<mode><mask_name><round_saeonly_name>): Fix typo,
mask_opernad3 -> mask_operand3.

(cherry picked from commit 846e5c009e360f0c4fe58ff0d3aee03ebe3ca1a9)

21 months agoc++: Implement P2327R1 - De-deprecating volatile compound operations
Jakub Jelinek [Tue, 16 Aug 2022 11:15:32 +0000 (13:15 +0200)]
c++: Implement P2327R1 - De-deprecating volatile compound operations

From what I can see, this has been voted in as a DR and as it means
we warn less often than before in -std={gnu,c}++2{0,3} modes or with
-Wvolatile, I wonder if it shouldn't be backported to affected release
branches as well.

2022-08-16  Jakub Jelinek  <jakub@redhat.com>

* typeck.c (cp_build_modify_expr): Implement
P2327R1 - De-deprecating volatile compound operations.  Don't warn
for |=, &= or ^= with volatile lhs.
* expr.c (mark_use) <case MODIFY_EXPR>: Adjust warning wording,
leave out simple.

* g++.dg/cpp2a/volatile1.C: Adjust for de-deprecation of volatile
compound |=, &= and ^= operations.
* g++.dg/cpp2a/volatile3.C: Likewise.
* g++.dg/cpp2a/volatile5.C: Likewise.

(cherry picked from commit 6e790ca4615443fa395ac5cdba1ab6c87810985c)

21 months agocgraphunit: Don't emit asm thunks for -dx [PR106261]
Jakub Jelinek [Wed, 27 Jul 2022 10:06:22 +0000 (12:06 +0200)]
cgraphunit: Don't emit asm thunks for -dx [PR106261]

When -dx option is used (didn't know we have it and no idea what is it
useful for), we just expand functions to RTL and then omit all further
RTL passes, so the normal functions aren't actually emitted into assembly,
just variables.
The following testcase ICEs, because we don't emit the methods, but do
emit thunks pointing to that and those thunks have unwind info and rely on
at least some real functions to be emitted (which is normally the case,
thunks are only emitted for locally defined functions) because otherwise
there are no CIEs, only FDEs and dwarf2out is upset about it.

The following patch fixes that by not emitting assembly thunks for -dx
either.

2022-07-27  Jakub Jelinek  <jakub@redhat.com>

PR debug/106261
* cgraphunit.c (cgraph_node::assemble_thunks_and_aliases): Don't
output asm thunks for -dx.

* g++.dg/debug/pr106261.C: New test.

(cherry picked from commit f9671b60f9395cb1dca128b92f5dd215f5aeaae1)

21 months agowide-int: Fix up wi::shifted_mask [PR106144]
Jakub Jelinek [Fri, 1 Jul 2022 09:17:41 +0000 (11:17 +0200)]
wide-int: Fix up wi::shifted_mask [PR106144]

As the following self-test testcase shows, wi::shifted_mask sometimes
doesn't create canonicalized wide_ints, which then fail to compare equal
to canonicalized wide_ints with the same value.
In particular, wi::mask (128, false, 128) gives { -1 } with len 1 and prec 128,
while wi::shifted_mask (0, 128, false, 128) gives { -1, -1 } with len 2
and prec 128.
The problem is that the code is written with the assumption that there are
3 bit blocks (or 2 if start is 0), but doesn't consider the possibility
where there are 2 bit blocks (or 1 if start is 0) where the highest block
isn't present.  In that case, there is the optional block of negate ? 0 : -1
elts, followed by just one elt (either one from the if (shift) or just
negate ? -1 : 0) and the rest is implicit sign-extension.
Only if end < prec there is 1 or more bits above it that have different bit
value and so we need to emit all the elts till end and then one more elt.

if (end == prec) would work too, because we have:
  if (width > prec - start)
    width = prec - start;
  unsigned int end = start + width;
so end is guaranteed to be end <= prec, dunno what is preferred.

2022-07-01  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/106144
* wide-int.cc (wi::shifted_mask): If end >= prec, return right after
emitting element for shift or if shift is 0 first element after start.
(wide_int_cc_tests): Add tests for equivalency of wi::mask and
wi::shifted_mask with 0 start.

(cherry picked from commit e52592073f6df3d7a3acd9f0436dcc32a8b7493d)

21 months agoifcvt: Don't introduce trapping or faulting reads in noce_try_sign_mask [PR106032]
Jakub Jelinek [Tue, 21 Jun 2022 09:40:16 +0000 (11:40 +0200)]
ifcvt: Don't introduce trapping or faulting reads in noce_try_sign_mask [PR106032]

noce_try_sign_mask as documented will optimize
  if (c < 0)
    x = t;
  else
    x = 0;
into x = (c >> bitsm1) & t;
The optimization is done if either t is unconditional
(e.g. for
  x = t;
  if (c >= 0)
    x = 0;
) or if it is cheap.  We already check that t doesn't have side-effects,
but if t is conditional, we need to punt also if it may trap or fault,
as we make it unconditional.

I've briefly skimmed other noce_try* optimizations and didn't find one that
would suffer from the same problem.

2022-06-21  Jakub Jelinek  <jakub@redhat.com>

PR rtl-optimization/106032
* ifcvt.c (noce_try_sign_mask): Punt if !t_unconditional, and
t may_trap_or_fault_p, even if it is cheap.

* gcc.c-torture/execute/pr106032.c: New test.

(cherry picked from commit a0c30fe3b888f20215f3e040d21b62b603804ca9)

21 months agoexpand: Fix up expand_cond_expr_using_cmove [PR106030]
Jakub Jelinek [Tue, 21 Jun 2022 09:38:59 +0000 (11:38 +0200)]
expand: Fix up expand_cond_expr_using_cmove [PR106030]

If expand_cond_expr_using_cmove can't find a cmove optab for a particular
mode, it tries to promote the mode and perform the cmove in the promoted
mode.

The testcase in the patch ICEs on arm because in that case we pass temp which
has the promoted mode (SImode) as target to expand_operands where the
operands have the non-promoted mode (QImode).
Later on the function uses paradoxical subregs:
  if (GET_MODE (op1) != mode)
    op1 = gen_lowpart (mode, op1);

  if (GET_MODE (op2) != mode)
    op2 = gen_lowpart (mode, op2);
to change the operand modes.

The following patch fixes it by passing NULL_RTX as target if it has
promoted mode.

2022-06-21  Jakub Jelinek  <jakub@redhat.com>

PR middle-end/106030
* expr.c (expand_cond_expr_using_cmove): Pass NULL_RTX instead of
temp to expand_operands if mode has been promoted.

* gcc.c-torture/compile/pr106030.c: New test.

(cherry picked from commit 2df1df945fac85d7b3d084001414a66a2709d8fe)

21 months agolibgomp: Fix up target-31.c test [PR106045]
Jakub Jelinek [Tue, 21 Jun 2022 15:51:08 +0000 (17:51 +0200)]
libgomp: Fix up target-31.c test [PR106045]

The i variable is used inside of the parallel in:
      #pragma omp simd safelen(32) private (v)
      for (i = 0; i < 64; i++)
        {
          v = 3 * i;
          ll[i] = u1 + v * u2[0] + u2[1] + x + y[0] + y[1] + v + h[0] + u3[i];
        }
where i is predetermined linear (so while inside of the body
it is safe, private per SIMD lane var) the final value is written to
the shared variable, and in:
      for (i = 0; i < 64; i++)
        if (ll[i] != u1 + 3 * i * u2[0] + u2[1] + x + y[0] + y[1] + 3 * i + 13 + 14 + i)
          #pragma omp atomic write
            err = 1;
which is a normal loop and so it isn't in any way privatized there.
So we have a data race, fixed by adding private (i) clause to the
parallel.

2022-06-21  Jakub Jelinek  <jakub@redhat.com>
    Paul Iannetta  <piannetta@kalrayinc.com>

PR libgomp/106045
* testsuite/libgomp.c/target-31.c: Add private (i) clause.

(cherry picked from commit 85d613da341b76308edea48359a5dbc7061937c4)

21 months agoDaily bump.
GCC Administrator [Fri, 4 Nov 2022 00:20:36 +0000 (00:20 +0000)]
Daily bump.

This page took 0.102023 seconds and 5 git commands to generate.