From 3e2c715823e6aa0bfd89e56046a1c237789cd27d Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Tue, 18 May 2021 11:33:29 +0200 Subject: operand scanner TLC This applies some TLC to mark_address_taken which ends up setting TREE_ADDRESSABLE on nodes where it doesn't have any semantics. It also does work (incomplete) that get_base_address already does, likewise we'll never get WITH_SIZE_EXPR in this context and thus get_base_address never fails. 2021-05-18 Richard Biener * tree-ssa-operands.c (mark_address_taken): Simplify. --- gcc/tree-ssa-operands.c | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) (limited to 'gcc') diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c index 9e62088..2fc74d5 100644 --- a/gcc/tree-ssa-operands.c +++ b/gcc/tree-ssa-operands.c @@ -626,15 +626,10 @@ mark_address_taken (tree ref) be referenced using pointer arithmetic. See PR 21407 and the ensuing mailing list discussion. */ var = get_base_address (ref); - if (var) - { - if (DECL_P (var)) - TREE_ADDRESSABLE (var) = 1; - else if (TREE_CODE (var) == MEM_REF - && TREE_CODE (TREE_OPERAND (var, 0)) == ADDR_EXPR - && DECL_P (TREE_OPERAND (TREE_OPERAND (var, 0), 0))) - TREE_ADDRESSABLE (TREE_OPERAND (TREE_OPERAND (var, 0), 0)) = 1; - } + if (VAR_P (var) + || TREE_CODE (var) == RESULT_DECL + || TREE_CODE (var) == PARM_DECL) + TREE_ADDRESSABLE (var) = 1; } -- cgit v1.1 From e1cca88019ab1208f8389606dd18a25cd50c20e1 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Fri, 7 May 2021 10:13:49 +0200 Subject: [OMP] Tighten 'is_gimple_omp_oacc' No overall change in behavior. gcc/ * gimple.h (is_gimple_omp_oacc): Tighten. * omp-low.c (check_omp_nesting_restrictions): Adjust. --- gcc/gimple.h | 8 ++++++++ gcc/omp-low.c | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) (limited to 'gcc') diff --git a/gcc/gimple.h b/gcc/gimple.h index 3ec86f5..91b92b4 100644 --- a/gcc/gimple.h +++ b/gcc/gimple.h @@ -6501,6 +6501,14 @@ is_gimple_omp_oacc (const gimple *stmt) gcc_assert (is_gimple_omp (stmt)); switch (gimple_code (stmt)) { + case GIMPLE_OMP_ATOMIC_LOAD: + case GIMPLE_OMP_ATOMIC_STORE: + case GIMPLE_OMP_CONTINUE: + case GIMPLE_OMP_RETURN: + /* Codes shared between OpenACC and OpenMP cannot be used to disambiguate + the two. */ + gcc_unreachable (); + case GIMPLE_OMP_FOR: switch (gimple_omp_for_kind (stmt)) { diff --git a/gcc/omp-low.c b/gcc/omp-low.c index cadca7e..d1136d1 100644 --- a/gcc/omp-low.c +++ b/gcc/omp-low.c @@ -3016,11 +3016,12 @@ check_omp_nesting_restrictions (gimple *stmt, omp_context *ctx) /* No nesting of non-OpenACC STMT (that is, an OpenMP one, or a GOMP builtin) inside an OpenACC CTX. */ - if (!(is_gimple_omp (stmt) - && is_gimple_omp_oacc (stmt)) - /* Except for atomic codes that we share with OpenMP. */ - && !(gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD - || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE)) + if (gimple_code (stmt) == GIMPLE_OMP_ATOMIC_LOAD + || gimple_code (stmt) == GIMPLE_OMP_ATOMIC_STORE) + /* ..., except for the atomic codes that OpenACC shares with OpenMP. */ + ; + else if (!(is_gimple_omp (stmt) + && is_gimple_omp_oacc (stmt))) { if (oacc_get_fn_attrib (cfun->decl) != NULL) { -- cgit v1.1 From 5116b54e4644cb0d7b99891c76f8f015097f6530 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 18 May 2021 11:56:05 +0200 Subject: gcc/configure.ac: Fix cross build by using $(CFLAGS-$@) [PR100598] BUILD_CFLAGS is set by configure; by default, BUILD_CFLAGS = $(ALL_CFLAGS) is used. The latter contains (see gcc/Makefile.in) $(CFLAGS-$@), which is used to pass .o-file specific flags to the compiler. For cross builds, BUILD_CFLAGS is constructed in configure{,.ac} and missed the $(CFLAGS-$@) - despite the comment above ALL_CFLAGS that configure.ac might have to kept in sync. gcc/ChangeLog: PR other/100598 * configure: Regenerate. * configure.ac (BUILD_CFLAG, BUILD_CXXFLAGS): Add $(CFLAGS-$@). --- gcc/configure | 22 +++++----------------- gcc/configure.ac | 4 ++-- 2 files changed, 7 insertions(+), 19 deletions(-) (limited to 'gcc') diff --git a/gcc/configure b/gcc/configure index 039a86d..4a9e4fa 100755 --- a/gcc/configure +++ b/gcc/configure @@ -911,7 +911,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -1086,7 +1085,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE}' @@ -1339,15 +1337,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1485,7 +1474,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1638,7 +1627,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -13309,8 +13297,8 @@ BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' # And these apply if build != host, or we are generating coverage data if test x$build != x$host || test "x$coverage_flags" != x then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)' + BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)' BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}} @@ -19447,7 +19435,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19450 "configure" +#line 19438 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -19553,7 +19541,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 19556 "configure" +#line 19544 "configure" #include "confdefs.h" #if HAVE_DLFCN_H diff --git a/gcc/configure.ac b/gcc/configure.ac index 4e78801..d9fc3c2 100644 --- a/gcc/configure.ac +++ b/gcc/configure.ac @@ -2448,8 +2448,8 @@ BUILD_NO_PIE_FLAG='$(NO_PIE_FLAG)' AC_SUBST(BUILD_NO_PIE_FLAG) # And these apply if build != host, or we are generating coverage data if test x$build != x$host || test "x$coverage_flags" != x then - BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS_FOR_BUILD)' - BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CXXFLAGS_FOR_BUILD)' + BUILD_CFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CFLAGS_FOR_BUILD)' + BUILD_CXXFLAGS='$(INTERNAL_CFLAGS) $(T_CFLAGS) $(CFLAGS-$@) $(CXXFLAGS_FOR_BUILD)' BUILD_LDFLAGS='$(LDFLAGS_FOR_BUILD)' NO_PIE_CFLAGS_FOR_BUILD=${NO_PIE_CFLAGS_FOR_BUILD-${NO_PIE_CFLAGS}} -- cgit v1.1 From 03eb779141a29f96600cd46904b88a33c4b49a66 Mon Sep 17 00:00:00 2001 From: Thomas Schwinge Date: Thu, 6 May 2021 11:59:42 +0200 Subject: Add 'dg-note', 'dg-lto-note' That's 'dg-message "note: [...]"' with a twist: inhibit default notes pruning, such that "if 'dg-note' is used at least once in a testcase, [notes] are not pruned and instead must *all* be handled explicitly". The rationale is that either you're not interested in notes at all (default behavior of pruning all notes), but often, when you're interested in one note, you're in fact interested in all notes, and especially interested if *additional* notes appear over time, as GCC evolves. gcc/testsuite/ * lib/gcc-dg.exp: Implement 'dg-note'. * lib/prune.exp: Likewise. * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and 'dg-prune-output "note: ". * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use 'dg-note', match up additional notes, one class of them with XFAILed 'dg-bogus'. * lib/lto.exp: Implement 'dg-lto-note'. * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional notes. * g++.dg/lto/odr-1_1.C: Likewise. * g++.dg/lto/odr-2_1.C: Likewise. libstdc++-v3/ * testsuite/lib/prune.exp: Add note about 'dg-note'. gcc/ * doc/sourcebuild.texi: Document 'dg-note'. --- gcc/doc/sourcebuild.texi | 22 +++++++++++++-- gcc/testsuite/g++.dg/lto/odr-1_0.C | 4 ++- gcc/testsuite/g++.dg/lto/odr-1_1.C | 9 +++--- gcc/testsuite/g++.dg/lto/odr-2_1.C | 2 +- gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c | 4 ++- .../routine-external-level-of-parallelism-2.f | 26 ++++++++++++++++++ gcc/testsuite/lib/gcc-dg.exp | 32 ++++++++++++++++++++++ gcc/testsuite/lib/lto.exp | 22 +++++++++++---- gcc/testsuite/lib/prune.exp | 7 +++-- 9 files changed, 112 insertions(+), 16 deletions(-) (limited to 'gcc') diff --git a/gcc/doc/sourcebuild.texi b/gcc/doc/sourcebuild.texi index ceb6b99..ed811d1 100644 --- a/gcc/doc/sourcebuild.texi +++ b/gcc/doc/sourcebuild.texi @@ -1217,6 +1217,21 @@ If there is no message for that line or if the text of that message is not matched by @var{regexp} then the check fails and @var{comment} is included in the @code{FAIL} message. +@item @{ dg-note @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @} +The line is expected to get a @samp{note} message. +If there is no message for that line or if the text of that message is +not matched by @var{regexp} then the check fails and @var{comment} is +included in the @code{FAIL} message. + +By default, any @emph{excess} @samp{note} messages are pruned, meaning +their appearance doesn't trigger @emph{excess errors}. +However, if @samp{dg-note} is used at least once in a testcase, +they're not pruned and instead must @emph{all} be handled explicitly. +Thus, if looking for just single instances of messages with +@samp{note: } prefixes without caring for all of them, use +@samp{dg-message "note: [@dots{}]"} instead of @samp{dg-note}, or use +@samp{dg-note} together with @samp{dg-prune-output "note: "}. + @item @{ dg-bogus @var{regexp} [@var{comment} [@{ target/xfail @var{selector} @} [@var{line}] ]] @} This DejaGnu directive appears on a source line that should not get a message matching @var{regexp}, or else specifies the source line @@ -1227,7 +1242,8 @@ targets. @item @{ dg-line @var{linenumvar} @} This DejaGnu directive sets the variable @var{linenumvar} to the line number of the source line. The variable @var{linenumvar} can then be used in subsequent -@code{dg-error}, @code{dg-warning}, @code{dg-message} and @code{dg-bogus} +@code{dg-error}, @code{dg-warning}, @code{dg-message}, @code{dg-note} +and @code{dg-bogus} directives. For example: @smallexample @@ -1239,7 +1255,9 @@ float a; /* @{ dg-error "conflicting types of" @} */ @item @{ dg-excess-errors @var{comment} [@{ target/xfail @var{selector} @}] @} This DejaGnu directive indicates that the test is expected to fail due to compiler messages that are not handled by @samp{dg-error}, -@samp{dg-warning} or @samp{dg-bogus}. For this directive @samp{xfail} +@samp{dg-warning}, @code{dg-message}, @samp{dg-note} or +@samp{dg-bogus}. +For this directive @samp{xfail} has the same effect as @samp{target}. @item @{ dg-prune-output @var{regexp} @} diff --git a/gcc/testsuite/g++.dg/lto/odr-1_0.C b/gcc/testsuite/g++.dg/lto/odr-1_0.C index 6fff888..318a047 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_0.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_0.C @@ -1,8 +1,10 @@ // PR c++/82414 // { dg-lto-do link } enum vals {aa,cc}; // { dg-lto-warning "6: type 'vals' violates the C\\+\\+ One Definition Rule" } +// { dg-lto-note "name 'cc' differs from name 'bb' defined in another translation unit" "" { target *-*-* } .-1 } struct a { // { dg-lto-warning "8: type 'struct a' violates the C\\+\\+ One Definition Rule" } - struct b *ptr; // { dg-lto-message "13: the first difference of corresponding definitions is field 'ptr'" } + struct b *ptr; // { dg-lto-note "13: the first difference of corresponding definitions is field 'ptr'" } + // { dg-lto-note "the incompatible type defined in another translation unit" "" { target *-*-* } .-1 } enum vals vals; }; void test(struct a *a) diff --git a/gcc/testsuite/g++.dg/lto/odr-1_1.C b/gcc/testsuite/g++.dg/lto/odr-1_1.C index 494436a..a57bb38 100644 --- a/gcc/testsuite/g++.dg/lto/odr-1_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-1_1.C @@ -1,9 +1,10 @@ namespace { - struct b; // { dg-lto-message "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } + struct b; // { dg-lto-note "type 'struct b' defined in anonymous namespace cannot match across the translation unit boundary" } } -enum vals {aa,bb,cc}; // { dg-lto-message "an enum with different value name is defined in another translation unit" } -struct a { // { dg-lto-message "a different type is defined in another translation unit" } - struct b *ptr; // { dg-lto-message "a field of same name but different type is defined in another translation unit" } +enum vals {aa,bb,cc}; // { dg-lto-note "an enum with different value name is defined in another translation unit" } +// { dg-lto-note "mismatching definition" "" { target *-*-* } .-1 } +struct a { // { dg-lto-note "a different type is defined in another translation unit" } + struct b *ptr; // { dg-lto-note "a field of same name but different type is defined in another translation unit" } enum vals vals; } a; void test(struct a *); diff --git a/gcc/testsuite/g++.dg/lto/odr-2_1.C b/gcc/testsuite/g++.dg/lto/odr-2_1.C index f384ae8..23cfccc 100644 --- a/gcc/testsuite/g++.dg/lto/odr-2_1.C +++ b/gcc/testsuite/g++.dg/lto/odr-2_1.C @@ -1,4 +1,4 @@ -class a { // { dg-lto-message "a different type is defined in another translation unit" } +class a { // { dg-lto-note "a different type is defined in another translation unit" } int *b() const; }; int *a::b() const { return 0; } diff --git a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c index 23a3b39..bcdf7f0 100644 --- a/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c +++ b/gcc/testsuite/gcc.dg/vect/nodump-vect-opt-info-2.c @@ -3,7 +3,9 @@ extern void accumulate (int x, int *a); -int test_missing_function_defn (int *arr, int n) /* { dg-message "vectorized 0 loops in function" } */ +int test_missing_function_defn (int *arr, int n) /* { dg-note "5: vectorized 0 loops in function" } */ +/* { dg-prune-output "note: " } as we're not interested in matching any further + notes. */ { int sum = 0; for (int i = 0; i < n; ++i) /* { dg-missed "21: couldn't vectorize loop" } */ diff --git a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f index 0e8dfb1..04d507f 100644 --- a/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f +++ b/gcc/testsuite/gfortran.dg/goacc/routine-external-level-of-parallelism-2.f @@ -22,6 +22,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -30,9 +32,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangr' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangr_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -83,6 +88,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -90,6 +96,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -97,6 +104,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call gangr (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -126,6 +134,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -133,6 +142,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call workerr (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -152,6 +162,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorr' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorr_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -168,6 +180,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n call vectorr (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -201,6 +214,8 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do j = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } +! { dg-bogus "note: routine 'workerf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'workerf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do end do !$acc end parallel loop @@ -209,9 +224,12 @@ ! { dg-warning "insufficient partitioning available to parallelize loop" "" { target *-*-* } .-1 } do i = 1, n !$acc loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do j = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } +! { dg-bogus "note: routine 'gangf' declared here" "TODO" { xfail { ! offloading_enabled } } .-2 } +! { dg-bogus "note: routine 'gangf_' declared here" "TODO" { xfail offloading_enabled } .-3 } end do end do !$acc end parallel loop @@ -262,6 +280,7 @@ !$acc end parallel loop !$acc parallel loop gang ! { dg-message "optimized: assigned OpenACC gang loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC worker vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -269,6 +288,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -276,6 +296,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = gangf (a, n) ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -305,6 +326,7 @@ !$acc end parallel loop !$acc parallel loop worker ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -312,6 +334,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = workerf (a, n) ! { dg-message "optimized: assigned OpenACC worker loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } @@ -331,6 +354,8 @@ !$acc parallel loop ! { dg-message "optimized: assigned OpenACC gang worker loop parallelism" } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-bogus "note: routine 'vectorf' declared here" "TODO" { xfail { ! offloading_enabled } } .-1 } +! { dg-bogus "note: routine 'vectorf_' declared here" "TODO" { xfail offloading_enabled } .-2 } end do !$acc end parallel loop @@ -347,6 +372,7 @@ !$acc end parallel loop !$acc parallel loop vector ! { dg-message "optimized: assigned OpenACC vector loop parallelism" } +! { dg-note "containing loop here" "" { target *-*-* } .-1 } do i = 1, n a(i) = vectorf (a, n) ! { dg-message "optimized: assigned OpenACC seq loop parallelism" } ! { dg-error "routine call uses same OpenACC parallelism as containing loop" "" { target *-*-* } .-1 } diff --git a/gcc/testsuite/lib/gcc-dg.exp b/gcc/testsuite/lib/gcc-dg.exp index e48a184..fce0989 100644 --- a/gcc/testsuite/lib/gcc-dg.exp +++ b/gcc/testsuite/lib/gcc-dg.exp @@ -1012,6 +1012,8 @@ if { [info procs saved-dg-test] == [list] } { } unset save_linenr_varnames } + + initialize_prune_notes } proc dg-test { args } { @@ -1245,6 +1247,36 @@ proc dg-missed { args } { process-message saved-dg-warning "missed:" "$args" } +# Look for messages with 'note: ' prefixes. +# In addition to standard compiler diagnostics ('DK_NOTE', 'inform' functions, +# "for additional details on an error message"), +# this also includes output from '-fopt-info' for 'MSG_NOTE': +# a general optimization info. +# By default, any *excess* notes are pruned, meaning their appearance doesn't +# trigger *excess errors*. However, if 'dg-note' is used at least once in a +# testcase, they're not pruned and instead must *all* be handled explicitly. +# Thus, if looking for just single instances of messages with 'note: ' prefixes +# without caring for all of them, use 'dg-message "note: [...]"' instead of +# 'dg-note', or use 'dg-note' together with 'dg-prune-output "note: "'. + +variable prune_notes + +proc initialize_prune_notes { } { + global prune_notes + set prune_notes 1 +} + +initialize_prune_notes + +proc dg-note { args } { + upvar dg-messages dg-messages + + global prune_notes + set prune_notes 0 + + process-message saved-dg-warning "note:" "$args" +} + # Check the existence of a gdb in the path, and return true if there # is one. # diff --git a/gcc/testsuite/lib/lto.exp b/gcc/testsuite/lib/lto.exp index 77919e8..d0e0dc6 100644 --- a/gcc/testsuite/lib/lto.exp +++ b/gcc/testsuite/lib/lto.exp @@ -161,9 +161,13 @@ proc lto_prune_warns { text } { # Ignore missing jobserver for tests that do more than 1 LTRANS unit regsub -all "(^|\n)\[^\n\]*: warning: using serial compilation of \[^\n\]*" $text "" text + regsub -all "(^|\n)\[^\n\]*: note: see the \[^\n\]*'-flto' option documentation\[^\n\]* for more information" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } verbose "lto_prune_warns: exit: $text" 2 @@ -390,8 +394,8 @@ proc lto-can-handle-directive { op } { # A list of directives to recognize, and a list of directives # to remap them to. # For example, "dg-lto-warning" is implemented by calling "dg-warning". - set directives { dg-lto-warning dg-lto-message } - set remapped_directives { dg-warning dg-message } + set directives { dg-lto-warning dg-lto-message dg-lto-note } + set remapped_directives { dg-warning dg-message dg-note } set idx [lsearch -exact $directives $cmd] if { $idx != -1 } { @@ -597,7 +601,7 @@ proc lto-get-options { src } { # # SRC1 is the full pathname of the main file of the testcase. # SID identifies a test suite in the names of temporary files. -proc lto-execute { src1 sid } { +proc lto-execute-1 { src1 sid } { global srcdir tmpdir global lto_option_list global tool @@ -811,6 +815,14 @@ proc lto-execute { src1 sid } { } } +proc lto-execute { src1 sid } { + lto-execute-1 $src1 $sid + + # LTO testing doesn't use 'dg-runtest'/'dg-test', and thus doesn't call + # 'cleanup-after-saved-dg-test', so we have to clean up manually. + initialize_prune_notes +} + # Call pass if object readelf is ok, otherwise fail. # example: /* { dg-final { object-readelf Tag_ABI_enum_size int} } */ proc object-readelf { args } { diff --git a/gcc/testsuite/lib/prune.exp b/gcc/testsuite/lib/prune.exp index 2809f88..91f165b 100644 --- a/gcc/testsuite/lib/prune.exp +++ b/gcc/testsuite/lib/prune.exp @@ -54,8 +54,11 @@ proc prune_gcc_output { text } { regsub -all "(^|\n)\[ \]+from \[^\n\]*" $text "" text regsub -all "(^|\n)(In|of) module( \[^\n \]*,)? imported at \[^\n\]*" $text "" text - # Ignore informational notes. - regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + global prune_notes + if { $prune_notes } { + # Ignore informational notes. + regsub -all "(^|\n)\[^\n\]*: note: \[^\n\]*" $text "" text + } # Ignore harmless -fpic warnings. regsub -all "(^|\n)\[^\n\]*: warning: -f(pic|PIC) ignored for target\[^\n\]*" $text "" text -- cgit v1.1 From d3a0208e433dc5aed7ef8deab8d74b6da55e1985 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Mon, 17 May 2021 16:35:38 +0200 Subject: Avoid setting TREE_ADDRESSABLE on stack vars during RTL expansion This avoids setting TREE_ADDRESSABLE on variables we want to force to the stack. Instead track those in a temporary bitmap and force stack expansion that way, leaving TREE_ADDRESSABLE alone, not pessimizing future alias queries. 2021-05-17 Richard Biener * cfgexpand.c (expand_one_var): Pass in forced_stack_var and honor it when expanding. (expand_used_vars_for_block): Pass through forced_stack_var. (expand_used_vars): Likewise. (discover_nonconstant_array_refs_r): Set bits in forced_stack_vars instead of marking vars TREE_ADDRESSABLE. (avoid_type_punning_on_regs): Likewise. (discover_nonconstant_array_refs): Likewise. (pass_expand::execute): Create and pass down forced_stack_var bitmap. For parameters and returns temporarily set TREE_ADDRESSABLE when expand_function_start. --- gcc/cfgexpand.c | 107 +++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 75 insertions(+), 32 deletions(-) (limited to 'gcc') diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c index e3814ee..3e6f7ca 100644 --- a/gcc/cfgexpand.c +++ b/gcc/cfgexpand.c @@ -1719,7 +1719,8 @@ defer_stack_allocation (tree var, bool toplevel) */ static poly_uint64 -expand_one_var (tree var, bool toplevel, bool really_expand) +expand_one_var (tree var, bool toplevel, bool really_expand, + bitmap forced_stack_var = NULL) { unsigned int align = BITS_PER_UNIT; tree origvar = var; @@ -1797,7 +1798,9 @@ expand_one_var (tree var, bool toplevel, bool really_expand) expand_one_error_var (var); } } - else if (use_register_for_decl (var)) + else if (use_register_for_decl (var) + && (!forced_stack_var + || !bitmap_bit_p (forced_stack_var, DECL_UID (var)))) { if (really_expand) expand_one_register_var (origvar); @@ -1842,7 +1845,7 @@ expand_one_var (tree var, bool toplevel, bool really_expand) TOPLEVEL is true if this is the outermost BLOCK. */ static void -expand_used_vars_for_block (tree block, bool toplevel) +expand_used_vars_for_block (tree block, bool toplevel, bitmap forced_stack_vars) { tree t; @@ -1851,11 +1854,11 @@ expand_used_vars_for_block (tree block, bool toplevel) if (TREE_USED (t) && ((!VAR_P (t) && TREE_CODE (t) != RESULT_DECL) || !DECL_NONSHAREABLE (t))) - expand_one_var (t, toplevel, true); + expand_one_var (t, toplevel, true, forced_stack_vars); /* Expand all variables at containing levels. */ for (t = BLOCK_SUBBLOCKS (block); t ; t = BLOCK_CHAIN (t)) - expand_used_vars_for_block (t, false); + expand_used_vars_for_block (t, false, forced_stack_vars); } /* A subroutine of expand_used_vars. Walk down through the BLOCK tree @@ -2139,7 +2142,7 @@ stack_protect_return_slot_p () /* Expand all variables used in the function. */ static rtx_insn * -expand_used_vars (void) +expand_used_vars (bitmap forced_stack_vars) { tree var, outer_block = DECL_INITIAL (current_function_decl); auto_vec maybe_local_decls; @@ -2216,7 +2219,7 @@ expand_used_vars (void) TREE_USED (var) = 1; if (expand_now) - expand_one_var (var, true, true); + expand_one_var (var, true, true, forced_stack_vars); next: if (DECL_ARTIFICIAL (var) && !DECL_IGNORED_P (var)) @@ -2251,7 +2254,7 @@ expand_used_vars (void) /* At this point, all variables within the block tree with TREE_USED set are actually used by the optimized function. Lay them out. */ - expand_used_vars_for_block (outer_block, true); + expand_used_vars_for_block (outer_block, true, forced_stack_vars); tree attribs = DECL_ATTRIBUTES (current_function_decl); if (stack_vars_num > 0) @@ -6241,9 +6244,10 @@ construct_exit_block (void) static tree discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, - void *data ATTRIBUTE_UNUSED) + void *data) { tree t = *tp; + bitmap forced_stack_vars = (bitmap)((walk_stmt_info *)data)->info; if (IS_TYPE_OR_DECL_P (t)) *walk_subtrees = 0; @@ -6267,8 +6271,9 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, { t = get_base_address (t); if (t && DECL_P (t) - && DECL_MODE (t) != BLKmode) - TREE_ADDRESSABLE (t) = 1; + && DECL_MODE (t) != BLKmode + && !TREE_ADDRESSABLE (t)) + bitmap_set_bit (forced_stack_vars, DECL_UID (t)); } *walk_subtrees = 0; @@ -6283,9 +6288,10 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, tree base = get_base_address (t); if (base && DECL_P (base) + && !TREE_ADDRESSABLE (base) && DECL_MODE (base) != BLKmode && GET_MODE_SIZE (DECL_MODE (base)).is_constant ()) - TREE_ADDRESSABLE (base) = 1; + bitmap_set_bit (forced_stack_vars, DECL_UID (base)); *walk_subtrees = 0; } @@ -6298,7 +6304,7 @@ discover_nonconstant_array_refs_r (tree * tp, int *walk_subtrees, suitable for raw bits processing (like XFmode on i?86). */ static void -avoid_type_punning_on_regs (tree t) +avoid_type_punning_on_regs (tree t, bitmap forced_stack_vars) { machine_mode access_mode = TYPE_MODE (TREE_TYPE (t)); if (access_mode != BLKmode @@ -6312,7 +6318,7 @@ avoid_type_punning_on_regs (tree t) GET_MODE_BITSIZE (GET_MODE_INNER (DECL_MODE (base)))) /* Double check in the expensive way we really would get a pseudo. */ && use_register_for_decl (base)) - TREE_ADDRESSABLE (base) = 1; + bitmap_set_bit (forced_stack_vars, DECL_UID (base)); } /* RTL expansion is not able to compile array references with variable @@ -6321,38 +6327,49 @@ avoid_type_punning_on_regs (tree t) scenario. */ static void -discover_nonconstant_array_refs (void) +discover_nonconstant_array_refs (bitmap forced_stack_vars) { basic_block bb; gimple_stmt_iterator gsi; + walk_stmt_info wi = {}; + wi.info = forced_stack_vars; FOR_EACH_BB_FN (bb, cfun) for (gsi = gsi_start_bb (bb); !gsi_end_p (gsi); gsi_next (&gsi)) { gimple *stmt = gsi_stmt (gsi); if (!is_gimple_debug (stmt)) { - walk_gimple_op (stmt, discover_nonconstant_array_refs_r, NULL); + walk_gimple_op (stmt, discover_nonconstant_array_refs_r, &wi); gcall *call = dyn_cast (stmt); if (call && gimple_call_internal_p (call)) - switch (gimple_call_internal_fn (call)) - { - case IFN_LOAD_LANES: - /* The source must be a MEM. */ - mark_addressable (gimple_call_arg (call, 0)); - break; - case IFN_STORE_LANES: - /* The destination must be a MEM. */ - mark_addressable (gimple_call_lhs (call)); - break; - default: - break; - } + { + tree cand = NULL_TREE; + switch (gimple_call_internal_fn (call)) + { + case IFN_LOAD_LANES: + /* The source must be a MEM. */ + cand = gimple_call_arg (call, 0); + break; + case IFN_STORE_LANES: + /* The destination must be a MEM. */ + cand = gimple_call_lhs (call); + break; + default: + break; + } + if (cand) + cand = get_base_address (cand); + if (cand + && DECL_P (cand) + && use_register_for_decl (cand)) + bitmap_set_bit (forced_stack_vars, DECL_UID (cand)); + } if (gimple_vdef (stmt)) { tree t = gimple_get_lhs (stmt); if (t && REFERENCE_CLASS_P (t)) - avoid_type_punning_on_regs (t); + avoid_type_punning_on_regs (t, forced_stack_vars); } } } @@ -6553,7 +6570,8 @@ pass_expand::execute (function *fun) } /* Mark arrays indexed with non-constant indices with TREE_ADDRESSABLE. */ - discover_nonconstant_array_refs (); + auto_bitmap forced_stack_vars; + discover_nonconstant_array_refs (forced_stack_vars); /* Make sure all values used by the optimization passes have sane defaults. */ @@ -6601,7 +6619,7 @@ pass_expand::execute (function *fun) timevar_push (TV_VAR_EXPAND); start_sequence (); - var_ret_seq = expand_used_vars (); + var_ret_seq = expand_used_vars (forced_stack_vars); var_seq = get_insns (); end_sequence (); @@ -6621,9 +6639,34 @@ pass_expand::execute (function *fun) (int) param_ssp_buffer_size); } + /* Temporarily mark PARM_DECLs and RESULT_DECLs we need to expand to + memory addressable so expand_function_start can emit the required + copies. */ + auto_vec marked_parms; + for (tree parm = DECL_ARGUMENTS (current_function_decl); parm; + parm = DECL_CHAIN (parm)) + if (!TREE_ADDRESSABLE (parm) + && bitmap_bit_p (forced_stack_vars, DECL_UID (parm))) + { + TREE_ADDRESSABLE (parm) = 1; + marked_parms.safe_push (parm); + } + if (DECL_RESULT (current_function_decl) + && !TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) + && bitmap_bit_p (forced_stack_vars, + DECL_UID (DECL_RESULT (current_function_decl)))) + { + TREE_ADDRESSABLE (DECL_RESULT (current_function_decl)) = 1; + marked_parms.safe_push (DECL_RESULT (current_function_decl)); + } + /* Set up parameters and prepare for return, for the function. */ expand_function_start (current_function_decl); + /* Clear TREE_ADDRESSABLE again. */ + while (!marked_parms.is_empty ()) + TREE_ADDRESSABLE (marked_parms.pop ()) = 0; + /* If we emitted any instructions for setting up the variables, emit them before the FUNCTION_START note. */ if (var_seq) -- cgit v1.1 From d39fbed75810fc7478842503ecb0268b85dc9c2e Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 18 May 2021 15:45:54 +0200 Subject: i386: Fix split_double_mode with paradoxical subreg [PR100626] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit split_double_mode calls simplify_gen_subreg, which fails for the high half of the paradoxical subreg. Return temporary register instead of NULL RTX in this case. 2021-05-18 Uroš Bizjak gcc/ PR target/100626 * config/i386/i386-expand.c (split_double_mode): Return temporary register when simplify_gen_subreg fails with the high half od the paradoxical subreg. --- gcc/config/i386/i386-expand.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/i386-expand.c b/gcc/config/i386/i386-expand.c index 0fa8d45..9f3d419 100644 --- a/gcc/config/i386/i386-expand.c +++ b/gcc/config/i386/i386-expand.c @@ -154,9 +154,13 @@ split_double_mode (machine_mode mode, rtx operands[], lo_half[num] = simplify_gen_subreg (half_mode, op, GET_MODE (op) == VOIDmode ? mode : GET_MODE (op), 0); - hi_half[num] = simplify_gen_subreg (half_mode, op, - GET_MODE (op) == VOIDmode - ? mode : GET_MODE (op), byte); + + rtx tmp = simplify_gen_subreg (half_mode, op, + GET_MODE (op) == VOIDmode + ? mode : GET_MODE (op), byte); + /* simplify_gen_subreg will return NULL RTX for the + high half of the paradoxical subreg. */ + hi_half[num] = tmp ? tmp : gen_reg_rtx (half_mode); } } } -- cgit v1.1 From 8b9484c54b4000209d4bfb270e22c9c8b9673fdb Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 18 May 2021 15:56:22 +0200 Subject: i386: Fix v4qiv4di2 expander MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix a mode mismatch. 2021-05-18 Uroš Bizjak gcc/ * config/i386/sse.md (v4qiv4di2): Fix a mode mismatch with operand 1. --- gcc/config/i386/sse.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/config/i386/sse.md b/gcc/config/i386/sse.md index 62f4e15f..a4503dd 100644 --- a/gcc/config/i386/sse.md +++ b/gcc/config/i386/sse.md @@ -18558,8 +18558,8 @@ { if (!MEM_P (operands[1])) { - operands[1] = force_reg (V8QImode, operands[1]); - operands[1] = simplify_gen_subreg (V16QImode, operands[1], V8QImode, 0); + operands[1] = force_reg (V4QImode, operands[1]); + operands[1] = simplify_gen_subreg (V16QImode, operands[1], V4QImode, 0); emit_insn (gen_avx2_v4qiv4di2 (operands[0], operands[1])); DONE; } -- cgit v1.1 From cc193ac840d58ee0ffb57b14b542706cde3db0e7 Mon Sep 17 00:00:00 2001 From: Tobias Burnus Date: Tue, 18 May 2021 16:40:45 +0200 Subject: Fortran/OpenMP: Add missing EXEC_OMP_DEPOBJ case val [PR100642] PR fortran/100642 gcc/fortran/ChangeLog: * openmp.c (omp_code_to_statement): Add missing EXEC_OMP_DEPOBJ. gcc/testsuite/ChangeLog: * gfortran.dg/goacc-gomp/depobj.f90: New test. --- gcc/fortran/openmp.c | 3 ++- gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 (limited to 'gcc') diff --git a/gcc/fortran/openmp.c b/gcc/fortran/openmp.c index 294b6d0..005b6c1 100644 --- a/gcc/fortran/openmp.c +++ b/gcc/fortran/openmp.c @@ -6902,7 +6902,8 @@ omp_code_to_statement (gfc_code *code) return ST_OMP_PARALLEL_DO; case EXEC_OMP_PARALLEL_DO_SIMD: return ST_OMP_PARALLEL_DO_SIMD; - + case EXEC_OMP_DEPOBJ: + return ST_OMP_DEPOBJ; default: gcc_unreachable (); } diff --git a/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 new file mode 100644 index 0000000..e1c6830 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/goacc-gomp/depobj.f90 @@ -0,0 +1,11 @@ +! PR fortran/100642 +! Contributed by G. Steinmetz +program p + !use omp_lib, only: omp_depend_kind + use iso_c_binding, only: c_intptr_t + integer, parameter :: omp_depend_kind = 2*c_intptr_t + integer(omp_depend_kind) :: a, b + !$acc data + !$omp depobj(b) depend(out:a) ! { dg-error "The !\\\$OMP DEPOBJ directive cannot be specified within a !\\\$ACC DATA region" } + !$acc end data +end -- cgit v1.1 From 46ca31d65092e5afcef292f807fcf14c5363280d Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Tue, 18 May 2021 17:25:54 +0200 Subject: i386: Implement 4-byte vector support [PR100637] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add infrastructure, logic and arithmetic support for 4-byte vectors. These can be used with SSE2 targets, where movd instructions from/to XMM registers are available. x86_64 ABI passes 4-byte vectors in integer registers, so also add logic operations with integer registers. 2021-05-18 Uroš Bizjak gcc/ PR target/100637 * config/i386/i386.h (VALID_SSE2_REG_MODE): Add V4QI and V2HI modes. (VALID_INT_MODE_P): Ditto. * config/i386/mmx.md (VI_32): New mode iterator. (mmxvecsize): Handle V4QI and V2HI. (Yv_Yw): Ditto. (mov): New expander. (*mov_internal): New insn pattern. (movmisalign): New expander. (neg): New expander. (3): New expander. (*3): New insn pattern. (mulv2hi3): New expander. (*mulv2hi3): New insn pattern. (one_cmpl2): New expander. (*andnot3): New insn pattern. (3): New expander. (*3): New insn pattern. gcc/testsuite/ PR target/100637 * gcc.target/i386/pr100637-1b.c: New test. * gcc.target/i386/pr100637-1w.c: Ditto. * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq. * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq. * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb. * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for pmovsxbd and pmovsxwq. * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for pmovzxbd and pmovzxwq. --- gcc/config/i386/i386.h | 15 +- gcc/config/i386/mmx.md | 195 ++++++++++++++++++++++- gcc/testsuite/gcc.target/i386/pr100637-1b.c | 25 +++ gcc/testsuite/gcc.target/i386/pr100637-1w.c | 28 ++++ gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-avx2.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c | 2 +- gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c | 4 +- gcc/testsuite/gcc.target/i386/pr92658-sse4.c | 4 +- 9 files changed, 260 insertions(+), 17 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pr100637-1b.c create mode 100644 gcc/testsuite/gcc.target/i386/pr100637-1w.c (limited to 'gcc') diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 97d6f38..d15f9b2 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -1007,6 +1007,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define VALID_SSE2_REG_MODE(MODE) \ ((MODE) == V16QImode || (MODE) == V8HImode || (MODE) == V2DFmode \ + || (MODE) == V4QImode || (MODE) == V2HImode \ || (MODE) == V2DImode || (MODE) == DFmode) #define VALID_SSE_REG_MODE(MODE) \ @@ -1034,12 +1035,14 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); || (MODE) == SCmode || (MODE) == DCmode || (MODE) == XCmode) \ #define VALID_INT_MODE_P(MODE) \ - ((MODE) == QImode || (MODE) == HImode || (MODE) == SImode \ - || (MODE) == DImode \ - || (MODE) == CQImode || (MODE) == CHImode || (MODE) == CSImode \ - || (MODE) == CDImode \ - || (TARGET_64BIT && ((MODE) == TImode || (MODE) == CTImode \ - || (MODE) == TFmode || (MODE) == TCmode))) + ((MODE) == QImode || (MODE) == HImode \ + || (MODE) == SImode || (MODE) == DImode \ + || (MODE) == CQImode || (MODE) == CHImode \ + || (MODE) == CSImode || (MODE) == CDImode \ + || (TARGET_64BIT \ + && ((MODE) == TImode || (MODE) == CTImode \ + || (MODE) == TFmode || (MODE) == TCmode)) \ + || (MODE) == V4QImode || (MODE) == V2HImode) /* Return true for modes passed in SSE registers. */ #define SSE_REG_MODE_P(MODE) \ diff --git a/gcc/config/i386/mmx.md b/gcc/config/i386/mmx.md index 7fc2e5d..7806b62 100644 --- a/gcc/config/i386/mmx.md +++ b/gcc/config/i386/mmx.md @@ -57,11 +57,15 @@ (define_mode_iterator MMXMODE24 [V4HI V2SI]) (define_mode_iterator MMXMODE248 [V4HI V2SI V1DI]) +;; All 32bit integer vector modes +(define_mode_iterator VI_32 [V4QI V2HI]) + ;; All V2S* modes (define_mode_iterator V2FI [V2SF V2SI]) ;; Mapping from integer vector mode to mnemonic suffix -(define_mode_attr mmxvecsize [(V8QI "b") (V4HI "w") (V2SI "d") (V1DI "q")]) +(define_mode_attr mmxvecsize + [(V8QI "b") (V4QI "b") (V4HI "w") (V2HI "w") (V2SI "d") (V1DI "q")]) (define_mode_attr mmxdoublemode [(V8QI "V8HI") (V4HI "V4SI")]) @@ -74,7 +78,8 @@ [(V2SF "v2si") (V2SI "v2si") (V4HI "v4hi") (V8QI "v8qi")]) (define_mode_attr Yv_Yw - [(V8QI "Yw") (V4HI "Yw") (V2SI "Yv") (V1DI "Yv") (V2SF "Yv")]) + [(V8QI "Yw") (V4QI "Yw") (V4HI "Yw") (V2HI "Yw") + (V2SI "Yv") (V1DI "Yv") (V2SF "Yv")]) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; @@ -233,6 +238,80 @@ DONE; }) +(define_expand "mov" + [(set (match_operand:VI_32 0 "nonimmediate_operand") + (match_operand:VI_32 1 "nonimmediate_operand"))] + "TARGET_SSE2" +{ + ix86_expand_vector_move (mode, operands); + DONE; +}) + +(define_insn "*mov_internal" + [(set (match_operand:VI_32 0 "nonimmediate_operand" + "=r ,m ,v,v,v,m,r,v") + (match_operand:VI_32 1 "general_operand" + "rmC,rC,C,v,m,v,v,r"))] + "TARGET_SSE2 && + !(MEM_P (operands[0]) && MEM_P (operands[1]))" +{ + switch (get_attr_type (insn)) + { + case TYPE_IMOV: + return "mov{l}\t{%1, %0|%0, %1}"; + + case TYPE_SSELOG1: + return standard_sse_constant_opcode (insn, operands); + + case TYPE_SSEMOV: + return ix86_output_ssemov (insn, operands); + + default: + gcc_unreachable (); + } +} + [(set (attr "type") + (cond [(eq_attr "alternative" "2") + (const_string "sselog1") + (eq_attr "alternative" "3,4,5,6,7") + (const_string "ssemov") + ] + (const_string "imov"))) + (set (attr "prefix") + (if_then_else (eq_attr "type" "sselog1,ssemov") + (const_string "maybe_vex") + (const_string "orig"))) + (set (attr "prefix_data16") + (if_then_else (and (eq_attr "type" "ssemov") (eq_attr "mode" "SI")) + (const_string "1") + (const_string "*"))) + (set (attr "mode") + (cond [(eq_attr "alternative" "2,3") + (cond [(match_test "TARGET_AVX") + (const_string "TI") + (match_test "optimize_function_for_size_p (cfun)") + (const_string "V4SF") + ] + (const_string "TI")) + ] + (const_string "SI"))) + (set (attr "preferred_for_speed") + (cond [(eq_attr "alternative" "6") + (symbol_ref "TARGET_INTER_UNIT_MOVES_FROM_VEC") + (eq_attr "alternative" "7") + (symbol_ref "TARGET_INTER_UNIT_MOVES_TO_VEC") + ] + (symbol_ref "true")))]) + +(define_expand "movmisalign" + [(set (match_operand:VI_32 0 "nonimmediate_operand") + (match_operand:VI_32 1 "nonimmediate_operand"))] + "TARGET_SSE2" +{ + ix86_expand_vector_move (mode, operands); + DONE; +}) + (define_insn "sse_movntq" [(set (match_operand:DI 0 "memory_operand" "=m,m") (unspec:DI [(match_operand:DI 1 "register_operand" "y,r")] @@ -1229,6 +1308,14 @@ ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +(define_expand "neg2" + [(set (match_operand:MMXMODEI 0 "register_operand") + (minus:MMXMODEI + (match_dup 2) + (match_operand:MMXMODEI 1 "register_operand")))] + "TARGET_MMX_WITH_SSE" + "operands[2] = force_reg (mode, CONST0_RTX (mode));") + (define_expand "mmx_3" [(set (match_operand:MMXMODEI8 0 "register_operand") (plusminus:MMXMODEI8 @@ -1248,8 +1335,10 @@ (define_insn "*mmx_3" [(set (match_operand:MMXMODEI8 0 "register_operand" "=y,x,") (plusminus:MMXMODEI8 - (match_operand:MMXMODEI8 1 "register_mmxmem_operand" "0,0,") - (match_operand:MMXMODEI8 2 "register_mmxmem_operand" "ym,x,")))] + (match_operand:MMXMODEI8 1 "register_mmxmem_operand" + "0,0,") + (match_operand:MMXMODEI8 2 "register_mmxmem_operand" + "ym,x,")))] "(TARGET_MMX || TARGET_MMX_WITH_SSE) && ix86_binary_operator_ok (, mode, operands)" "@ @@ -1261,6 +1350,36 @@ (set_attr "type" "mmxadd,sseadd,sseadd") (set_attr "mode" "DI,TI,TI")]) +(define_expand "neg2" + [(set (match_operand:VI_32 0 "register_operand") + (minus:VI_32 + (match_dup 2) + (match_operand:VI_32 1 "register_operand")))] + "TARGET_SSE2" + "operands[2] = force_reg (mode, CONST0_RTX (mode));") + +(define_expand "3" + [(set (match_operand:VI_32 0 "register_operand") + (plusminus:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_operand:VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (, mode, operands);") + +(define_insn "*3" + [(set (match_operand:VI_32 0 "register_operand" "=x,") + (plusminus:VI_32 + (match_operand:VI_32 1 "register_operand" "0,") + (match_operand:VI_32 2 "register_operand" "x,")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (, mode, operands)" + "@ + p\t{%2, %0|%0, %2} + vp\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "sseadd") + (set_attr "mode" "TI")]) + (define_expand "mmx_3" [(set (match_operand:MMXMODE12 0 "register_operand") (sat_plusminus:MMXMODE12 @@ -1314,6 +1433,26 @@ (set_attr "type" "mmxmul,ssemul,ssemul") (set_attr "mode" "DI,TI,TI")]) +(define_expand "mulv2hi3" + [(set (match_operand:V2HI 0 "register_operand") + (mult:V2HI (match_operand:V2HI 1 "register_operand") + (match_operand:V2HI 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (MULT, V2HImode, operands);") + +(define_insn "*mulv2hi3" + [(set (match_operand:V2HI 0 "register_operand" "=x,Yw") + (mult:V2HI (match_operand:V2HI 1 "register_operand" "%0,Yw") + (match_operand:V2HI 2 "register_operand" "x,Yw")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (MULT, V2HImode, operands)" + "@ + pmullw\t{%2, %0|%0, %2} + vpmullw\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "noavx,avx") + (set_attr "type" "ssemul") + (set_attr "mode" "TI")]) + (define_expand "mmx_smulv4hi3_highpart" [(set (match_operand:V4HI 0 "register_operand") (truncate:V4HI @@ -1839,6 +1978,14 @@ "TARGET_MMX_WITH_SSE" "operands[2] = force_reg (mode, CONSTM1_RTX (mode));") +(define_expand "one_cmpl2" + [(set (match_operand:VI_32 0 "register_operand") + (xor:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_dup 2)))] + "TARGET_SSE2" + "operands[2] = force_reg (mode, CONSTM1_RTX (mode));") + (define_insn "mmx_andnot3" [(set (match_operand:MMXMODEI 0 "register_operand" "=y,x,x,v") (and:MMXMODEI @@ -1855,6 +2002,22 @@ (set_attr "type" "mmxadd,sselog,sselog,sselog") (set_attr "mode" "DI,TI,TI,TI")]) +(define_insn "*andnot3" + [(set (match_operand:VI_32 0 "register_operand" "=r,x,x,v") + (and:VI_32 + (not:VI_32 (match_operand:VI_32 1 "register_operand" "r,0,x,v")) + (match_operand:VI_32 2 "register_operand" "r,x,x,v")))] + "TARGET_SSE2" + "@ + andn\t{%2, %1, %0|%0, %1, %2} + pandn\t{%2, %0|%0, %2} + vpandn\t{%2, %1, %0|%0, %1, %2} + vpandnd\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "bmi,noavx,avx,avx512vl") + (set_attr "type" "bitmanip,sselog,sselog,sselog") + (set_attr "btver2_decode" "direct,*,*,*") + (set_attr "mode" "SI,TI,TI,TI")]) + (define_expand "mmx_3" [(set (match_operand:MMXMODEI 0 "register_operand") (any_logic:MMXMODEI @@ -1888,6 +2051,30 @@ (set_attr "type" "mmxadd,sselog,sselog,sselog") (set_attr "mode" "DI,TI,TI,TI")]) +(define_expand "3" + [(set (match_operand:VI_32 0 "register_operand") + (any_logic:VI_32 + (match_operand:VI_32 1 "register_operand") + (match_operand:VI_32 2 "register_operand")))] + "TARGET_SSE2" + "ix86_fixup_binary_operands_no_copy (, mode, operands);") + +(define_insn "*3" + [(set (match_operand:VI_32 0 "register_operand" "=r,x,x,v") + (any_logic:VI_32 + (match_operand:VI_32 1 "register_operand" "%0,0,x,v") + (match_operand:VI_32 2 "register_operand" "r,x,x,v")))] + "TARGET_SSE2 + && ix86_binary_operator_ok (, mode, operands)" + "@ + \t{%2, %0|%0, %2} + p\t{%2, %0|%0, %2} + vp\t{%2, %1, %0|%0, %1, %2} + vpd\t{%2, %1, %0|%0, %1, %2}" + [(set_attr "isa" "*,noavx,avx,avx512vl") + (set_attr "type" "alu,sselog,sselog,sselog") + (set_attr "mode" "SI,TI,TI,TI")]) + ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Parallel integral element swizzling diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1b.c b/gcc/testsuite/gcc.target/i386/pr100637-1b.c new file mode 100644 index 0000000..3e7445a --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1b.c @@ -0,0 +1,25 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef char __v4qi __attribute__ ((__vector_size__ (4))); + +__v4qi and (__v4qi a, __v4qi b) { return a & b; }; +/* { dg-final { scan-assembler "andv4qi3" } } */ + +__v4qi andn (__v4qi a, __v4qi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv4qi3" } } */ + +__v4qi or (__v4qi a, __v4qi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv4qi3" } } */ + +__v4qi xor (__v4qi a, __v4qi b) { return a ^ b; }; +__v4qi not (__v4qi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv4qi3" 2 } } */ + +__v4qi plus (__v4qi a, __v4qi b) { return a + b; }; +/* { dg-final { scan-assembler "addv4qi3" } } */ + +__v4qi minus (__v4qi a, __v4qi b) { return a - b; }; +__v4qi neg (__v4qi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv4qi3" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr100637-1w.c b/gcc/testsuite/gcc.target/i386/pr100637-1w.c new file mode 100644 index 0000000..ed1baeb --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr100637-1w.c @@ -0,0 +1,28 @@ +/* PR target/100637 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -msse2 -dp" } */ + +typedef short __v2hi __attribute__ ((__vector_size__ (4))); + +__v2hi and (__v2hi a, __v2hi b) { return a & b; }; +/* { dg-final { scan-assembler "andv2hi3" } } */ + +__v2hi andn (__v2hi a, __v2hi b) { return a & ~b; }; +/* { dg-final { scan-assembler "andnotv2hi3" } } */ + +__v2hi or (__v2hi a, __v2hi b) { return a | b; }; +/* { dg-final { scan-assembler "iorv2hi3" } } */ + +__v2hi xor (__v2hi a, __v2hi b) { return a ^ b; }; +__v2hi not (__v2hi a) { return ~a; }; +/* { dg-final { scan-assembler-times "xorv2hi3" 2 } } */ + +__v2hi plus (__v2hi a, __v2hi b) { return a + b; }; +/* { dg-final { scan-assembler "addv2hi3" } } */ + +__v2hi minus (__v2hi a, __v2hi b) { return a - b; }; +__v2hi neg (__v2hi a) { return -a; }; +/* { dg-final { scan-assembler-times "subv2hi3" 2 } } */ + +__v2hi mul (__v2hi a, __v2hi b) { return a * b; }; +/* { dg-final { scan-assembler "mulv2hi3" } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c index 7aad858..6c30702 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2-2.c @@ -109,7 +109,7 @@ bar_s8_s64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbq" 2 } } */ void foo_s16_s32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c index 21fa3e5..70b5bdb 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx2.c @@ -109,7 +109,7 @@ bar_u8_u64 (v4di * dst, v32qi src) dst[0] = *(v4di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbq" 2 } } */ void foo_u16_u32 (v8si * dst, v16hi * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c index dc50084..a9f7d7e 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-avx512vl.c @@ -126,4 +126,4 @@ truncdb_128 (v16qi * dst, v4si * __restrict src) /* { dg-final { scan-assembler-times "vpmovqb" 2 { xfail *-*-* } } } */ /* { dg-final { scan-assembler-times "vpmovdw" 1 } } */ /* { dg-final { scan-assembler-times "vpmovdw" 2 { xfail *-*-* } } } */ -/* { dg-final { scan-assembler-times "vpmovdb" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "vpmovdb" 2 } } */ diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c index ca174ce..53e89ad 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4-2.c @@ -61,7 +61,7 @@ bar_s8_s32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovsxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxbd" 2 } } */ void foo_s8_s64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_s16_s64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovsxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovsxwq" 2 } } */ void foo_s32_s64 (v2di * dst, v4si * __restrict src) diff --git a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c index e462629..e12e163 100644 --- a/gcc/testsuite/gcc.target/i386/pr92658-sse4.c +++ b/gcc/testsuite/gcc.target/i386/pr92658-sse4.c @@ -61,7 +61,7 @@ bar_u8_u32 (v4si * dst, v16qi src) dst[0] = *(v4si *) tem; } -/* { dg-final { scan-assembler-times "pmovzxbd" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxbd" 2 } } */ void foo_u8_u64 (v2di * dst, v16qi * __restrict src) @@ -125,7 +125,7 @@ bar_u16_u64 (v2di * dst, v8hi src) dst[0] = *(v2di *) tem; } -/* { dg-final { scan-assembler-times "pmovzxwq" 2 { xfail *-*-* } } } */ +/* { dg-final { scan-assembler-times "pmovzxwq" 2 } } */ void foo_u32_u64 (v2di * dst, v4si * __restrict src) -- cgit v1.1 From cd323d97d0592135ca4345701ef051659d8d4507 Mon Sep 17 00:00:00 2001 From: David Malcolm Date: Tue, 18 May 2021 12:29:58 -0400 Subject: analyzer: fix missing leak after call to strsep [PR100615] PR analyzer/100615 reports a missing leak diagnostic. The issue is that the code calls strsep which the analyzer doesn't have special knowledge of, and so conservatively assumes that it could free the pointer, so drops malloc state for it. Properly "teaching" the analyzer about strsep would require it to support bifurcating state at a call, which is currently fiddly to do, so for now this patch notes that strsep doesn't affect the malloc state machine, allowing the analyzer to correctly detect the leak. gcc/analyzer/ChangeLog: PR analyzer/100615 * sm-malloc.cc: Include "analyzer/function-set.h". (malloc_state_machine::on_stmt): Call unaffected_by_call_p and bail on the functions it recognizes. (malloc_state_machine::unaffected_by_call_p): New. gcc/testsuite/ChangeLog: PR analyzer/100615 * gcc.dg/analyzer/pr100615.c: New test. --- gcc/analyzer/sm-malloc.cc | 28 +++++++++++++++++ gcc/testsuite/gcc.dg/analyzer/pr100615.c | 53 ++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/analyzer/pr100615.c (limited to 'gcc') diff --git a/gcc/analyzer/sm-malloc.cc b/gcc/analyzer/sm-malloc.cc index f02b73a..a1582ca 100644 --- a/gcc/analyzer/sm-malloc.cc +++ b/gcc/analyzer/sm-malloc.cc @@ -44,6 +44,7 @@ along with GCC; see the file COPYING3. If not see #include "analyzer/region-model.h" #include "stringpool.h" #include "attribs.h" +#include "analyzer/function-set.h" #if ENABLE_ANALYZER @@ -384,6 +385,8 @@ public: bool reset_when_passed_to_unknown_fn_p (state_t s, bool is_mutable) const FINAL OVERRIDE; + static bool unaffected_by_call_p (tree fndecl); + standard_deallocator_set m_free; standard_deallocator_set m_scalar_delete; standard_deallocator_set m_vector_delete; @@ -1569,6 +1572,9 @@ malloc_state_machine::on_stmt (sm_context *sm_ctxt, return true; } + if (unaffected_by_call_p (callee_fndecl)) + return true; + /* Cast away const-ness for cache-like operations. */ malloc_state_machine *mutable_this = const_cast (this); @@ -1925,6 +1931,28 @@ malloc_state_machine::reset_when_passed_to_unknown_fn_p (state_t s, return is_mutable; } +/* Return true if calls to FNDECL are known to not affect this sm-state. */ + +bool +malloc_state_machine::unaffected_by_call_p (tree fndecl) +{ + /* A set of functions that are known to not affect allocation + status, even if we haven't fully modelled the rest of their + behavior yet. */ + static const char * const funcnames[] = { + /* This array must be kept sorted. */ + "strsep", + }; + const size_t count + = sizeof(funcnames) / sizeof (funcnames[0]); + function_set fs (funcnames, count); + + if (fs.contains_decl_p (fndecl)) + return true; + + return false; +} + /* Shared logic for handling GIMPLE_ASSIGNs and GIMPLE_PHIs that assign zero to LHS. */ diff --git a/gcc/testsuite/gcc.dg/analyzer/pr100615.c b/gcc/testsuite/gcc.dg/analyzer/pr100615.c new file mode 100644 index 0000000..7a06f98 --- /dev/null +++ b/gcc/testsuite/gcc.dg/analyzer/pr100615.c @@ -0,0 +1,53 @@ +/* Adapted from + https://github.com/stackpath/rxtxcpu/blob/816d86c5d49c4db2ea5649f6b87e96da5af660f1/cpu.c + which is MIT-licensed. */ + +typedef __SIZE_TYPE__ size_t; +#define NULL ((void *)0) + +extern size_t strlen (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__pure__)) + __attribute__ ((__nonnull__ (1))); +extern char *strdup (const char *__s) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__malloc__)) + __attribute__ ((__nonnull__ (1))); +extern char *strsep (char **__restrict __stringp, + const char *__restrict __delim) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1, 2))); +extern long int strtol (const char *__restrict __nptr, + char **__restrict __endptr, int __base) + __attribute__ ((__nothrow__ , __leaf__)) + __attribute__ ((__nonnull__ (1))); +extern void free (void *__ptr) + __attribute__ ((__nothrow__ , __leaf__)); + +#define CPU_LIST_BASE 10 + +int parse_cpu_list(char *cpu_list) { + if (strlen(cpu_list) == 0) { + return 0; + } + + char *endptr; + char *tofree, *string, *range; + + tofree = string = strdup(cpu_list); /* { dg-message "allocated here" } */ + + while ((range = strsep(&string, ",")) != NULL) { + int first = strtol(range, &endptr, CPU_LIST_BASE); + if (!*endptr) { + continue; + } + char *save = endptr; + endptr++; + int last = strtol(endptr, &endptr, CPU_LIST_BASE); + if (save[0] != '-' || *endptr || last < first) { + return -1; /* { dg-warning "leak of 'tofree'" } */ + } + } + free(tofree); + return 0; +} -- cgit v1.1 From f71ca97def69b8aeb046d716eaea2367736f505e Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 12:06:36 -0400 Subject: c++: "perfect" implicitly deleted move [PR100644] Here we were ignoring the template constructor because the implicit move constructor had all perfect conversions. But CWG1402 says that an implicitly deleted move constructor is ignored by overload resolution; we implement that instead by preferring any other candidate in joust, to get better diagnostics, but that means we need to handle that case here as well. gcc/cp/ChangeLog: PR c++/100644 * call.c (perfect_candidate_p): An implicitly deleted move is not perfect. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/implicit-delete1.C: New test. --- gcc/cp/call.c | 5 +++++ gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C (limited to 'gcc') diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 1e2d1d4..4a59b97 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -5890,6 +5890,11 @@ perfect_candidate_p (z_candidate *cand) { if (cand->viable < 1) return false; + /* CWG1402 makes an implicitly deleted move op worse than other + candidates. */ + if (DECL_DELETED_FN (cand->fn) && DECL_DEFAULTED_FN (cand->fn) + && move_fn_p (cand->fn)) + return false; int len = cand->num_convs; for (int i = 0; i < len; ++i) if (!perfect_conversion_p (cand->convs[i])) diff --git a/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C new file mode 100644 index 0000000..6dcced4 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/implicit-delete1.C @@ -0,0 +1,20 @@ +// PR c++/100644 +// { dg-do compile { target c++11 } } + +struct NonMovable { + NonMovable(NonMovable&&) = delete; +}; + +template +struct Maybe { + NonMovable mMember; + + template + Maybe(Maybe&&); +}; + +void foo(Maybe); + +void unlucky(Maybe&& x) { + Maybe var{(Maybe&&)x}; +} -- cgit v1.1 From 8c114759b8c9c9e2ec90b82d92a24b5a71647017 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 12:18:56 -0400 Subject: c++: non-static member, decltype, {} [PR100205] This test was fixed by my second patch for PR93314, which distinguishes between constant-expression and potentially-constant-evaluated contexts in a way that my first patch did not. PR c++/100205 PR c++/99314 gcc/testsuite/ChangeLog: * g++.dg/cpp0x/decltype-nonstatic1.C: New test. --- gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C (limited to 'gcc') diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C new file mode 100644 index 0000000..bc488ff --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype-nonstatic1.C @@ -0,0 +1,16 @@ +// PR c++/100205 +// { dg-do compile { target c++11 } } + +struct coordinate_matrix { + using index_t = unsigned; + struct convert_to_matrix_coordinate { + index_t column_id; + }; + index_t column_id; + + // does not work + using value_type2 = decltype(convert_to_matrix_coordinate{column_id}); + + // does work + using value_type5 = decltype(column_id); +}; -- cgit v1.1 From fef7c8990da15493110118554adfc9a0b779604c Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Thu, 11 Mar 2021 14:01:52 -0500 Subject: c++: Prune dead functions. I was looking at the LCOV coverage report for the C++ FE and found a bunch of unused functions that I think we can remove. Obviously, I left alone various dump_* and debug_* routines. I haven't removed cp_build_function_call although it is also currently unused. * lambda_return_type: was used in parser.c in GCC 7, unused since r255950, * classtype_has_non_deleted_copy_ctor: appeared in GCC 10, its usage was removed in c++/95350, * contains_wildcard_p: used in GCC 9, unused since r276764, * get_template_head_requirements: seems to never have been used, * check_constrained_friend: seems to never have been used, * subsumes_constraints: unused since r276764, * push_void_library_fn: usage removed in r248328, * get_template_parms_at_level: unused since r157857, * get_pattern_parm: unused since r275387. (Some of the seemingly unused functions, such as set_global_friend, are actually used in libcc1.) gcc/cp/ChangeLog: * class.c (classtype_has_non_deleted_copy_ctor): Remove. * constraint.cc (contains_wildcard_p): Likewise. (get_template_head_requirements): Likewise. (check_constrained_friend): Likewise. (subsumes_constraints): Likewise. * cp-tree.h (classtype_has_non_deleted_copy_ctor): Likewise. (push_void_library_fn): Likewise. (get_pattern_parm): Likewise. (get_template_parms_at_level): Likewise. (lambda_return_type): Likewise. (get_template_head_requirements): Likewise. (check_constrained_friend): Likewise. (subsumes_constraints): Likewise. * decl.c (push_void_library_fn): Likewise. * lambda.c (lambda_return_type): Likewise. * pt.c (get_template_parms_at_level): Likewise. (get_pattern_parm): Likewise. --- gcc/cp/class.c | 13 ----------- gcc/cp/constraint.cc | 62 ---------------------------------------------------- gcc/cp/cp-tree.h | 8 ------- gcc/cp/decl.c | 10 --------- gcc/cp/lambda.c | 18 --------------- gcc/cp/pt.c | 49 ----------------------------------------- 6 files changed, 160 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 66bc1ee..354addd 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -5604,19 +5604,6 @@ classtype_has_non_deleted_move_ctor (tree t) return false; } -/* True iff T has a copy constructor that is not deleted. */ - -bool -classtype_has_non_deleted_copy_ctor (tree t) -{ - if (CLASSTYPE_LAZY_COPY_CTOR (t)) - lazily_declare_fn (sfk_copy_constructor, t); - for (ovl_iterator iter (CLASSTYPE_CONSTRUCTORS (t)); iter; ++iter) - if (copy_fn_p (*iter) && !DECL_DELETED_FN (*iter)) - return true; - return false; -} - /* If T, a class, has a user-provided copy constructor, copy assignment operator, or destructor, returns that function. Otherwise, null. */ diff --git a/gcc/cp/constraint.cc b/gcc/cp/constraint.cc index 30fccc4..03ce8eb 100644 --- a/gcc/cp/constraint.cc +++ b/gcc/cp/constraint.cc @@ -278,21 +278,6 @@ get_concept_check_template (tree t) return tmpl; } -/* Returns true if any of the arguments in the template argument list is - a wildcard or wildcard pack. */ - -bool -contains_wildcard_p (tree args) -{ - for (int i = 0; i < TREE_VEC_LENGTH (args); ++i) - { - tree arg = TREE_VEC_ELT (args, i); - if (TREE_CODE (arg) == WILDCARD_DECL) - return true; - } - return false; -} - /*--------------------------------------------------------------------------- Resolution of qualified concept names ---------------------------------------------------------------------------*/ @@ -1310,18 +1295,6 @@ maybe_substitute_reqs_for (tree reqs, const_tree decl_) return reqs; } -/* Returns the template-head requires clause for the template - declaration T or NULL_TREE if none. */ - -tree -get_template_head_requirements (tree t) -{ - tree ci = get_constraints (t); - if (!ci) - return NULL_TREE; - return CI_TEMPLATE_REQS (ci); -} - /* Returns the trailing requires clause of the declarator of a template declaration T or NULL_TREE if none. */ @@ -3469,31 +3442,6 @@ check_function_concept (tree fn) return NULL_TREE; } - -// Check that a constrained friend declaration function declaration, -// FN, is admissible. This is the case only when the declaration depends -// on template parameters and does not declare a specialization. -void -check_constrained_friend (tree fn, tree reqs) -{ - if (fn == error_mark_node) - return; - gcc_assert (TREE_CODE (fn) == FUNCTION_DECL); - - // If there are not constraints, this cannot be an error. - if (!reqs) - return; - - // Constrained friend functions that don't depend on template - // arguments are effectively meaningless. - if (!uses_template_parms (TREE_TYPE (fn))) - { - error_at (location_of (fn), - "constrained friend does not depend on template parameters"); - return; - } -} - /*--------------------------------------------------------------------------- Equivalence of constraints ---------------------------------------------------------------------------*/ @@ -3521,16 +3469,6 @@ equivalently_constrained (tree d1, tree d2) Partial ordering of constraints ---------------------------------------------------------------------------*/ -/* Returns true when the constraints in A subsume those in B. */ - -bool -subsumes_constraints (tree a, tree b) -{ - gcc_assert (!a || TREE_CODE (a) == CONSTRAINT_INFO); - gcc_assert (!b || TREE_CODE (b) == CONSTRAINT_INFO); - return subsumes (a, b); -} - /* Returns true when the constraints in CI strictly subsume the associated constraints of TMPL. */ diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index 580db91..3c900dc 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -6568,7 +6568,6 @@ extern bool type_has_constexpr_destructor (tree); extern bool type_has_virtual_destructor (tree); extern bool classtype_has_move_assign_or_move_ctor_p (tree, bool user_declared); extern bool classtype_has_non_deleted_move_ctor (tree); -extern bool classtype_has_non_deleted_copy_ctor (tree); extern tree classtype_has_depr_implicit_copy (tree); extern bool classtype_has_op (tree, tree_code); extern tree classtype_has_defaulted_op (tree, tree_code); @@ -6654,7 +6653,6 @@ extern void pop_abi_namespace (unsigned flags, extern tree build_library_fn_ptr (const char *, tree, int); extern tree build_cp_library_fn_ptr (const char *, tree, int); extern tree push_library_fn (tree, tree, tree, int); -extern tree push_void_library_fn (tree, tree, int); extern tree push_throw_library_fn (tree, tree); extern void warn_misplaced_attr_for_class_type (location_t location, tree class_type); @@ -7179,7 +7177,6 @@ extern tree get_template_info (const_tree); extern int template_class_depth (tree); extern int is_specialization_of (tree, tree); extern bool is_specialization_of_friend (tree, tree); -extern tree get_pattern_parm (tree, tree); extern int comp_template_args (tree, tree, tree * = NULL, tree * = NULL, bool = false); extern int template_args_equal (tree, tree, bool = false); @@ -7253,7 +7250,6 @@ bool template_template_parameter_p (const_tree); bool template_type_parameter_p (const_tree); extern bool primary_template_specialization_p (const_tree); extern tree get_primary_template_innermost_parameters (const_tree); -extern tree get_template_parms_at_level (tree, int); extern tree get_template_innermost_arguments (const_tree); extern tree get_template_argument_pack_elems (const_tree); extern tree get_function_template_decl (const_tree); @@ -7556,7 +7552,6 @@ extern tree build_lambda_expr (void); extern tree build_lambda_object (tree); extern tree begin_lambda_type (tree); extern tree lambda_capture_field_type (tree, bool, bool); -extern tree lambda_return_type (tree); extern tree lambda_proxy_type (tree); extern tree lambda_function (tree); extern void apply_deduced_return_type (tree, tree); @@ -8109,7 +8104,6 @@ extern tree current_template_constraints (void); extern tree associate_classtype_constraints (tree); extern tree build_constraints (tree, tree); extern tree maybe_substitute_reqs_for (tree, const_tree); -extern tree get_template_head_requirements (tree); extern tree get_trailing_function_requirements (tree); extern tree get_shorthand_constraints (tree); @@ -8135,7 +8129,6 @@ extern tree finish_simple_requirement (location_t, tree); extern tree finish_type_requirement (location_t, tree); extern tree finish_compound_requirement (location_t, tree, tree, bool); extern tree finish_nested_requirement (location_t, tree); -extern void check_constrained_friend (tree, tree); extern tree tsubst_requires_expr (tree, tree, tsubst_flags_t, tree); extern tree evaluate_requires_expr (tree); extern tree tsubst_constraint (tree, tree, tsubst_flags_t, tree); @@ -8159,7 +8152,6 @@ extern bool save_subsumption_result (tree, tree, bool); extern tree find_template_parameters (tree, tree); extern bool equivalent_constraints (tree, tree); extern bool equivalently_constrained (tree, tree); -extern bool subsumes_constraints (tree, tree); extern bool strictly_subsumes (tree, tree); extern bool weakly_subsumes (tree, tree); extern int more_constrained (tree, tree); diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 17511f0..4f2fc2e 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4963,16 +4963,6 @@ push_cp_library_fn (enum tree_code operator_code, tree type, return fn; } -/* Like push_library_fn, but takes a TREE_LIST of parm types rather than - a FUNCTION_TYPE. */ - -tree -push_void_library_fn (tree name, tree parmtypes, int ecf_flags) -{ - tree type = build_function_type (void_type_node, parmtypes); - return push_library_fn (name, type, NULL_TREE, ecf_flags); -} - /* Like push_library_fn, but also note that this function throws and does not return. Used for __throw_foo and the like. */ diff --git a/gcc/cp/lambda.c b/gcc/cp/lambda.c index 16e2b4c..4a1e090 100644 --- a/gcc/cp/lambda.c +++ b/gcc/cp/lambda.c @@ -160,24 +160,6 @@ begin_lambda_type (tree lambda) return type; } -/* Returns the type to use for the return type of the operator() of a - closure class. */ - -tree -lambda_return_type (tree expr) -{ - if (expr == NULL_TREE) - return void_type_node; - if (type_unknown_p (expr) - || BRACE_ENCLOSED_INITIALIZER_P (expr)) - { - cxx_incomplete_type_error (expr, TREE_TYPE (expr)); - return error_mark_node; - } - gcc_checking_assert (!type_dependent_expression_p (expr)); - return cv_unqualified (type_decays_to (unlowered_expr_type (expr))); -} - /* Given a LAMBDA_EXPR or closure type LAMBDA, return the op() of the closure type. */ diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index bf99635..23d2623 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -3693,25 +3693,6 @@ get_primary_template_innermost_parameters (const_tree t) return parms; } -/* Return the template parameters of the LEVELth level from the full list - of template parameters PARMS. */ - -tree -get_template_parms_at_level (tree parms, int level) -{ - tree p; - if (!parms - || TREE_CODE (parms) != TREE_LIST - || level > TMPL_PARMS_DEPTH (parms)) - return NULL_TREE; - - for (p = parms; p; p = TREE_CHAIN (p)) - if (TMPL_PARMS_DEPTH (p) == level) - return p; - - return NULL_TREE; -} - /* Returns the template arguments of T if T is a template instantiation, NULL otherwise. */ @@ -13276,36 +13257,6 @@ tsubst_pack_expansion (tree t, tree args, tsubst_flags_t complain, return result; } -/* Given PARM_DECL PARM, find the corresponding PARM_DECL in the template - TMPL. We do this using DECL_PARM_INDEX, which should work even with - parameter packs; all parms generated from a function parameter pack will - have the same DECL_PARM_INDEX. */ - -tree -get_pattern_parm (tree parm, tree tmpl) -{ - tree pattern = DECL_TEMPLATE_RESULT (tmpl); - tree patparm; - - if (DECL_ARTIFICIAL (parm)) - { - for (patparm = DECL_ARGUMENTS (pattern); - patparm; patparm = DECL_CHAIN (patparm)) - if (DECL_ARTIFICIAL (patparm) - && DECL_NAME (parm) == DECL_NAME (patparm)) - break; - } - else - { - patparm = FUNCTION_FIRST_USER_PARM (DECL_TEMPLATE_RESULT (tmpl)); - patparm = chain_index (DECL_PARM_INDEX (parm)-1, patparm); - gcc_assert (DECL_PARM_INDEX (patparm) - == DECL_PARM_INDEX (parm)); - } - - return patparm; -} - /* Make an argument pack out of the TREE_VEC VEC. */ static tree -- cgit v1.1 From 3e0ad85638b8b7085add06b4afd77cbbf3549631 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Tue, 18 May 2021 19:05:20 +0200 Subject: d: Revert "Come up with startswith function." This reverts changes to the DMD front-end in commit 6ba3079dce89d9b63bf5dbd5e320ea2bf96f196b. Changes were incorrectly committed directly to the GCC repo instead of the master repository. gcc/d/ChangeLog: * dmd/dinterpret.c (evaluateIfBuiltin): Revert last change. * dmd/dmangle.c: Likewise. * dmd/hdrgen.c: Likewise. * dmd/identifier.c (Identifier::toHChars2): Likewise. --- gcc/d/dmd/dinterpret.c | 2 +- gcc/d/dmd/dmangle.c | 2 +- gcc/d/dmd/hdrgen.c | 2 +- gcc/d/dmd/identifier.c | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'gcc') diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c index 9e74a0d..5e71f3b 100644 --- a/gcc/d/dmd/dinterpret.c +++ b/gcc/d/dmd/dinterpret.c @@ -6881,7 +6881,7 @@ Expression *evaluateIfBuiltin(UnionExp *pue, InterState *istate, Loc loc, const char *id = fd->ident->toChars(); size_t idlen = strlen(id); if (nargs == 2 && (idlen == 10 || idlen == 11) && - startswith (id, "_aApply")) + !strncmp(id, "_aApply", 7)) { // Functions from aApply.d and aApplyR.d in the runtime bool rvs = (idlen == 11); // true if foreach_reverse diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c index f112243..83f4c18 100644 --- a/gcc/d/dmd/dmangle.c +++ b/gcc/d/dmd/dmangle.c @@ -673,7 +673,7 @@ public: cd == ClassDeclaration::object || cd == Type::typeinfoclass || cd == Module::moduleinfo || - startswith (cd->ident->toChars(), "TypeInfo_")) + strncmp(cd->ident->toChars(), "TypeInfo_", 9) == 0) { // Don't mangle parent ad->parent = NULL; diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c index e72273b..9397b1e 100644 --- a/gcc/d/dmd/hdrgen.c +++ b/gcc/d/dmd/hdrgen.c @@ -3212,7 +3212,7 @@ public: } else if (p->type->ty == Tident && strlen(((TypeIdentifier *)p->type)->ident->toChars()) > 3 && - startswith (((TypeIdentifier *)p->type)->ident->toChars(), "__T")) + strncmp(((TypeIdentifier *)p->type)->ident->toChars(), "__T", 3) == 0) { // print parameter name, instead of undetermined type parameter buf->writestring(p->ident->toChars()); diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c index dd2c58f..197d288 100644 --- a/gcc/d/dmd/identifier.c +++ b/gcc/d/dmd/identifier.c @@ -73,11 +73,11 @@ const char *Identifier::toHChars2() { p = toChars(); if (*p == '_') { - if (startswith(p, "_staticCtor")) + if (strncmp(p, "_staticCtor", 11) == 0) p = "static this"; - else if (startswith(p, "_staticDtor")) + else if (strncmp(p, "_staticDtor", 11) == 0) p = "static ~this"; - else if (startswith(p, "__invariant")) + else if (strncmp(p, "__invariant", 11) == 0) p = "invariant"; } } -- cgit v1.1 From f87ce01441881cbb3093e3ddace875c0ed23e595 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Tue, 18 May 2021 22:56:10 +0200 Subject: d: Use startswith function instead of strncmp gcc/d/ChangeLog: * types.cc (TypeVisitor::visit (TypeEnum *)): Use startswith function instead of strncmp. --- gcc/d/types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/d/types.cc b/gcc/d/types.cc index 3b121f5..ba2d6d4 100644 --- a/gcc/d/types.cc +++ b/gcc/d/types.cc @@ -874,7 +874,7 @@ public: Type *underlying = NULL; /* Skip over the prefixing `__c_'. */ - gcc_assert (strncmp (ident, "__c_", strlen ("__c_")) == 0); + gcc_assert (startswith (ident, "__c_")); ident = ident + strlen ("__c_"); /* To keep things compatible within the code generation we stick to -- cgit v1.1 From 5c66a1a30064edcd4c617ccfe54e28a08878050a Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Tue, 18 May 2021 22:57:23 +0200 Subject: d: Use filename_ncmp instead of strncmp gcc/d/ChangeLog: * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp. --- gcc/d/d-incpath.cc | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'gcc') diff --git a/gcc/d/d-incpath.cc b/gcc/d/d-incpath.cc index 8b7c435..d863929 100644 --- a/gcc/d/d-incpath.cc +++ b/gcc/d/d-incpath.cc @@ -30,11 +30,9 @@ along with GCC; see the file COPYING3. If not see static char * prefixed_path (const char *path, const char *iprefix) { - size_t len; - - if (cpp_relocated () && (len = cpp_PREFIX_len) != 0) + if (cpp_relocated () && cpp_PREFIX_len != 0) { - if (!strncmp (path, cpp_PREFIX, len)) + if (!filename_ncmp (path, cpp_PREFIX, cpp_PREFIX_len)) { static const char *relocated_prefix; /* If this path starts with the configure-time prefix, @@ -52,14 +50,14 @@ prefixed_path (const char *path, const char *iprefix) free (dummy); } - return concat (relocated_prefix, path + len, NULL); + return concat (relocated_prefix, path + cpp_PREFIX_len, NULL); } } - if (iprefix && (len = cpp_GCC_INCLUDE_DIR_len) != 0) + if (iprefix && cpp_GCC_INCLUDE_DIR_len != 0) { - if (!strncmp (path, cpp_GCC_INCLUDE_DIR, len)) - return concat (iprefix, path + len, NULL); + if (!filename_ncmp (path, cpp_GCC_INCLUDE_DIR, cpp_GCC_INCLUDE_DIR_len)) + return concat (iprefix, path + cpp_GCC_INCLUDE_DIR_len, NULL); } return xstrdup (path); -- cgit v1.1 From 79cf0004ffbb0c7f12729a1fc7801d2f25539c5a Mon Sep 17 00:00:00 2001 From: Bill Schmidt Date: Tue, 18 May 2021 09:04:39 -0500 Subject: rs6000: Remove old psabi warnings Long ago we were forced to make some small ABI breaks to correct errors in the implementation, and we added warning messages for the changes from GCC 4.9 to GCC 5. Enough time has passed that these are now just irritants, so let's remove them. Also clean up associated macros using rs6000_special_adjust_field_align_p, which has been always returning false for a long time. 2021-05-18 Bill Schmidt gcc/ * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Remove call to rs6000_special_adjust_field_align_p. * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. * config/rs6000/rs6000-call.c (rs6000_function_arg_boundary): Remove ABI warning. (rs6000_function_arg): Likewise. * config/rs6000/rs6000-protos.h (rs6000_special_adjust_field_align_p): Remove prototype. * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): Remove. * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Remove call to rs6000_special_adjust_field_align_p. gcc/testsuite/ * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove. * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove. * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove. --- gcc/config/rs6000/freebsd64.h | 10 +++---- gcc/config/rs6000/linux64.h | 8 +++--- gcc/config/rs6000/rs6000-call.c | 31 ++-------------------- gcc/config/rs6000/rs6000-protos.h | 1 - gcc/config/rs6000/rs6000.c | 26 ------------------ gcc/config/rs6000/sysv4.h | 3 +-- .../gcc.target/powerpc/ppc64-abi-warn-1.c | 12 --------- .../gcc.target/powerpc/ppc64-abi-warn-2.c | 11 -------- .../gcc.target/powerpc/ppc64-abi-warn-3.c | 9 ------- 9 files changed, 10 insertions(+), 101 deletions(-) delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c delete mode 100644 gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c (limited to 'gcc') diff --git a/gcc/config/rs6000/freebsd64.h b/gcc/config/rs6000/freebsd64.h index 11ea22e..7987983 100644 --- a/gcc/config/rs6000/freebsd64.h +++ b/gcc/config/rs6000/freebsd64.h @@ -306,12 +306,10 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 \ - : (TARGET_64BIT \ - && TARGET_ALIGN_NATURAL == 0 \ - && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ - ? MIN ((COMPUTED), 32) \ + ((TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ? MIN ((COMPUTED), 32) \ : (COMPUTED)) #undef TOC_SECTION_ASM_OP diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h index e3f2cd2..74be9a9 100644 --- a/gcc/config/rs6000/linux64.h +++ b/gcc/config/rs6000/linux64.h @@ -213,11 +213,9 @@ extern int dot_symbols; /* PowerPC64 Linux word-aligns FP doubles when -malign-power is given. */ #undef ADJUST_FIELD_ALIGN #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 \ - : (TARGET_64BIT \ - && TARGET_ALIGN_NATURAL == 0 \ - && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ + ((TARGET_64BIT \ + && TARGET_ALIGN_NATURAL == 0 \ + && TYPE_MODE (strip_array_types (TYPE)) == DFmode) \ ? MIN ((COMPUTED), 32) \ : (COMPUTED)) diff --git a/gcc/config/rs6000/rs6000-call.c b/gcc/config/rs6000/rs6000-call.c index c4332a6..f271b0a 100644 --- a/gcc/config/rs6000/rs6000-call.c +++ b/gcc/config/rs6000/rs6000-call.c @@ -6793,25 +6793,8 @@ rs6000_function_arg_boundary (machine_mode mode, const_tree type) /* "Aggregate" means any AGGREGATE_TYPE except for single-element or homogeneous float/vector aggregates here. We already handled vector aggregates above, but still need to check for float here. */ - bool aggregate_p = (AGGREGATE_TYPE_P (type) - && !SCALAR_FLOAT_MODE_P (elt_mode)); - - /* We used to check for BLKmode instead of the above aggregate type - check. Warn when this results in any difference to the ABI. */ - if (aggregate_p != (mode == BLKmode)) - { - static bool warned; - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the ABI of passing aggregates with %d-byte alignment" - " has changed in GCC 5", - (int) TYPE_ALIGN (type) / BITS_PER_UNIT); - } - } - - if (aggregate_p) + if (AGGREGATE_TYPE_P (type) + && !SCALAR_FLOAT_MODE_P (elt_mode)) return 128; } @@ -7805,8 +7788,6 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) if (i < n_elts && align_words + fpr_words < GP_ARG_NUM_REG && cum->nargs_prototype > 0) { - static bool warned; - machine_mode rmode = TARGET_32BIT ? SImode : DImode; int n_words = rs6000_arg_size (mode, type); @@ -7820,14 +7801,6 @@ rs6000_function_arg (cumulative_args_t cum_v, const function_arg_info &arg) rvec[k++] = gen_rtx_EXPR_LIST (VOIDmode, r, off); } while (++align_words < GP_ARG_NUM_REG && --n_words != 0); - - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the ABI of passing homogeneous % aggregates" - " has changed in GCC 5"); - } } return rs6000_finish_function_arg (mode, rvec, k); diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index bef727e..9de294d 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -226,7 +226,6 @@ address_is_prefixed (rtx addr, #ifdef TREE_CODE extern unsigned int rs6000_data_alignment (tree, unsigned int, enum data_align); -extern bool rs6000_special_adjust_field_align_p (tree, unsigned int); extern unsigned int rs6000_special_adjust_field_align (tree, unsigned int); extern unsigned int rs6000_special_round_type_align (tree, unsigned int, unsigned int); diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c304596..6db450a 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7900,32 +7900,6 @@ rs6000_slow_unaligned_access (machine_mode mode, unsigned int align) && (int) align < VECTOR_ALIGN (mode))))); } -/* Previous GCC releases forced all vector types to have 16-byte alignment. */ - -bool -rs6000_special_adjust_field_align_p (tree type, unsigned int computed) -{ - if (TARGET_ALTIVEC && TREE_CODE (type) == VECTOR_TYPE) - { - if (computed != 128) - { - static bool warned; - if (!warned && warn_psabi) - { - warned = true; - inform (input_location, - "the layout of aggregates containing vectors with" - " %d-byte alignment has changed in GCC 5", - computed / BITS_PER_UNIT); - } - } - /* In current GCC there is no special case. */ - return false; - } - - return false; -} - /* AIX word-aligns FP doubles but doubleword-aligns 64-bit ints. */ unsigned int diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 510abe1..23ff594 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -325,8 +325,7 @@ do { \ /* An expression for the alignment of a structure field FIELD if the alignment computed in the usual way is COMPUTED. */ #define ADJUST_FIELD_ALIGN(FIELD, TYPE, COMPUTED) \ - (rs6000_special_adjust_field_align_p ((TYPE), (COMPUTED)) \ - ? 128 : COMPUTED) + (COMPUTED) #undef BIGGEST_FIELD_ALIGNMENT diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c deleted file mode 100644 index ae7d574..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-1.c +++ /dev/null @@ -1,12 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-options "-mabi=elfv2" } */ - -struct f8 - { - float x[8]; - }; - -void test (struct f8 a, struct f8 b) /* { dg-message "note: the ABI of passing homogeneous 'float' aggregates has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c deleted file mode 100644 index fdbeddf..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-2.c +++ /dev/null @@ -1,11 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ - -struct test - { - long a __attribute__((aligned (16))); - }; - -void test (struct test a) /* { dg-message "note: the ABI of passing aggregates with 16-byte alignment has changed" } */ -{ -} - diff --git a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c b/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c deleted file mode 100644 index 22cad0c..0000000 --- a/gcc/testsuite/gcc.target/powerpc/ppc64-abi-warn-3.c +++ /dev/null @@ -1,9 +0,0 @@ -/* { dg-do compile { target { powerpc*-*-linux* && lp64 } } } */ -/* { dg-require-effective-target powerpc_altivec_ok } */ -/* { dg-options "-maltivec" } */ - -struct test - { - int a __attribute__((vector_size (8))); - }; /* { dg-message "note: the layout of aggregates containing vectors with 8-byte alignment has changed" } */ - -- cgit v1.1 From a8daf9a19a5eae6b98acede14bb6c27b2e0038e0 Mon Sep 17 00:00:00 2001 From: GCC Administrator Date: Wed, 19 May 2021 00:16:45 +0000 Subject: Daily bump. --- gcc/ChangeLog | 202 ++++++++++++++++++++++++++++++++++++++++++++++++ gcc/DATESTAMP | 2 +- gcc/analyzer/ChangeLog | 8 ++ gcc/c-family/ChangeLog | 6 ++ gcc/c/ChangeLog | 7 ++ gcc/cp/ChangeLog | 39 ++++++++++ gcc/d/ChangeLog | 16 ++++ gcc/fortran/ChangeLog | 5 ++ gcc/testsuite/ChangeLog | 94 ++++++++++++++++++++++ 9 files changed, 378 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index fe5132d..19c8701 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,205 @@ +2021-05-18 Bill Schmidt + + * config/rs6000/freebsd64.h (ADJUST_FIELD_ALIGN): Remove call to + rs6000_special_adjust_field_align_p. + * config/rs6000/linux64.h (ADJUST_FIELD_ALIGN): Likewise. + * config/rs6000/rs6000-call.c (rs6000_function_arg_boundary): + Remove ABI warning. + (rs6000_function_arg): Likewise. + * config/rs6000/rs6000-protos.h + (rs6000_special_adjust_field_align_p): Remove prototype. + * config/rs6000/rs6000.c (rs6000_special_adjust_field_align_p): + Remove. + * config/rs6000/sysv4.h (ADJUST_FIELD_ALIGN): Remove call to + rs6000_special_adjust_field_align_p. + +2021-05-18 Uroš Bizjak + + PR target/100637 + * config/i386/i386.h (VALID_SSE2_REG_MODE): + Add V4QI and V2HI modes. + (VALID_INT_MODE_P): Ditto. + * config/i386/mmx.md (VI_32): New mode iterator. + (mmxvecsize): Handle V4QI and V2HI. + (Yv_Yw): Ditto. + (mov): New expander. + (*mov_internal): New insn pattern. + (movmisalign): New expander. + (neg): New expander. + (3): New expander. + (*3): New insn pattern. + (mulv2hi3): New expander. + (*mulv2hi3): New insn pattern. + (one_cmpl2): New expander. + (*andnot3): New insn pattern. + (3): New expander. + (*3): New insn pattern. + +2021-05-18 Uroš Bizjak + + * config/i386/sse.md (v4qiv4di2): + Fix a mode mismatch with operand 1. + +2021-05-18 Uroš Bizjak + + PR target/100626 + * config/i386/i386-expand.c (split_double_mode): Return + temporary register when simplify_gen_subreg fails with + the high half od the paradoxical subreg. + +2021-05-18 Richard Biener + + * cfgexpand.c (expand_one_var): Pass in forced_stack_var + and honor it when expanding. + (expand_used_vars_for_block): Pass through forced_stack_var. + (expand_used_vars): Likewise. + (discover_nonconstant_array_refs_r): Set bits in + forced_stack_vars instead of marking vars TREE_ADDRESSABLE. + (avoid_type_punning_on_regs): Likewise. + (discover_nonconstant_array_refs): Likewise. + (pass_expand::execute): Create and pass down forced_stack_var + bitmap. For parameters and returns temporarily set + TREE_ADDRESSABLE when expand_function_start. + +2021-05-18 Thomas Schwinge + + * doc/sourcebuild.texi: Document 'dg-note'. + +2021-05-18 Tobias Burnus + + PR other/100598 + * configure: Regenerate. + * configure.ac (BUILD_CFLAG, BUILD_CXXFLAGS): Add $(CFLAGS-$@). + +2021-05-18 Thomas Schwinge + + * gimple.h (is_gimple_omp_oacc): Tighten. + * omp-low.c (check_omp_nesting_restrictions): Adjust. + +2021-05-18 Richard Biener + + * tree-ssa-operands.c (mark_address_taken): Simplify. + +2021-05-18 Martin Liska + + * config/gcn/mkoffload.c (STR): Redefine. + * config/i386/intelmic-mkoffload.c (STR): Likewise. + * config/nvptx/mkoffload.c (STR): Likewise. + +2021-05-18 Martin Liska + + * common/config/aarch64/aarch64-common.c (aarch64_parse_extension): + Use startswith function instead of strncmp. + * common/config/bfin/bfin-common.c (bfin_handle_option): Likewise. + * common/config/riscv/riscv-common.c (riscv_subset_list::parse): Likewise. + * config/aarch64/aarch64-sve-builtins-shapes.cc (parse_type): Likewise. + * config/aarch64/aarch64.c (aarch64_process_one_target_attr): Likewise. + * config/alpha/alpha.c (alpha_elf_section_type_flags): Likewise. + * config/arm/aarch-common.c (arm_md_asm_adjust): Likewise. + * config/arm/arm.c (arm_file_start): Likewise. + (arm_valid_target_attribute_rec): Likewise. + (thumb1_md_asm_adjust): Likewise. + * config/arm/driver-arm.c (host_detect_local_cpu): Likewise. + * config/avr/avr.c (STR_PREFIX_P): Likewise. + (avr_set_current_function): Likewise. + (avr_handle_addr_attribute): Likewise. + (avr_asm_output_aligned_decl_common): Likewise. + (avr_asm_named_section): Likewise. + (avr_section_type_flags): Likewise. + (avr_asm_select_section): Likewise. + * config/c6x/c6x.c (c6x_in_small_data_p): Likewise. + (c6x_section_type_flags): Likewise. + * config/darwin-c.c (darwin_cfstring_ref_p): Likewise. + (darwin_objc_declare_unresolved_class_reference): Likewise. + (darwin_objc_declare_class_definition): Likewise. + * config/darwin.c (indirect_data): Likewise. + (darwin_encode_section_info): Likewise. + (darwin_objc2_section): Likewise. + (darwin_objc1_section): Likewise. + (machopic_select_section): Likewise. + (darwin_globalize_label): Likewise. + (darwin_label_is_anonymous_local_objc_name): Likewise. + (darwin_asm_named_section): Likewise. + (darwin_asm_output_dwarf_offset): Likewise. + * config/frv/frv.c (frv_string_begins_with): Likewise. + (frv_in_small_data_p): Likewise. + * config/gcn/mkoffload.c (STR): Likewise. + (main): Likewise. + * config/i386/i386-builtins.c (get_builtin_code_for_version): Likewise. + * config/i386/i386-options.c (ix86_option_override_internal): Likewise. + * config/i386/i386.c (x86_64_elf_section_type_flags): Likewise. + (ix86_md_asm_adjust): Likewise. + * config/i386/intelmic-mkoffload.c (STR): Likewise. + * config/i386/winnt.c (i386_pe_asm_named_section): Likewise. + (i386_pe_file_end): Likewise. + * config/ia64/ia64.c (ia64_in_small_data_p): Likewise. + (ia64_section_type_flags): Likewise. + * config/mips/driver-native.c (host_detect_local_cpu): Likewise. + * config/mips/mips.c (mips_handle_interrupt_attr): Likewise. + (mips16_stub_function_p): Likewise. + (mips_function_rodata_section): Likewise. + * config/msp430/msp430.c (msp430_mcu_name): Likewise. + (msp430_function_section): Likewise. + (msp430_section_type_flags): Likewise. + (msp430_expand_helper): Likewise. + * config/nios2/nios2.c (nios2_small_section_name_p): Likewise. + (nios2_valid_target_attribute_rec): Likewise. + * config/nvptx/mkoffload.c (process): Likewise. + (STR): Likewise. + * config/pa/som.h: Likewise. + * config/pdp11/pdp11.c (pdp11_output_ident): Likewise. + * config/riscv/riscv.c (riscv_elf_select_rtx_section): Likewise. + * config/rs6000/rs6000.c (VTABLE_NAME_P): Likewise. + (rs6000_inner_target_options): Likewise. + * config/s390/driver-native.c (s390_host_detect_local_cpu): Likewise. + * config/sparc/driver-sparc.c (host_detect_local_cpu): Likewise. + * config/vax/vax.c (vax_output_int_move): Likewise. + * config/vms/vms-ld.c (startswith): Likewise. + (process_args): Likewise. + (main): Likewise. + * config/vms/vms.c: Likewise. + +2021-05-18 Jakub Jelinek + + PR rtl-optimization/100590 + * regcprop.c (copyprop_hardreg_forward_1): Only DCE dead sets if + they are NONJUMP_INSN_P. + +2021-05-18 Jakub Jelinek + + PR c++/100580 + * function.c (push_dummy_function): Set DECL_ARTIFICIAL and + DECL_ASSEMBLER_NAME on the fn_decl. + +2021-05-18 Jakub Jelinek + + PR tree-optimization/94589 + * tree-ssa-phiopt.c (spaceship_replacement): Pattern match + phi result used in (res & ~1) == 0 comparison as res >= 0 as + res == 2 would be UB with -ffinite-math-only. + +2021-05-18 Martin Liska + + * Makefile.in: genversion.o should depend on DATESTAMP. + +2021-05-18 Claudiu Zissulescu + + * config/arc/simdext.md (negv2si2): Remove round bracket. + +2021-05-18 Andreas Krebbel + + * config/s390/s390-c.c (s390_cpu_cpp_builtins_internal): Define + _Bool as macro expanding to _Bool. + +2021-05-18 Andreas Krebbel + + PR c++/100281 + * tree.c (build_reference_type_for_mode) + (build_pointer_type_for_mode): Pick pointer mode if MODE argument + is VOIDmode. + (build_reference_type, build_pointer_type): Invoke + build_*_type_for_mode with VOIDmode. + 2021-05-17 Andrew MacLeod PR tree-optimization/100512 diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 7fa5a77..da5d88b 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20210518 +20210519 diff --git a/gcc/analyzer/ChangeLog b/gcc/analyzer/ChangeLog index e6c0631..7396971 100644 --- a/gcc/analyzer/ChangeLog +++ b/gcc/analyzer/ChangeLog @@ -1,3 +1,11 @@ +2021-05-18 David Malcolm + + PR analyzer/100615 + * sm-malloc.cc: Include "analyzer/function-set.h". + (malloc_state_machine::on_stmt): Call unaffected_by_call_p and + bail on the functions it recognizes. + (malloc_state_machine::unaffected_by_call_p): New. + 2021-05-10 Martin Liska * sm-file.cc (is_file_using_fn_p): Use startswith diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index cc1019c..ed45d29 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2021-05-18 Richard Biener + + PR c/100547 + * c-attribs.c (type_valid_for_vector_size): Reject too large nunits. + Reword existing nunit diagnostic. + 2021-05-17 Joern Rennecke * c-common.c (braced_list_to_string): Return CTOR unchanged diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 7d34f7c..8832602 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,3 +1,10 @@ +2021-05-18 Richard Biener + + PR c/100522 + * gimple-parser.c (c_parser_gimple_postfix_expression_after_primary): + Diagnose calls to non-functions. + (c_parser_gimple_statement): Diagnose unexpected assignment RHS. + 2021-05-17 Richard Biener PR c/100625 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45af840..45588a8 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,42 @@ +2021-05-18 Marek Polacek + + * class.c (classtype_has_non_deleted_copy_ctor): Remove. + * constraint.cc (contains_wildcard_p): Likewise. + (get_template_head_requirements): Likewise. + (check_constrained_friend): Likewise. + (subsumes_constraints): Likewise. + * cp-tree.h (classtype_has_non_deleted_copy_ctor): Likewise. + (push_void_library_fn): Likewise. + (get_pattern_parm): Likewise. + (get_template_parms_at_level): Likewise. + (lambda_return_type): Likewise. + (get_template_head_requirements): Likewise. + (check_constrained_friend): Likewise. + (subsumes_constraints): Likewise. + * decl.c (push_void_library_fn): Likewise. + * lambda.c (lambda_return_type): Likewise. + * pt.c (get_template_parms_at_level): Likewise. + (get_pattern_parm): Likewise. + +2021-05-18 Jason Merrill + + PR c++/100644 + * call.c (perfect_candidate_p): An implicitly deleted move + is not perfect. + +2021-05-18 Andreas Krebbel + + PR c++/100281 + * cvt.c (cp_convert_to_pointer): Use the size of the target + pointer type. + * tree.c (cp_build_reference_type): Call + cp_build_reference_type_for_mode with VOIDmode. + (cp_build_reference_type_for_mode): Rename from + cp_build_reference_type. Add MODE argument and invoke + build_reference_type_for_mode. + (strip_typedefs): Use build_pointer_type_for_mode and + cp_build_reference_type_for_mode for pointers and references. + 2021-05-17 Jonathan Wakely PR c++/100635 diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog index 2e66ed5..85176b7 100644 --- a/gcc/d/ChangeLog +++ b/gcc/d/ChangeLog @@ -1,3 +1,19 @@ +2021-05-18 Iain Buclaw + + * d-incpath.cc (prefixed_path): Use filename_ncmp instead of strncmp. + +2021-05-18 Iain Buclaw + + * types.cc (TypeVisitor::visit (TypeEnum *)): Use startswith function + instead of strncmp. + +2021-05-18 Iain Buclaw + + * dmd/dinterpret.c (evaluateIfBuiltin): Revert last change. + * dmd/dmangle.c: Likewise. + * dmd/hdrgen.c: Likewise. + * dmd/identifier.c (Identifier::toHChars2): Likewise. + 2021-05-10 Iain Buclaw * dmd/MERGE: Merge upstream dmd b7d146c4c. diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 54fa0ee..aa8426f 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2021-05-18 Tobias Burnus + + PR fortran/100642 + * openmp.c (omp_code_to_statement): Add missing EXEC_OMP_DEPOBJ. + 2021-05-17 Harald Anlauf PR fortran/98411 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9141534..e9a410e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,97 @@ +2021-05-18 Bill Schmidt + + * gcc.target/powerpc/ppc64-abi-warn-1.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-2.c: Remove. + * gcc.target/powerpc/ppc64-abi-warn-3.c: Remove. + +2021-05-18 Jason Merrill + + PR c++/100205 + PR c++/99314 + * g++.dg/cpp0x/decltype-nonstatic1.C: New test. + +2021-05-18 Jason Merrill + + * g++.dg/cpp0x/implicit-delete1.C: New test. + +2021-05-18 David Malcolm + + PR analyzer/100615 + * gcc.dg/analyzer/pr100615.c: New test. + +2021-05-18 Uroš Bizjak + + PR target/100637 + * gcc.target/i386/pr100637-1b.c: New test. + * gcc.target/i386/pr100637-1w.c: Ditto. + * gcc.target/i386/pr92658-avx2-2.c: Do not XFAIL scan for pmovsxbq. + * gcc.target/i386/pr92658-avx2.c: Do not XFAIL scan for pmovzxbq. + * gcc.target/i386/pr92658-avx512vl.c: Do not XFAIL scan for vpmovdb. + * gcc.target/i386/pr92658-sse4-2.c: Do not XFAIL scan for + pmovsxbd and pmovsxwq. + * gcc.target/i386/pr92658-sse4.c: Do not XFAIL scan for + pmovzxbd and pmovzxwq. + +2021-05-18 Tobias Burnus + + PR fortran/100642 + * gfortran.dg/goacc-gomp/depobj.f90: New test. + +2021-05-18 Thomas Schwinge + + * lib/gcc-dg.exp: Implement 'dg-note'. + * lib/prune.exp: Likewise. + * gcc.dg/vect/nodump-vect-opt-info-2.c: Use 'dg-note', and + 'dg-prune-output "note: ". + * gfortran.dg/goacc/routine-external-level-of-parallelism-2.f: Use + 'dg-note', match up additional notes, one class of them with + XFAILed 'dg-bogus'. + * lib/lto.exp: Implement 'dg-lto-note'. + * g++.dg/lto/odr-1_0.C: Use 'dg-lto-note', match up additional + notes. + * g++.dg/lto/odr-1_1.C: Likewise. + * g++.dg/lto/odr-2_1.C: Likewise. + +2021-05-18 Jakub Jelinek + + PR rtl-optimization/100590 + * gcc.dg/pr100590.c: New test. + +2021-05-18 Jakub Jelinek + + PR c++/100580 + * g++.dg/other/pr100580.C: New test. + +2021-05-18 Jakub Jelinek + + PR tree-optimization/94589 + * g++.dg/opt/pr94589-2.C: Adjust scan-tree-dump count from 14 to 12. + +2021-05-18 Richard Biener + + * gcc.target/i386/pr100582.c: Adjust for AVX512. + +2021-05-18 Richard Biener + + PR c/100522 + * gcc.dg/gimplefe-error-10.c: New testcase. + +2021-05-18 Richard Biener + + PR c/100547 + * gcc.dg/pr100547.c: New testcase. + * gcc.dg/attr-vector_size.c: Adjust. + +2021-05-18 Andreas Krebbel + + * gcc.target/s390/zvector/vec-_Bool.c: New test. + +2021-05-18 Andreas Krebbel + + PR c++/100281 + * g++.target/s390/pr100281-1.C: New test. + * g++.target/s390/pr100281-2.C: New test. + 2021-05-17 Andrew MacLeod PR tree-optimization/100512 -- cgit v1.1 From 061fe8c58ac4d436906a404f7fb46b0a6e0d7b4f Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Tue, 18 May 2021 17:12:37 -0400 Subject: c++: template template parm pack expansion [PR100372] Here we have a pack expansion of a template template parameter pack, of which the pattern is a TEMPLATE_DECL, which strip_typedefs doesn't want to see. PR c++/100372 gcc/cp/ChangeLog: * tree.c (strip_typedefs): Only look at the pattern of a TYPE_PACK_EXPANSION if it's a type. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/alias-decl-ttp1.C: New test. --- gcc/cp/tree.c | 19 ++++++++++++------- gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C | 6 ++++++ 2 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C (limited to 'gcc') diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 35faeff..72f498f 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1741,13 +1741,18 @@ strip_typedefs (tree t, bool *remove_attributes, unsigned int flags) result = finish_underlying_type (type); break; case TYPE_PACK_EXPANSION: - type = strip_typedefs (PACK_EXPANSION_PATTERN (t), - remove_attributes, flags); - if (type != PACK_EXPANSION_PATTERN (t)) - { - result = copy_node (t); - PACK_EXPANSION_PATTERN (result) = type; - } + { + tree pat = PACK_EXPANSION_PATTERN (t); + if (TYPE_P (pat)) + { + type = strip_typedefs (pat, remove_attributes, flags); + if (type != pat) + { + result = copy_node (t); + PACK_EXPANSION_PATTERN (result) = type; + } + } + } break; default: break; diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C new file mode 100644 index 0000000..d1af8d1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-ttp1.C @@ -0,0 +1,6 @@ +// PR c++/100372 +// { dg-do compile { target c++14 } } + +template using enable_if_t = int; +template bool has_P_match_v; +template