platform/upstream/gcc.git
10 months agopackaging: Add -marm and -fno-omit-frame-pointer
Denis Khalikov [Thu, 5 Jul 2018 10:04:58 +0000 (13:04 +0300)]
packaging: Add -marm and -fno-omit-frame-pointer

To enable "fastunwinder" work on armv7l we should explicitly
build libasan with -marm and -fno-omit-frame-pointer.

Change-Id: I28e763fa7b088aa26a81e7bb6d3a7fa9ba7a714b

10 months agopackaging: Bootstrap compiler optimization
Oleg Ogurtsov [Thu, 11 Jan 2018 09:53:42 +0000 (12:53 +0300)]
packaging: Bootstrap compiler optimization

Change-Id: Ie1e12ff3ae5c0550254f58da4750830e5739d3f5

10 months agoEnable asaned glibc work.
Denis Khalikov [Tue, 26 Sep 2017 18:51:35 +0000 (21:51 +0300)]
Enable asaned glibc work.

Modify GetPageSize () function to return
4096 for arm and arch64 architectures. We can
not call sysconf from libc befor libc is inited.

Mark libasan as initfirst, in this case "patched" rtld
will be able to initiazlie libasan before libc.so

Change-Id: I56a582fdeafcf55b9dbab8fcd1b39be850cccc04

10 months agopackaging: add %arm to lsan_arch
Dongkyun Son [Tue, 24 Oct 2017 01:22:21 +0000 (10:22 +0900)]
packaging: add %arm to lsan_arch

libasan.so.* are installed, but unpackaged in armv7hl.

Change-Id: I713fdcc3b157f3578995fa26b9d8d4754f937bfa
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
10 months agoAdd armv7hl support.
Mikhail Kashkarov [Fri, 5 May 2017 14:00:49 +0000 (17:00 +0300)]
Add armv7hl support.

Change-Id: Ib611ee4659af5e30b2a9c46ded7588b5a5c139fa

10 months agopackaging: clean-up sanitizer macros.
Dongkyun Son [Tue, 19 Sep 2017 05:33:20 +0000 (14:33 +0900)]
packaging: clean-up sanitizer macros.

sanitizer related macros moved to 'gcc-contrib' package.

Change-Id: Ic8ed52aac4a502f2bf44053225b2e29e721699d6
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
10 months agopackaging: provide libasan(64bit) on 32bit build env
Dongkyun Son [Fri, 1 Sep 2017 15:35:56 +0000 (00:35 +0900)]
packaging: provide libasan(64bit) on 32bit build env

This is needed as it requires 64bit libs into i586 repo, sometimes.
(e.g, .NET toolchain asan build).

Change-Id: Ia18f132b19e8552b347132531f3e12000aa34514
Signed-off-by: Dongkyun Son <dongkyun.s@samsung.com>
10 months agopackaging: Support for gcc-contrib.
Denis Khalikov [Fri, 18 Aug 2017 15:07:28 +0000 (18:07 +0300)]
packaging: Support for gcc-contrib.

This patch deletes all scripts from gcc *spec files.
All scripts moved to gcc-contrib package.

Change-Id: I847a5c61b69cc74aadf59c31e3b04a404a4d13b0

10 months agopackaging: Add libasan as requires for asan-runtime-env
Hoyub Lee [Mon, 21 Aug 2017 07:10:12 +0000 (16:10 +0900)]
packaging: Add libasan as requires for asan-runtime-env

Installing asan-runtime-env without libasan invokes error from ld.so.
Therefore, it is correct to add libasan as requires.

Change-Id: I9d2e2a3f60369b1332d7280b6cc6253a73e36439
Signed-off-by: Hoyub Lee <hoyub.lee@samsung.com>
10 months agopackaging: Set shadow address space to unlimited for ASan
Chan Lee [Fri, 25 Aug 2017 01:46:44 +0000 (10:46 +0900)]
packaging: Set shadow address space to unlimited for ASan

Currently, at the beginning of gbs build, shadow address space is set
according to the environment of the host machine. It makes ASan build
fail because ASan needs a whole shadow address space.

Actually ASan tries to set the value to unlimited at init time( ASanInitInternal() )
but it failes because of lack of permission like below.

[   39s] ==6800==ERROR: AddressSanitizer setrlimit() failed 1

The value could be set at package install time because the user
is 'root' at this time.
Using ulimit can only set the value for current user('root') not 'abuild'
which is the user at build time so we need to set /etc/security/limits.conf directly.

Change-Id: Ia03911a37a689c186d0e028d01b665cf6a0c3073
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agopackaging: Force options for native compiler only
Slava Barinov [Thu, 10 Aug 2017 08:05:46 +0000 (11:05 +0300)]
packaging: Force options for native compiler only

If both native and cross-compiler are installed (e. g. in qemu-accel build) the
gcc-force-options should only accelerate native compiler in order to keep
gcc-unforce-options work.

Change-Id: I1454fb199e6f849b89f7b16129e005894d800cbc
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months agopackaging: remain ld.so.preload.org
Chan Lee [Wed, 23 Aug 2017 11:28:57 +0000 (20:28 +0900)]
packaging: remain ld.so.preload.org

Original file should be remained to restore when uninstalling rpm.

Change-Id: Id5e5b82ff327e14db966b142248d6a5a3e17917c
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agopackaging: Enable ASan bootstrap for ASan projects
Slava Barinov [Tue, 25 Jul 2017 08:44:17 +0000 (11:44 +0300)]
packaging: Enable ASan bootstrap for ASan projects

GCC will be built in ASan projects.

To test the GCC package the rpm macro `asanbootstrap' should be defined in
project config.

Change-Id: Id91425e2895f63ec92c8e83fb96f93aaade67728
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months ago[TTC-3] Fix asan_symbolize.py output frame numbers.
Mikhail Kashkarov [Thu, 20 Jul 2017 11:19:13 +0000 (14:19 +0300)]
[TTC-3] Fix asan_symbolize.py output frame numbers.

If input line already symbolized and has format
'#0 0x7f6e35cf2e45 in func foo:46' - fix internal frame number.

packaging/
    * asan_symbolized.py (have_line_to_symbolized): New function.

Change-Id: I2c52c58f9e2d6dfce709e87dee2abd62b642bcad

10 months ago[TTC-2] Fix asan_symbolize.py for C++ function prototypes detection.
Mikhail Kashkarov [Thu, 13 Jul 2017 14:02:39 +0000 (17:02 +0300)]
[TTC-2] Fix asan_symbolize.py for C++ function prototypes detection.

Change-Id: Iffa30dce19f99506312a93b79cc8deb05404a82a

10 months agopackaging: append -ldl -lpthread to ASan force options.
Sangmin Seo [Wed, 12 Jul 2017 09:37:50 +0000 (18:37 +0900)]
packaging: append -ldl -lpthread to ASan force options.

When building for address sanitization, some packages complain about
missing symbols due to omitted -ldl or -pthread.  This patch appends
-ldl and -lpthread to the ASan force options in order to resolve this
kind of issue.  Note that since -ldl and -lpthread are already needed
by libasan, adding them to the ASan force options should not cause any
problems.

This patch also adds -Wl,--as-needed before -ldl -lpthread in the
force options to prevent libdl or libpthread from being linked when
unnecessary.

Change-Id: Ic50059d4684e15773f56c589cfacda0bc944d955
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
10 months agopackaging: create a wrapper for collect2 in gcc-force-options
Sangmin Seo [Tue, 18 Jul 2017 05:01:23 +0000 (14:01 +0900)]
packaging: create a wrapper for collect2 in gcc-force-options

gcc-force-options used to prepend/append all force options to the
gcc/g++ wrappers.  This approach worked well for most packages but
caused some configure scripts to behave differently when linker flags
are included in the force options.  For example, if g++ is called with
-ldl appended, it always goes to the linking phase.  As a result, when
configure has expanded AC_PROG_CXXCPP macro, variables related to
preprocessor are not properly set and actual build ends up using
incorrect compile and link flags.

Since prepending or appending linker flags to the linker makes more
sense than carrying them from the compilation phase, this patch
basically divides the force options into compiler flags and linker
ones, and inserts them to corresponding wrappers.  Consequently, a
wrapper for collect2 is created, as we did for gcc and g++, in order
to pass the linker flags to the linker.  Note that collect2 bridges
the compiler and the actual linker, and thus creating a wrapper for
collect2 is more portable and succinct than doing so for linkers.

Change-Id: I8733bf14c5a2c04bfebe38a339c94e7a738cf17c
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
10 months agopackaging: Add %gcc_force_options and %gcc_unforce_options macros
Slava Barinov [Thu, 13 Jul 2017 10:35:02 +0000 (13:35 +0300)]
packaging: Add %gcc_force_options and %gcc_unforce_options macros

The macros can be used in certain .spec files to switch off sanitization of
parts or modules without hard-coding sanitizer flags into packages.

Change-Id: I1643a3bdd64a3d48855f02622feb064d482e3655
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
Signed-off-by: Sangmin Seo <sangmin7.seo@samsung.com>
10 months agopackaging: enable log_exe_name sanitizer option for ASan
Chan Lee [Thu, 1 Jun 2017 03:28:22 +0000 (12:28 +0900)]
packaging: enable log_exe_name sanitizer option for ASan

This option shoule be 'log_exe_name' not 'log_exe_path'

According to SanitizerCommonFlags,
(https://github.com/google/sanitizers/wiki/SanitizerCommonFlags)
Enabling this option makes ASan mention name of executable when reporting error and append
executable name to logs (as in "log_path.exe_name.pid").

Change-Id: I0a49a2032355b6527ea7522faa1414ec8d567125
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agoDo not build libgfortran unless requested explicitly
Slava Barinov [Thu, 27 Apr 2017 08:20:09 +0000 (11:20 +0300)]
Do not build libgfortran unless requested explicitly

        * gcc/fortran/config-lang.in : add conditional target_libs setup.

This option does not make sense in upstream GCC - Fortran frontend is useless
without runtime, but will work with qemu-accel in Tizen OBS environment.

Change-Id: Ie42fa3201a0bc022ef46ef53b51be896ad091943
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months agopackaging: add fortran compiler
Chan Lee [Mon, 24 Apr 2017 07:11:01 +0000 (16:11 +0900)]
packaging: add fortran compiler

Change-Id: I139d3b29c690a05e29bcfcfa660350f63bbbdadc
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agoRemove hard-coded path to extract-ubsan-logs script
Slava Barinov [Fri, 7 Apr 2017 10:06:58 +0000 (13:06 +0300)]
Remove hard-coded path to extract-ubsan-logs script

Change-Id: Id515f89e748fbe9a18f5a615e100eb530a0c5930
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months agopackaging: add license files to all sub components
Dongkyun, Son [Fri, 7 Apr 2017 01:27:29 +0000 (10:27 +0900)]
packaging: add license files to all sub components

The license files are added to only library components because they could be
included to target binary.

Change-Id: I7fb9885843794ea47c29833ead402386d890d663
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
10 months agopackaging: remove cloog
Chan Lee [Fri, 7 Apr 2017 07:04:02 +0000 (16:04 +0900)]
packaging: remove cloog

Cloog had been removed from gcc.

Related git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@218348
138bc75d-0d04-0410-961f-82ee72b054a4

Change-Id: Ifc898f5f4b429382d082b43e3cbfd4e46b226e2f
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agopackaging: provide 64bit libs on 32bit build env
Chan Lee [Mon, 27 Mar 2017 01:30:18 +0000 (10:30 +0900)]
packaging: provide 64bit libs on 32bit build env

In some cases, especially .Net toolchain needs 64bit libs to execute
even though 32bit build environment.
It's a little weird but possble because almost archtecture of build machine is 64bit.

Change-Id: I0d8df53d4743a4fa1b2c00d6aeeeed77e8b964cf
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agoEnabling libcc1 build
Slava Barinov [Thu, 2 Mar 2017 08:47:59 +0000 (11:47 +0300)]
Enabling libcc1 build

Change-Id: I4485bdf215e020450a65970474b591e98a7367f1

10 months agoAdd liblsan packaging
Slava Barinov [Tue, 28 Feb 2017 12:17:45 +0000 (15:17 +0300)]
Add liblsan packaging

Change-Id: I44084744a83cdc87e69b2a1f25cc4138bac31913
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months agoBasing on 6.3.1 branch
Slava Barinov [Tue, 28 Feb 2017 11:35:47 +0000 (14:35 +0300)]
Basing on 6.3.1 branch

Change-Id: Idbb9664859cb4a000f1a5631bc948652b49e9fc4
Signed-off-by: Slava Barinov <v.barinov@samsung.com>
10 months agopackaging: explicitly added configure options
Dongkyun, Son [Thu, 2 Feb 2017 06:27:19 +0000 (15:27 +0900)]
packaging: explicitly added configure options

--enable-plugin (same as 4.9's)
--disable-libcc1 (new on 6.2's)

Change-Id: I005be6c5c888597cda64b0fe94b6d20399ef4c93
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
10 months agopackaging: remove plugin packages and files
Chan Lee [Thu, 19 Jan 2017 06:54:25 +0000 (15:54 +0900)]
packaging: remove plugin packages and files

Change-Id: I416cdc6e1bc6c687427a48796f1575a94f678f10
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agopackaging: disable lsan for arm and x86
Chan Lee [Thu, 19 Jan 2017 06:51:50 +0000 (15:51 +0900)]
packaging: disable lsan for arm and x86

Change-Id: I0ff97d8f50f386eabd49f8b5d1479f6645e52e90
Signed-off-by: Chan Lee <chan45.lee@samsung.com>
10 months agopackaging: add packaging
Dongkyun, Son [Wed, 11 Jan 2017 10:29:59 +0000 (19:29 +0900)]
packaging: add packaging

Change-Id: Icd5159e115d6827eaaff5ff59861d07438c29129
Signed-off-by: Dongkyun, Son <dongkyun.s@samsung.com>
13 months agoUpdate ChangeLog and version files for release upstream-13.1.0 upstream/13.1.0
Jakub Jelinek [Wed, 26 Apr 2023 07:10:03 +0000 (07:10 +0000)]
Update ChangeLog and version files for release

13 months agoUpdate gennews for GCC 13.
Jakub Jelinek [Wed, 26 Apr 2023 07:05:49 +0000 (09:05 +0200)]
Update gennews for GCC 13.

2023-04-26  Jakub Jelinek  <jakub@redhat.com>

* gennews (files): Add files for GCC 13.

(cherry picked from commit f2f721d13b92267497ca52a3bd6e2e03071bad12)

13 months agoDaily bump.
GCC Administrator [Wed, 26 Apr 2023 00:22:28 +0000 (00:22 +0000)]
Daily bump.

13 months agoRegenerate gcc.pot
Joseph Myers [Tue, 25 Apr 2023 21:44:54 +0000 (21:44 +0000)]
Regenerate gcc.pot

* gcc.pot: Regenerate.

13 months agopowerpc: Fix up *branch_anddi3_dot for -m32 -mpowerpc64 [PR109566]
Jakub Jelinek [Tue, 25 Apr 2023 12:20:51 +0000 (14:20 +0200)]
powerpc: Fix up *branch_anddi3_dot for -m32 -mpowerpc64 [PR109566]

The following testcase reduced from newlib ICEs on powerpc-linux,
with -O2 -m32 -mpowerpc64 since r12-6433 PR102239 optimization was
added and on the original testcase since some ranger improvements in
GCC 13 made it no longer latent on newlib.
The problem is that the *branch_anddi3_dot define_insn_and_split
relies on the *rotldi3_mask_dot define_insn_and_split being recognized
during splitting.  The rs6000_is_valid_rotate_dot_mask function checks whether
the mask is a CONST_INT which is a valid mask, but *rotl<mode>3_mask_dot in
addition to checking that it is a valid mask also has
  (<MODE>mode == Pmode || UINTVAL (operands[3]) <= 0x7fffffff)
test in the condition.  For TARGET_64BIT that doesn't add any further
requirements, but for !TARGET_64BIT && TARGET_POWERPC64 if the AND
second operand is larger than INT_MAX it will not be recognized.

The rs6000_is_valid_rotate_dot_mask function is used solely in one spot,
condition of *branch_anddi3_dot, so the following patch adjusts it
to check for that as well.

2023-04-25  Jakub Jelinek  <jakub@redhat.com>

PR target/109566
* config/rs6000/rs6000.cc (rs6000_is_valid_rotate_dot_mask): For
!TARGET_64BIT, don't return true if UINTVAL (mask) << (63 - nb)
is larger than signed int maximum.

* gcc.target/powerpc/pr109566.c: New test.

(cherry picked from commit 97f8f2d0a0384d377ca46da88495f9a3d18d4415)

13 months agoDaily bump.
GCC Administrator [Tue, 25 Apr 2023 00:23:22 +0000 (00:23 +0000)]
Daily bump.

13 months agoUpdate gcc hr.po, sv.po, zh_CN.po
Joseph Myers [Mon, 24 Apr 2023 18:11:30 +0000 (18:11 +0000)]
Update gcc hr.po, sv.po, zh_CN.po

* hr.po, sv.po, zh_CN.po: Update.

13 months agodoc: Update install.texi for GCC 13
Rainer Orth [Mon, 24 Apr 2023 09:56:37 +0000 (11:56 +0200)]
doc: Update install.texi for GCC 13

install.texi needs some updates for GCC 13 and trunk:

* We used a mixture of Solaris 2 and Solaris references.  Since Solaris
  1/SunOS 4 is ancient history by now, consistently use Solaris
  everywhere.  Likewise, explicit references to Solaris 11 can go in
  many places since Solaris 11.3 and 11.4 is all GCC supports.

* Some caveats apply to both Solaris/SPARC and x86, like the difference
  between as and gas.

* Some specifics are obsolete, like the /usr/ccs/bin path whose contents
  was merged into /usr/bin in Solaris 11.0 already.  Likewise, /bin/sh
  is ksh93 since Solaris 11.0, so there's no need to explicitly use
  /bin/ksh.

* I've removed the reference to OpenCSW: there's barely a need for external
  sites to get additional packages.  OpenCSW is mostly unmaintained these
  days and has been found to be rather harmful then helping.

* The section on assembler and linker to use was partially duplicated.
  Better keep the info in one place.

* GNAT is bundled in recent Solaris 11.4 updates, so recommend that.

Tested on i386-pc-solaris2.11 with make doc/gccinstall.{info,pdf} and
inspection of the latter.

2023-04-21  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

gcc:
* doc/install.texi: Consistently use Solaris rather than Solaris 2.
Remove explicit Solaris 11 references.
Markup fixes.
(Options specification, --with-gnu-as): as and gas always differ
on Solaris.
Remove /usr/ccs/bin reference.
(Installing GCC: Binaries, Solaris (SPARC, Intel)): Remove.
(i?86-*-solaris2*): Merge assembler, linker recommendations ...
(*-*-solaris2*): ... here.
Update bundled GCC versions.
Don't refer to pre-built binaries.
Remove /bin/sh warning.
Update assembler, linker recommendations.
Document GNAT bootstrap compiler.
(sparc-sun-solaris2*): Remove non-UltraSPARC reference.
(sparc64-*-solaris2*): Move content...
(sparcv9-*-solaris2*): ...here.
Add GDC for 64-bit bootstrap compilers.

13 months agoDaily bump.
GCC Administrator [Mon, 24 Apr 2023 00:22:57 +0000 (00:22 +0000)]
Daily bump.

13 months agoDaily bump.
GCC Administrator [Sun, 23 Apr 2023 00:22:24 +0000 (00:22 +0000)]
Daily bump.

13 months agomatch.pd: Fix fneg/fadd optimization [PR109583]
Jakub Jelinek [Sat, 22 Apr 2023 08:24:29 +0000 (10:24 +0200)]
match.pd: Fix fneg/fadd optimization [PR109583]

The following testcase ICEs on x86, foo function since my r14-22
improvement, but bar already since r13-4122.  The problem is the same,
in the if expression related_vector_mode is called and that starts with
  gcc_assert (VECTOR_MODE_P (vector_mode));
but nothing in the fneg/fadd match.pd pattern actually checks if the
VEC_PERM type has VECTOR_MODE_P (vec_mode).  In this case it has BLKmode
and so it ICEs.

The following patch makes sure we don't ICE on it.

2023-04-22  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109583
* match.pd (fneg/fadd simplify): Don't call related_vector_mode
if vec_mode is not VECTOR_MODE_P.

* gcc.dg/pr109583.c: New test.

(cherry picked from commit c58c0771b7a3dbd2a00cd4b6ca2301d74b6cd4e2)

13 months agoDaily bump.
GCC Administrator [Sat, 22 Apr 2023 00:22:49 +0000 (00:22 +0000)]
Daily bump.

13 months agoLoongArch: Add built-in functions description of LoongArch Base instruction set instr...
Lulu Cheng [Thu, 6 Apr 2023 08:02:07 +0000 (16:02 +0800)]
LoongArch: Add built-in functions description of LoongArch Base instruction set instructions.

gcc/ChangeLog:

* doc/extend.texi: Add section for LoongArch Base Built-in functions.

(cherry picked from commit 5015cdf3155c80e5fd61f7b6ab8082ee849e3e90)

13 months agoDo not ignore UNDEFINED ranges when determining PHI equivalences.
Andrew MacLeod [Thu, 20 Apr 2023 17:10:40 +0000 (13:10 -0400)]
Do not ignore UNDEFINED ranges when determining PHI equivalences.

Do not ignore UNDEFINED name arguments when registering two-way equivalences
from PHIs.

PR tree-optimization/109564
gcc/
* gimple-range-fold.cc (fold_using_range::range_of_phi): Do no ignore
UNDEFINED range names when deciding if all PHI arguments are the same,

gcc/testsuite/
* gcc.dg/torture/pr109564-1.c: New testcase.
* gcc.dg/torture/pr109564-2.c: Likewise.
* gcc.dg/tree-ssa/evrp-ignore.c: XFAIL.
* gcc.dg/tree-ssa/vrp06.c: Likewise.

(cherry picked from commit 17aa9ddb34581855dd013745c8be27dda024de4a)

13 months agoDaily bump.
GCC Administrator [Fri, 21 Apr 2023 00:22:34 +0000 (00:22 +0000)]
Daily bump.

13 months agodoc: Remove repeated word (typo)
Alejandro Colomar [Thu, 20 Apr 2023 17:18:55 +0000 (19:18 +0200)]
doc: Remove repeated word (typo)

gcc/ChangeLog:

* doc/extend.texi (Common Function Attributes): Remove duplicate
word.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
13 months agoDaily bump.
GCC Administrator [Thu, 20 Apr 2023 00:21:47 +0000 (00:21 +0000)]
Daily bump.

13 months agoc++: bad ggc_free in try_class_unification [PR109556]
Patrick Palka [Wed, 19 Apr 2023 17:07:46 +0000 (13:07 -0400)]
c++: bad ggc_free in try_class_unification [PR109556]

Aside from correcting how try_class_unification copies multi-dimensional
'targs', r13-377-g3e948d645bc908 also made it ggc_free this copy as an
optimization.  But this is wrong since the call to unify within might've
captured the args in persistent memory such as the satisfaction cache
(as part of constrained auto deduction).

PR c++/109556

gcc/cp/ChangeLog:

* pt.cc (try_class_unification): Don't ggc_free the copy of
'targs'.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/concepts-placeholder13.C: New test.

(cherry picked from commit 5e284ebbc3082c5a8974d24e3a0977aa48f3cc60)

13 months agoRevert "libstdc++: Export global iostreams with GLIBCXX_3.4.31 symver [PR108969]"
Jonathan Wakely [Wed, 19 Apr 2023 12:18:56 +0000 (13:18 +0100)]
Revert "libstdc++: Export global iostreams with GLIBCXX_3.4.31 symver [PR108969]"

This reverts commit 762be0646bf96761ce68a9e06ab60c453e0963d0.

13 months agoRevert "libstdc++: Fix preprocessor condition in linker script [PR108969]"
Jonathan Wakely [Wed, 19 Apr 2023 12:18:53 +0000 (13:18 +0100)]
Revert "libstdc++: Fix preprocessor condition in linker script [PR108969]"

This reverts commit ed933888e680384e1e7af361b20dd484ad424f7d.

13 months agotestsuite: Fix up pr109524.C for -std=c++23 [PR109524]
Jakub Jelinek [Wed, 19 Apr 2023 08:01:04 +0000 (10:01 +0200)]
testsuite: Fix up pr109524.C for -std=c++23 [PR109524]

This testcase was reduced such that it isn't valid C++23, so with my
usual testing with GXX_TESTSUITE_STDS=98,11,14,17,20,2b it fails:
FAIL: g++.dg/pr109524.C  -std=gnu++2b (test for excess errors)
.../gcc/testsuite/g++.dg/pr109524.C: In function 'nn hh(nn)':
.../gcc/testsuite/g++.dg/pr109524.C:35:12: error: cannot bind non-const lvalue reference of type 'nn&' to an rvalue of type 'nn'
.../gcc/testsuite/g++.dg/pr109524.C:17:6: note:   initializing argument 1 of 'nn::nn(nn&)'
The following patch fixes that and I've verified it doesn't change
anything on what the test was testing, it still ICEs in r13-7198 and
passes in r13-7203, now in all language modes (except for 98 where
it is intentionally UNSUPPORTED).

2023-04-19  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109524
* g++.dg/pr109524.C (nn::nn): Change argument type from nn & to
const nn &.

(cherry picked from commit 794ffdb0fb6312ce07af0bfc797bef9f4cff4c61)

13 months agoinstall.texi: Document --enable-decimal-float for AArch64
Christophe Lyon [Mon, 17 Apr 2023 17:23:54 +0000 (19:23 +0200)]
install.texi: Document --enable-decimal-float for AArch64

When I committed the patches to enable support for DFP on AArch64, I
forgot to update the installation documentation.

This patch adds AArch64 as needed (same as i386/x86_64).

2023-04-17  Christophe Lyon  <christophe.lyon@arm.com>

gcc/
* doc/install.texi (enable-decimal-float): Add AArch64.

(cherry picked from commit cbddd574a78529b9176eb28253c20a335daefbb4)

13 months agoRISC-V: Force ilp32d for the T-Head FMV test
Palmer Dabbelt [Mon, 17 Apr 2023 18:20:44 +0000 (11:20 -0700)]
RISC-V: Force ilp32d for the T-Head FMV test

These functions are NOPs on the soft-float ABIs.  Since we're already
forcing the ISA, let's just force the ABI too.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/xtheadfmv-fmv.c: Force the ilp32d ABI.

(cherry picked from commit c16848ed8f30be952ac0167fd464ae794fa5ac67)

13 months agoRISC-V: Set the ABI for the RVV tests
Palmer Dabbelt [Mon, 17 Apr 2023 18:20:43 +0000 (11:20 -0700)]
RISC-V: Set the ABI for the RVV tests

The RVV test harness currently sets the ISA according to the target
tuple, but doesn't also set the ABI.  This just sets the ABI to match
the ISA, though we should really also be respecting the user's specific
ISA to test.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/rvv.exp (gcc_mabi): New variable.

(cherry picked from commit e6b050da8a4513ab37fd3699c7a963421fbe4d81)

13 months agoRISC-V: Clean up the pr106602.c testcase
Palmer Dabbelt [Mon, 17 Apr 2023 18:20:42 +0000 (11:20 -0700)]
RISC-V: Clean up the pr106602.c testcase

The test case that was added is rv64i-specific, as there's better ways
to generate this code on rv32i (where the long/int cast is a NOP) and on
rv64i_zba (where we have word shifts).  This renames the original test
case and adds two more for those targets.

gcc/testsuite/ChangeLog:
PR target/106602
* gcc.target/riscv/pr106602.c: Moved to...
* gcc.target/riscv/pr106602-rv64i.c: ...here.
* gcc.target/riscv/pr106602-rv32i.c: New test.
* gcc.target/riscv/pr106602-rv64i_zba.c: New test.

(cherry picked from commit 8c010f6fe5ebe80d2e054b31e04ae0e9f12ae368)

13 months agoDaily bump.
GCC Administrator [Wed, 19 Apr 2023 00:23:09 +0000 (00:23 +0000)]
Daily bump.

13 months agolibstdc++: Fix preprocessor condition in linker script [PR108969]
Jonathan Wakely [Tue, 18 Apr 2023 16:22:40 +0000 (17:22 +0100)]
libstdc++: Fix preprocessor condition in linker script [PR108969]

The linker script is preprocessed with $(top_builddir)/config.h not the
include/$target/bits/c++config.h version, which means that configure
macros do not have the _GLIBCXX_ prefix yet.

The _GLIBCXX_SYMVER_GNU and _GLIBCXX_SHARED checks are redundant,
because the gnu.ver file is only used for _GLIBCXX_SYMVER_GNU and the
linker script is only used for the shared library. Remove those.

libstdc++-v3/ChangeLog:

PR libstdc++/108969
* config/abi/pre/gnu.ver: Fix preprocessor condition.

(cherry picked from commit 6067ae4557a3a7e5b08359e78a29b8a9d5dfedce)

13 months agolibstdc++: Export global iostreams with GLIBCXX_3.4.31 symver [PR108969]
Jonathan Wakely [Tue, 18 Apr 2023 13:37:38 +0000 (14:37 +0100)]
libstdc++: Export global iostreams with GLIBCXX_3.4.31 symver [PR108969]

Since GCC 13 the global iostream objects are only initialized once in
libstdc++, and not by a std::ios::Init object in every translation unit
that includes <iostream>. To avoid using uninitialized streams defined
in an older libstdc++.so, translation units using the global iostreams
should depend on the GLIBCXX_3.4.31 symver.

Define std::cin as std::__io::cin and then export it as
std::cin@@GLIBCXX_3.4.31 so that references to std::cin bind to the new
symver. Also export it as @GLIBCXX_3.4 for backwards compatibility

libstdc++-v3/ChangeLog:

PR libstdc++/108969
* src/Makefile.am: Move globals_io.cc to here.
* src/Makefile.in: Regenerate.
* src/c++98/Makefile.am: Remove globals_io.cc from here.
* src/c++98/Makefile.in: Regenerate.
* src/c++98/globals_io.cc [_GLIBCXX_SYMVER_GNU] (cin): Adjust
symbol name and then export with GLIBCXX_3.4.31 symver.
(cout, cerr, clog, wcin, wcout, wcerr, wclog): Likewise.
* config/abi/post/aarch64-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/i486-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/m68k-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/riscv64-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt:
Regenerate.
* config/abi/post/s390x-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/post/x86_64-linux-gnu/baseline_symbols.txt:
Regenerate.
* config/abi/pre/gnu.ver: Add iostream objects to new symver.

13 months agoDocs: Add doc for RISC-V vector intrinsics
Kito Cheng [Tue, 18 Apr 2023 10:07:06 +0000 (18:07 +0800)]
Docs: Add doc for RISC-V vector intrinsics

Document which version of RISC-V vector intrinsics has implemented in
GCC.

gcc/ChangeLog:

* doc/extend.texi (Target Builtins): Add RISC-V Vector
Intrinsics.
(RISC-V Vector Intrinsics): Document GCC implemented which
version of RISC-V vector intrinsics and its reference.

(cherry picked from commit 14c1a8dfa3eaea283ab467c2aa3a62a25d3b49cb)

13 months agotree-optimization/109539 - restrict PHI handling in access diagnostics
Richard Biener [Tue, 18 Apr 2023 09:49:48 +0000 (11:49 +0200)]
tree-optimization/109539 - restrict PHI handling in access diagnostics

Access diagnostics visits the SSA def-use chains to diagnose things like
dangling pointer uses.  When that runs into PHIs it tries to prove
all incoming pointers of which one is the currently visited use are
related to decide whether to keep looking for the PHI def uses.
That turns out to be overly optimistic and thus costly.  The following
scraps the existing handling for simply requiring that we eventually
visit all incoming pointers of the PHI during the def-use chain
analysis and only then process uses of the PHI def.

Note this handles backedges of natural loops optimistically, diagnosing
the first iteration.  There's gcc.dg/Wuse-after-free-2.c containing
a testcase requiring this.

PR tree-optimization/109539
* gimple-ssa-warn-access.cc (pass_waccess::check_pointer_uses):
Re-implement pointer relatedness for PHIs.

(cherry picked from commit fdbaab2dc886f78a1e75512eeee0faa17e77c862)

13 months agolibstdc++: Implement range_adaptor_closure from P2387R3 [PR108827]
Patrick Palka [Tue, 18 Apr 2023 11:21:13 +0000 (07:21 -0400)]
libstdc++: Implement range_adaptor_closure from P2387R3 [PR108827]

PR libstdc++/108827

libstdc++-v3/ChangeLog:

* include/bits/ranges_cmp.h (__cpp_lib_ranges): Bump value
for C++23.
* include/std/ranges (range_adaptor_closure): Define for C++23.
* include/std/version (__cpp_lib_ranges): Bump value for
C++23.
* testsuite/std/ranges/version_c++23.cc: Bump expected value
of __cpp_lib_ranges.
* testsuite/std/ranges/range_adaptor_closure.cc: New test.

(cherry picked from commit cb5c71d16d0fb47638498365f5c857ce7c673eaf)

13 months agolibstdc++: Adding missing feature-test macros for C++23 ranges algos
Patrick Palka [Tue, 18 Apr 2023 11:21:09 +0000 (07:21 -0400)]
libstdc++: Adding missing feature-test macros for C++23 ranges algos

This patch also renames __cpp_lib_fold to __cpp_lib_ranges_fold
as per the current draft standard.

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h (__cpp_lib_ranges_contains):
Define for C++23.
(__cpp_lib_ranges_iota): Likewise.
(__cpp_lib_ranges_find_last): Likewise.
(__cpp_lib_fold): Rename to ...
(__cpp_lib_ranges_fold): ... this.
* include/std/version: As above.
* testsuite/25_algorithms/fold_left/1.cc: Adjust after
renaming __cpp_lib_fold.
* testsuite/std/ranges/version_c++23.cc: Verify values
of the above feature-test macros.

(cherry picked from commit 95525c5b8c2d6317b693d441520b7bc808cf9ec7)

13 months agolibstdc++: Fix typo in views::as_const's operator() [PR109525]
Patrick Palka [Tue, 18 Apr 2023 11:21:07 +0000 (07:21 -0400)]
libstdc++: Fix typo in views::as_const's operator() [PR109525]

PR libstdc++/109525

libstdc++-v3/ChangeLog:

* include/std/ranges (views::_AsConst::operator()): Add
missing const to constant_range test.
* testsuite/std/ranges/adaptors/as_const/1.cc (test02):
Improve formatting.  Adjust expected type of v2.
(test03): New test.

(cherry picked from commit 4ec4ceafcc04ec7bafb1857cf6d491030440a765)

13 months agorust: Disable --enable-languages=rust and silently exclude it from --enable-languages...
Jakub Jelinek [Tue, 18 Apr 2023 10:18:13 +0000 (12:18 +0200)]
rust: Disable --enable-languages=rust and silently exclude it from --enable-languages=all for GCC 13

As discussed on IRC, gccrs can't compile the standard libraries yet
and requires annoying -frust-incomplete-and-experimental-compiler-do-not-use
option to compile anything.

As such it is better to disable this at least for GCC 13.1, we'd keep
it allowed on the trunk where hopefully support to compile at least
some standard libraries will land soon and eventually a borrow checker.

If enough Rust support is backported from trunk to 13 branch before
13.2, we could revert this change then.

Tested on x86_64-linux with --enable-languages=c,c++,rust and
--enable-languages=c,c++,all , ok for 13 branch?

2023-04-18  Jakub Jelinek  <jakub@redhat.com>

* configure.ac: For --enable-languages= mentioning explicitly
rust emit an error, if included in all etc., silently disable
rust.
* configure: Regenerated.

13 months agolibsanitizer, darwin: Unsupport Darwin >= 22 for now.
Iain Sandoe [Mon, 17 Apr 2023 09:23:16 +0000 (10:23 +0100)]
libsanitizer, darwin: Unsupport Darwin >= 22 for now.

The mechanism for location dyld has altered from Darwin22 since dyld is now
in the shared cache.  The implemented mechanism for walking the cache uses
Apple Blocks which GCC does not yet support, and the fallback to the original
mechanism does not work there.

Until a suitable work-around can be found, unsupport Darwin22+.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
libsanitizer/ChangeLog:

* configure.tgt: Unsupport Darwin22+ until a mechanism can be found
to locate dyld in the shared cache.

(cherry picked from commit e722a1f42b28092c9f709a3f758fc4fe57db32b0)

13 months agoDaily bump.
GCC Administrator [Tue, 18 Apr 2023 00:22:11 +0000 (00:22 +0000)]
Daily bump.

13 months agoc++: bound ttp level lowering [PR109531]
Patrick Palka [Mon, 17 Apr 2023 22:52:07 +0000 (18:52 -0400)]
c++: bound ttp level lowering [PR109531]

Here when level lowering the bound ttp TT<typename T::type> via the
substitution T=C, we're neglecting to canonicalize (and thereby strip
of simple typedefs) the substituted template arguments {A<int>} before
determining the new canonical type via hash table lookup.  This leads to
a hash mismatch ICE for the two equivalent types TT<int> and TT<A<int>>
since iterative_hash_template_arg assumes type arguments are already
canonicalized.

We can fix this by canonicalizing or coercing the substituted arguments
directly, but seeing as creation and ordinary substitution of bound ttps
both go through lookup_template_class, which in turn performs the desired
coercion/canonicalization, it seems preferable to make this code path go
through lookup_template_class as well.

PR c++/109531

gcc/cp/ChangeLog:

* pt.cc (tsubst) <case BOUND_TEMPLATE_TEMPLATE_PARM>:
In the level-lowering case just use lookup_template_class
to rebuild the bound ttp.

gcc/testsuite/ChangeLog:

* g++.dg/template/canon-type-20.C: New test.
* g++.dg/template/ttp36.C: New test.

(cherry picked from commit 2245459c85a3f4cde3d33bf3e4edaff08f3b2404)

13 months agoSet DEV-PHASE to prerelease.
Jakub Jelinek [Mon, 17 Apr 2023 11:51:23 +0000 (13:51 +0200)]
Set DEV-PHASE to prerelease.

2023-04-17  Jakub Jelinek  <jakub@redhat.com>

* DEV-PHASE: Set to prerelease.

13 months agoipa: Fix double reference-count decrements for the same edge (PR 107769, PR 109318)
Martin Jambor [Mon, 17 Apr 2023 10:59:51 +0000 (12:59 +0200)]
ipa: Fix double reference-count decrements for the same edge (PR 107769, PR 109318)

It turns out that since addition of the code that can identify globals
which are only read from, the code that keeps track of the references
can decrement their count for the same calls, once during IPA-CP and
then again during inlining.  Fixed by adding a special flag to the
pass-through variant and simply wiping out the reference to the
refdesc structure from the constant ones.

Moreover, during debugging of the issue I have discovered that the
code removing references could remove a reference associated with the
same statement but of a wrong type.  In all cases it wanted to remove
an IPA_REF_ADDR reference so removing a lesser one instead should do
no harm in practice, but we should try to be consistent and so this
patch extends symtab_node::find_reference so that it searches for a
reference of a given type only.

gcc/ChangeLog:

2023-04-14  Martin Jambor  <mjambor@suse.cz>

PR ipa/107769
PR ipa/109318
* cgraph.h (symtab_node::find_reference): Add parameter use_type.
* ipa-prop.h (ipa_pass_through_data): New flag refdesc_decremented.
(ipa_zap_jf_refdesc): New function.
(ipa_get_jf_pass_through_refdesc_decremented): Likewise.
(ipa_set_jf_pass_through_refdesc_decremented): Likewise.
* ipa-cp.cc (ipcp_discover_new_direct_edges): Provide a value for
the new parameter of find_reference.
(adjust_references_in_caller): Likewise. Make sure the constant jump
function is not used to decrement a refdec counter again.  Only
decrement refdesc counters when the pass_through jump function allows
it.  Added a detailed dump when decrementing refdesc counters.
* ipa-prop.cc (ipa_print_node_jump_functions_for_edge): Dump new flag.
(ipa_set_jf_simple_pass_through): Initialize the new flag.
(ipa_set_jf_unary_pass_through): Likewise.
(ipa_set_jf_arith_pass_through): Likewise.
(remove_described_reference): Provide a value for the new parameter of
find_reference.
(update_jump_functions_after_inlining): Zap refdesc of new jfunc if
the previous pass_through had a flag mandating that we do so.
(propagate_controlled_uses): Likewise.  Only decrement refdesc
counters when the pass_through jump function allows it.
(ipa_edge_args_sum_t::duplicate): Provide a value for the new
parameter of find_reference.
(ipa_write_jump_function): Assert the new flag does not have to be
streamed.
* symtab.cc (symtab_node::find_reference): Add parameter use_type, use
it in searching.

gcc/testsuite/ChangeLog:

2023-04-06  Martin Jambor  <mjambor@suse.cz>

PR ipa/107769
PR ipa/109318
* gcc.dg/ipa/pr109318.c: New test.
* gcc.dg/lto/pr107769_0.c: Likewise.

13 months agoaarch64: disable LDP via tuning structure for -mcpu=ampere1
Philipp Tomsich [Thu, 23 Mar 2023 18:47:57 +0000 (19:47 +0100)]
aarch64: disable LDP via tuning structure for -mcpu=ampere1

AmpereOne (-mcpu=ampere1) breaks LDP instructions into two uops.
Given the chance that this causes instructions to slip into the next
decoding cycle and the additional overheads when handling
cacheline-crossing LDP instructions, we disable the generation of LDP
isntructions through the tuning structure from instruction combining
(such as in peephole2).

Given the code-density benefits in builtins and prologue/epilogue
expansion, we allow LDPs there.

This commit:
 * adds a new tuning option AARCH64_EXTRA_TUNE_NO_LDP_COMBINE
 * allows -moverride=tune=... to override this

These changes are benchmark-driven, yielding the following changes
(with a net-overall improvement):
   503.bwaves_r.      -0.88%
   507.cactuBSSN_r     0.35%
   508.namd_r          3.09%
   510.parest_r       -2.99%
   511.povray_r        5.54%
   519.lbm_r          15.83%
   521.wrf_r           0.56%
   526.blender_r       2.47%
   527.cam4_r          0.70%
   538.imagick_r       0.00%
   544.nab_r          -0.33%
   549.fotonik3d_r.   -0.42%
   554.roms_r          0.00%
   -------------------------
   = total             1.79%

Signed-off-by: Philipp Tomsich <philipp.tomsich@vrull.eu>
Co-Authored-By: Di Zhao <di.zhao@amperecomputing.com>
gcc/ChangeLog:

* config/aarch64/aarch64-tuning-flags.def (AARCH64_EXTRA_TUNING_OPTION):
Add AARCH64_EXTRA_TUNE_NO_LDP_COMBINE.
* config/aarch64/aarch64.cc (aarch64_operands_ok_for_ldpstp):
Check for the above tuning option when processing loads.

gcc/testsuite/ChangeLog:

* gcc.target/aarch64/ampere1-no_ldp_combine.c: New test.

13 months agotestsuite: Fix up vect-simd-clone-1[678]f.c tests some more
Jakub Jelinek [Mon, 17 Apr 2023 09:45:53 +0000 (11:45 +0200)]
testsuite: Fix up vect-simd-clone-1[678]f.c tests some more

With
make check-gcc check-g++ -j32 -k RUNTESTFLAGS='--target_board=unix\{-m32,-m32/-mavx,-m32/-mavx512f,-m32/-march=cascadelake,-m64,-m64/-mavx,-m64/-mavx512f,-m64/-march=cascadelake\}
+vect.exp=vect-simd-clone*'
the vect-simd-clone-1[678]f.c tests fail with -m32/-mavx512f and -m32/-march=cascadelake,
in that case there are zero matches rather than the 4 expected for ia32.
-m64/-mavx512f and -m64/-march=cascadelake works fine though (2 expected
matches).

So, the following patch just adds -mno-avx512f for x86 non-lp64.

2023-04-17  Jakub Jelinek  <jakub@redhat.com>

* gcc.dg/vect/vect-simd-clone-16f.c: Add -mno-avx512f for non-lp64 x86.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.

13 months agotree-optimization/109524 - ICE with VRP edge removal
Richard Biener [Mon, 17 Apr 2023 07:22:57 +0000 (09:22 +0200)]
tree-optimization/109524 - ICE with VRP edge removal

VRP queues edges to process late for updating global ranges for
__builtin_unreachable.  But this interferes with edge removal
from substitute_and_fold.  The following deals with this by
looking up the edge with source/dest block indices which do not
become stale.

PR tree-optimization/109524
* tree-vrp.cc (remove_unreachable::m_list): Change to a
vector of pairs of block indices.
(remove_unreachable::maybe_register_block): Adjust.
(remove_unreachable::remove_and_update_globals): Likewise.
Deal with removed blocks.

* g++.dg/pr109524.C: New testcase.

13 months agotestsuite: update builtins-5-p9-runnable.c for BE
Jiufu Guo [Fri, 14 Apr 2023 02:50:28 +0000 (10:50 +0800)]
testsuite: update builtins-5-p9-runnable.c for BE

Hi,

As PR108809 mentioned, vec_xl_len_r and vec_xst_len_r are tested
in gcc.target/powerpc/builtins-5-p9-runnable.c.
The vector operand of these two bifs are different from the view
of v16_int8 between BE and LE, even it is same from the view of
128bits(uint128/V1TI).

The test case gcc.target/powerpc/builtins-5-p9-runnable.c was
written for LE environment, this patch updates it for BE.

Tested on ppc64 BE and LE.
Is this ok for trunk?

BR,
Jeff (Jiufu)

gcc/testsuite/ChangeLog:

PR testsuite/108809
* gcc.target/powerpc/builtins-5-p9-runnable.c: Update for BE.

13 months agoRISC-V: Fix testsuite fail on RV32
Kito Cheng [Fri, 14 Apr 2023 07:34:40 +0000 (15:34 +0800)]
RISC-V: Fix testsuite fail on RV32

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/scalar_move-2.c: Adjust include way
for riscv_vector.h
* gcc.target/riscv/rvv/base/spill-sp-adjust.c: Add missing
-mabi.

13 months agoRISC-V: Add test cases for the RVV mask insn shortcut.
Pan Li [Fri, 14 Apr 2023 03:25:11 +0000 (11:25 +0800)]
RISC-V: Add test cases for the RVV mask insn shortcut.

There are sorts of shortcut codegen for the RVV mask insn. For
example.

vmxor vd, va, va => vmclr vd.

We would like to add more optimization like this but first of all
we must add the tests for the existing shortcut optimization, to
ensure we don't break existing optimization from underlying shortcut
optimization.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/base/mask_insn_shortcut.c: New test.

Signed-off-by: Pan Li <pan2.li@intel.com>
13 months agoDaily bump.
GCC Administrator [Mon, 17 Apr 2023 00:17:00 +0000 (00:17 +0000)]
Daily bump.

13 months ago[committed] [PR target/109508] Adjust conditional move expansion for SFB
Jeff Law [Sun, 16 Apr 2023 15:55:32 +0000 (09:55 -0600)]
[committed] [PR target/109508] Adjust conditional move expansion for SFB

Recently the conditional move expander's predicates were loosened for the
benefit of the THEAD processors.  In particular one operand that was
previously "register_operand" is now "reg_or_0_operand".  That's fine for
THEAD, but breaks for SFB which requires a register for that operand.

This results in an ICE when compiling the testcase an SFB target such as
the sifive s76.

This change adjusts the expansion code slightly to copy the value into
a register for SFB.

Bootstrapped and regression tested (c,c++,fortran only) with a toolchain
configured to enable SFB by default.

PR target/109508
gcc/

* config/riscv/riscv.cc (riscv_expand_conditional_move): For
TARGET_SFB_ALU, force the true arm into a register.

gcc/testsuite
* gcc.target/riscv/pr109508.c: New test.

13 months ago[Committed] New test case gcc.target/avr/pr54816.c
Roger Sayle [Sun, 16 Apr 2023 12:03:10 +0000 (13:03 +0100)]
[Committed] New test case gcc.target/avr/pr54816.c

PR target/54816 is now fixed on mainline.  This adds a test case to
check that it doesn't regress in future.  Tested with a cross compiler
to avr-elf.  Committed as obvious.

2023-04-16  Roger Sayle  <roger@nextmovesoftware.com>

gcc/testsuite/ChangeLog
PR target/54816
* gcc.target/avr/pr54816.c: New test case.

13 months agoDaily bump.
GCC Administrator [Sun, 16 Apr 2023 00:16:26 +0000 (00:16 +0000)]
Daily bump.

13 months agoFix fallout of previous change on x86/Linux
Eric Botcazou [Sat, 15 Apr 2023 17:35:02 +0000 (19:35 +0200)]
Fix fallout of previous change on x86/Linux

gcc/ada/
PR bootstrap/109510
* gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Do not reset
align to zero in any case.  Set TYPE_USER_ALIGN on the type only if
it is an aggregate type, or else a type whose default alignment is
specifically capped on selected platforms.

13 months agoFix handling of large arguments passed by value.
John David Anglin [Sat, 15 Apr 2023 17:02:44 +0000 (17:02 +0000)]
Fix handling of large arguments passed by value.

2023-04-15  John David Anglin  <danglin@gcc.gnu.org>

gcc/ChangeLog:

PR target/104989
* config/pa/pa-protos.h (pa_function_arg_size): Update prototype.
* config/pa/pa.cc (pa_function_arg): Return NULL_RTX if argument
size is zero.
(pa_arg_partial_bytes): Don't call pa_function_arg_size twice.
(pa_function_arg_size): Change return type to int.  Return zero
for arguments larger than 1 GB.  Update comments.

13 months agoc++: constexpr aggregate destruction [PR109357]
Jason Merrill [Sat, 15 Apr 2023 02:40:43 +0000 (22:40 -0400)]
c++: constexpr aggregate destruction [PR109357]

We were assuming that the result of evaluation of TARGET_EXPR_INITIAL would
always be the new value of the temporary, but that's not necessarily true
when the initializer is complex (i.e. target_expr_needs_replace).  In that
case evaluating the initializer initializes the temporary as a side-effect.

PR c++/109357

gcc/cp/ChangeLog:

* constexpr.cc (cxx_eval_constant_expression) [TARGET_EXPR]:
Check for complex initializer.

gcc/testsuite/ChangeLog:

* g++.dg/cpp2a/constexpr-dtor15.C: New test.

13 months agoif-conv: Small improvement for expansion of complex PHIs [PR109154]
Jakub Jelinek [Sat, 15 Apr 2023 10:08:45 +0000 (12:08 +0200)]
if-conv: Small improvement for expansion of complex PHIs [PR109154]

The following patch is just a dumb improvement, gets rid of 2 unnecessary
instructions on both the PR's original testcase and on the two reduced ones,
both on -mcpu=neoverse-v1 and -mavx512f.

The thing is, if we have args_len (args_len >= 2) unique PHI arguments,
we need only args_len - 1 COND_EXPRs to expand the PHI, because first
COND_EXPR can merge 2 unique arguments and all the following ones merge
another unique argument with the previously merged arguments,
while the code for mysterious reasons was always emitting args_len
COND_EXPRs, where the first COND_EXPR merged the first and second unique
arguments, the second COND_EXPR merged the second unique argument with
result of merging the first and second unique arguments and the rest was
already expectable, nth COND_EXPR for n > 2 merged the nth unique argument
with result of merging the previous unique arguments.
Now, in my understanding, the bb_predicate for bb's predecessor need to
form a disjunct set which together creates the successor's bb_predicate,
so I don't see why we'd need to check all the bb_predicates, if we check
all but one then when all those other ones are false the last bb_predicate
is necessarily true.  Given that the code attempts to sort argument with
most occurrences (so likely most complex combined predicate) last, I chose
not to test that last argument's predicate.
So e.g. on the testcase from comment 47 in the PR:
void
foo (int *f, int d, int e)
{
  for (int i = 0; i < 1024; i++)
    {
      int a = f[i];
      int t;
      if (a < 0)
        t = 1;
      else if (a < e)
        t = 1 - a * d;
      else
        t = 0;
      f[i] = t;
    }
}
we used to emit:
  _7 = a_10 < 0;
  _21 = a_10 >= 0;
  _22 = a_10 < e_11(D);
  _23 = _21 & _22;
  _26 = a_10 >= e_11(D);
  _27 = _21 & _26;
  _ifc__42 = _7 ? 1 : t_13;
  _ifc__43 = _23 ? t_13 : _ifc__42;
  t_6 = _27 ? 0 : _ifc__43;
while the following patch changes it to:
  _7 = a_10 < 0;
  _21 = a_10 >= 0;
  _22 = a_10 < e_11(D);
  _23 = _21 & _22;
  _ifc__42 = _23 ? t_13 : 0;
  t_6 = _7 ? 1 : _ifc__42;
which I believe should be sufficient for a PHI <1, t_13, 0>.

I've gathered some statistics and on x86_64-linux and i686-linux
bootstraps/regtests, this code triggers:
     92 4 4
    112 2 4
    141 3 4
   4046 3 3
(where 2nd number is args_len and 3rd argument EDGE_COUNT (bb->preds)
and first argument count of those from sort | uniq -c | sort -n).
In all these cases the patch should squeze one extra COND_EXPR and
its associated predicate (the latter only if it wasn't used elsewhere).

Incrementally, I think we should try to perform some analysis on which
predicates depend on inverses of other predicates and if possible try
to sort the arguments better and omit testing unnecessary predicates.
So essentially for the above testcase deconstruct it back to:
  _7 = a_10 < 0;
  _22 = a_10 < e_11(D);
  _ifc__42 = _22 ? t_13 : 0;
  t_6 = _7 ? 1 : _ifc__42;
which is like what this patch produces, but with the & a_10 >= 0 part
removed, because the last predicate is a_10 < 0 and so testing a_10 >= 0
on what appears on the false branch doesn't make sense.
But I'm afraid that will take more work than is doable in stage4 right now.

2023-04-15  Jakub Jelinek  <jakub@redhat.com>

PR tree-optimization/109154
* tree-if-conv.cc (predicate_scalar_phi): For complex PHIs, emit just
args_len - 1 COND_EXPRs rather than args_len.  Formatting fix.

13 months agors6000: don't expect __ibm128 with 64-bit long double [PR99708]
Alexandre Oliva [Sat, 15 Apr 2023 02:53:36 +0000 (23:53 -0300)]
rs6000: don't expect __ibm128 with 64-bit long double [PR99708]

When long double is 64-bit wide, as on vxworks, the rs6000 backend
defines neither the __ibm128 type nor the __SIZEOF_IBM128__ macro, but
pr99708.c expected both to be always defined.  Adjust the test to
match the implementation.

Co-Authored-By: Kewen Lin <linkw@linux.ibm.com>
for  gcc/testsuite/ChangeLog

PR target/99708
* gcc.target/powerpc/pr99708.c: Accept lack of
__SIZEOF_IBM128__ when long double is 64-bit wide.

13 months ago-Wdangling-pointer: fix MEM_REF handling [PR109514]
Jason Merrill [Fri, 14 Apr 2023 17:37:16 +0000 (13:37 -0400)]
-Wdangling-pointer: fix MEM_REF handling [PR109514]

Here we hit the MEM_REF case, with its arg an ADDR_EXPR, but had no handling
for that and wrongly assumed it would be a reference to a local variable.
This patch overhauls the logic for deciding whether the target is something
to warn about so that we only warn if we specifically recognize the target
as non-local.  None of the existing tests regress as a result.

PR c++/109514

gcc/ChangeLog:

* gimple-ssa-warn-access.cc (pass_waccess::check_dangling_stores):
Overhaul lhs_ref.ref analysis.

gcc/testsuite/ChangeLog:

* g++.dg/warn/Wdangling-pointer-6.C: New test.

13 months agoDaily bump.
GCC Administrator [Sat, 15 Apr 2023 00:16:36 +0000 (00:16 +0000)]
Daily bump.

13 months agoFortran: fix compile-time simplification of SET_EXPONENT [PR109511]
Harald Anlauf [Fri, 14 Apr 2023 18:45:19 +0000 (20:45 +0200)]
Fortran: fix compile-time simplification of SET_EXPONENT [PR109511]

gcc/fortran/ChangeLog:

PR fortran/109511
* simplify.cc (gfc_simplify_set_exponent): Fix implementation of
compile-time simplification of intrinsic SET_EXPONENT for argument
X < 1 and for I < 0.

gcc/testsuite/ChangeLog:

PR fortran/109511
* gfortran.dg/set_exponent_1.f90: New test.

13 months agoFix build failure of Ada runtime for Aarch64 targets
Eric Botcazou [Fri, 14 Apr 2023 18:14:07 +0000 (20:14 +0200)]
Fix build failure of Ada runtime for Aarch64 targets

The Aarch64 back-end now asserts that the main variant of scalar types
has TYPE_USER_ALIGN cleared, and that's not the case for scalar types
declared with a confirming alignment clause in Ada.

gcc/ada/
PR bootstrap/109510
* gcc-interface/decl.cc (gnat_to_gnu_entity) <types>: Reset align
to zero if its value is equal to TYPE_ALIGN and the type is scalar.
Set TYPE_USER_ALIGN on the type only if align is positive.

13 months agolibstdc++: Implement P2278R4 "cbegin should always return a constant iterator"
Patrick Palka [Fri, 14 Apr 2023 14:32:12 +0000 (10:32 -0400)]
libstdc++: Implement P2278R4 "cbegin should always return a constant iterator"

This also implements the approved follow-up LWG issues 3765, 3766, 3769,
3770, 3811, 3850, 3853, 3862 and 3872.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (const_iterator_t): Define for C++23.
(const_sentinel_t): Likewise.
(range_const_reference_t): Likewise.
(constant_range): Likewise.
(__cust_access::__possibly_const_range): Likewise, replacing ...
(__cust_access::__as_const): ... this.
(__cust_access::_CBegin::operator()): Redefine for C++23 as per P2278R4.
(__cust_access::_CEnd::operator()): Likewise.
(__cust_access::_CRBegin::operator()): Likewise.
(__cust_access::_CREnd::operator()): Likewise.
(__cust_access::_CData::operator()): Likewise.
* include/bits/ranges_util.h (ranges::__detail::__different_from):
Make it an alias of std::__detail::__different_from.
(view_interface::cbegin): Define for C++23.
(view_interface::cend): Likewise.
* include/bits/stl_iterator.h (__detail::__different_from): Define.
(iter_const_reference_t): Define for C++23.
(__detail::__constant_iterator): Likewise.
(__detail::__is_const_iterator): Likewise.
(__detail::__not_a_const_iterator): Likewise.
(__detail::__iter_const_rvalue_reference_t): Likewise.
(__detail::__basic_const_iter_cat):: Likewise.
(const_iterator): Likewise.
(__detail::__const_sentinel): Likewise.
(const_sentinel): Likewise.
(basic_const_iterator): Likewise.
(common_type<basic_const_iterator<_Tp>, _Up>): Likewise.
(common_type<_Up, basic_const_iterator<_Tp>>): Likewise.
(common_type<basic_const_iterator<_Tp>, basic_const_iterator<Up>>):
Likewise.
(make_const_iterator): Define for C++23.
(make_const_sentinel): Likewise.
* include/std/ranges (__cpp_lib_ranges_as_const): Likewise.
(as_const_view): Likewise.
(enable_borrowed_range<as_const_view>): Likewise.
(views::__detail::__is_ref_view): Likewise.
(views::__detail::__can_is_const_view): Likewise.
(views::_AsConst, views::as_const): Likewise.
* include/std/span (span::const_iterator): Likewise.
(span::const_reverse_iterator): Likewise.
(span::cbegin): Likewise.
(span::cend): Likewise.
(span::crbegin): Likewise.
(span::crend): Likewise.
* include/std/version (__cpp_lib_ranges_as_const): Likewise.
* testsuite/std/ranges/adaptors/join.cc (test06): Adjust to
behave independently of C++20 vs C++23.
* testsuite/std/ranges/version_c++23.cc: Verify value of
__cpp_lib_ranges_as_const macro.
* testsuite/24_iterators/const_iterator/1.cc: New test.
* testsuite/std/ranges/adaptors/as_const/1.cc: New test.

13 months agolibstdc++: Move down definitions of ranges::cbegin/cend/cetc
Patrick Palka [Fri, 14 Apr 2023 14:31:54 +0000 (10:31 -0400)]
libstdc++: Move down definitions of ranges::cbegin/cend/cetc

This moves down the definitions of the range const-access CPOs to after
the definition of input_range in preparation for implementing P2278R4
which redefines these CPOs in a way that indirectly uses input_range.

libstdc++-v3/ChangeLog:

* include/bits/ranges_base.h (__cust_access::__as_const)
(__cust_access::_CBegin, __cust::cbegin)
(__cust_access::_CEnd, __cust::cend)
(__cust_access::_CRBegin, __cust::crbegin)
(__cust_access::_CREnd, __cust::crend)
(__cust_access::_CData, __cust::cdata): Move down definitions to
shortly after the definition of input_range.

13 months agolibstdc++: Implement ranges::fold_* from P2322R6
Patrick Palka [Fri, 14 Apr 2023 14:31:44 +0000 (10:31 -0400)]
libstdc++: Implement ranges::fold_* from P2322R6

libstdc++-v3/ChangeLog:

* include/bits/ranges_algo.h: Include <optional> for C++23.
(__cpp_lib_fold): Define for C++23.
(in_value_result): Likewise.
(__detail::__flipped): Likewise.
(__detail::__indirectly_binary_left_foldable_impl): Likewise.
(__detail::__indirectly_binary_left_foldable): Likewise.
(___detail:__indirectly_binary_right_foldable): Likewise.
(fold_left_with_iter_result): Likewise.
(__fold_left_with_iter_fn, fold_left_with_iter): Likewise.
(__fold_left_fn, fold_left): Likewise.
(__fold_left_first_with_iter_fn, fold_left_first_with_iter):
Likewise.
(__fold_left_first_fn, fold_left_first): Likewise.
(__fold_right_fn, fold_right): Likewise.
(__fold_right_last_fn, fold_right_last): Likewise.
* include/std/version (__cpp_lib_fold): Likewise.
* testsuite/25_algorithms/fold_left/1.cc: New test.
* testsuite/25_algorithms/fold_right/1.cc: New test.

13 months agovect-simd-clone testcase adjustments
Richard Biener [Fri, 14 Apr 2023 11:31:04 +0000 (13:31 +0200)]
vect-simd-clone testcase adjustments

The following reverts the s/avx_runtime/avx/ changes I've done,
they were wrong.

* gcc.dg/vect/vect-simd-clone-16e.c: Revert back to
checking avx_runtime in dump scanning.
* gcc.dg/vect/vect-simd-clone-17e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18e.c: Likewise.

13 months agolibstdc++: Improve diagnostics for invalid std::format calls
Jonathan Wakely [Thu, 13 Apr 2023 15:34:51 +0000 (16:34 +0100)]
libstdc++: Improve diagnostics for invalid std::format calls

Add a static_assert and a comment so that calling std::format for
unformattable argument types will now show:

/home/jwakely/gcc/13/include/c++/13.0.1/format:3563:22: error: static assertion failed: std::formatter must be specialized for each format arg
 3563 |       static_assert((is_default_constructible_v<formatter<_Args, _CharT>> && ...),
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

and:

  140 |       formatter() = delete; // No std::formatter specialization for this type.

libstdc++-v3/ChangeLog:

* include/std/format (formatter): Add comment to deleted default
constructor of primary template.
(_Checking_scanner): Add static_assert.

13 months agoFortran: Fix an excess finalization during allocation [PR104272]
Paul Thomas [Fri, 14 Apr 2023 10:14:00 +0000 (11:14 +0100)]
Fortran: Fix an excess finalization during allocation [PR104272]

2023-04-14  Paul Thomas  <pault@gcc.gnu.org>

gcc/fortran
PR fortran/104272
* gfortran.h : Add expr3_not_explicit bit field to gfc_code.
* resolve.cc (resolve_allocate_expr): Set bit field when the
default initializer is applied to expr3.
* trans-stmt.cc (gfc_trans_allocate): If expr3_not_explicit is
set, do not deallocate expr3.

gcc/testsuite/
PR fortran/104272
* gfortran.dg/class_result_8.f90 : Number of builtin_frees down
from 6 to 5 without memory leaks.
* gfortran.dg/finalize_52.f90: New test

13 months agotree-optimization/109502 - vector conversion between mask and non-mask
Richard Biener [Fri, 14 Apr 2023 07:55:27 +0000 (09:55 +0200)]
tree-optimization/109502 - vector conversion between mask and non-mask

The following fixes a check that should have rejected vectorizing
a conversion between a mask and non-mask type.  Those should be
done via pattern statements.

PR tree-optimization/109502
* tree-vect-stmts.cc (vectorizable_assignment): Fix
check for conversion between mask and non-mask types.

* gcc.dg/vect/pr109502.c: New testcase.

13 months agoFix vect-simd-clone testcase dump scanning
Richard Biener [Fri, 14 Apr 2023 09:35:58 +0000 (11:35 +0200)]
Fix vect-simd-clone testcase dump scanning

This replaces i686*-*-* && { ! lp64 } with the appropriate
{ i?86-*-* x86_64-*-* } && { ! lp64 } for the testcases and
also amends the e variants checking last variant for avx.
I've used avx in the dump scanning, not avx_runtime, since
the dumps get produced when one would not execute but only
compile them.  The f varaints lack AVX checking, I didn't
rectify this with this patch.

* gcc.dg/vect/vect-simd-clone-16e.c: Fix x86 lp64 checking
and add missing avx guard.
* gcc.dg/vect/vect-simd-clone-17e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18e.c: Likewise.
* gcc.dg/vect/vect-simd-clone-16f.c: Fix x86 lp64 checking.
* gcc.dg/vect/vect-simd-clone-17f.c: Likewise.
* gcc.dg/vect/vect-simd-clone-18f.c: Likewise.

13 months agocombine: Fix AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]
Jakub Jelinek [Fri, 14 Apr 2023 07:20:49 +0000 (09:20 +0200)]
combine: Fix AND handling for WORD_REGISTER_OPERATIONS targets [PR109040]

The following testcase is miscompiled on riscv since the addition
of *mvconst_internal define_insn_and_split.
We have:
(insn 36 35 39 2 (set (mem/c:SI (plus:SI (reg/f:SI 65 frame)
                (const_int -64 [0xffffffffffffffc0])) [2  S4 A128])
        (reg:SI 166)) "pr109040.c":9:11 178 {*movsi_internal}
     (expr_list:REG_DEAD (reg:SI 166)
        (nil)))
(insn 39 36 40 2 (set (reg:SI 171)
        (zero_extend:SI (mem/c:HI (plus:SI (reg/f:SI 65 frame)
                    (const_int -64 [0xffffffffffffffc0])) [0  S2 A128]))) "pr109040.c":9:11 111 {*zero_extendhisi2}
     (nil))
and RTL DSE's replace_read since r0-86337-g18b526e806ab6455 handles
even different modes like in the above case, and so it optimizes it into:
(insn 47 35 39 2 (set (reg:HI 175)
        (subreg:HI (reg:SI 166) 0)) "pr109040.c":9:11 179 {*movhi_internal}
     (expr_list:REG_DEAD (reg:SI 166)
        (nil)))
(insn 39 47 40 2 (set (reg:SI 171)
        (zero_extend:SI (reg:HI 175))) "pr109040.c":9:11 111 {*zero_extendhisi2}
     (expr_list:REG_DEAD (reg:HI 175)
        (nil)))
Pseudo 166 is result of AND with 0x8084c constant (forced into a register).
Combine attempts to combine the AND with the insn 47 above created by DSE,
and turns it because of WORD_REGISTER_OPERATIONS and its assumption that all
the subword operations are actually done on word mode into:
(set (subreg:SI (reg:HI 175) 0)
    (and:SI (reg:SI 167 [ m ])
        (reg:SI 168)))
and later on the ZERO_EXTEND is thrown away.

We then see
(and:SI (subreg:SI (reg:HI 175) 0) (const_int 0x84c))
and optimize that into
(subreg:SI (and:HI (reg:HI 175) (const_int 0x84c)) 0)
which is still fine, in WORD_REGISTER_OPERATIONS the AND in HImode
will set all upper bits up to BITS_PER_WORD to zeros.

But later on simplify_binary_operation_1 or simplify_and_const_int_1
sees that because nonzero_bits ((reg:HI 175), HImode) == 0x84c, we can
optimize the AND into (reg:HI 175).  That isn't correct, because while
the low 16 bits of that REG are known to have all bits but 0x84c cleared,
we don't know that all the upper 16 bits are all clear as well.
So, for WORD_REGISTER_OPERATIONS for integral modes smaller than word mode,
we need to check all bits from word_mode in nonzero_bits for the optimizations.

2023-04-14  Jeff Law  <jlaw@ventanamicro.com>
    Jakub Jelinek  <jakub@redhat.com>

PR target/108947
PR target/109040
* combine.cc (simplify_and_const_int_1): Compute nonzero_bits in
word_mode rather than mode if WORD_REGISTER_OPERATIONS and mode is
smaller than word_mode.
* simplify-rtx.cc (simplify_context::simplify_binary_operation_1)
<case AND>: Likewise.

* gcc.dg/pr108947.c: New test.
* gcc.c-torture/execute/pr109040.c: New test.

13 months agoloop-iv: Fix up bounds computation
Jakub Jelinek [Fri, 14 Apr 2023 07:19:25 +0000 (09:19 +0200)]
loop-iv: Fix up bounds computation

On Thu, Apr 13, 2023 at 06:35:07AM -0600, Jeff Law wrote:
> Bootstrap was successful with v3, but there's hundreds of testsuite failures
> due to the simplify-rtx hunk.  compile/20070520-1.c for example when
> compiled with:  -O3 -funroll-loops -march=rv64gc -mabi=lp64d
>
> Thursdays are my hell day.  It's unlikely I'd be able to look at this at all
> today.

So, seems to me this is because loop-iv.cc asks for invalid RTL to be
simplified, it calls simplify_gen_binary (AND, SImode,
(subreg:SI (plus:DI (reg:DI 289 [ ivtmp_312 ])
        (const_int 4294967295 [0xffffffff])) 0),
(const_int 4294967295 [0xffffffff]))
but 0xffffffff is not valid SImode CONST_INT, and unlike previously
we no longer on WORD_REGISTER_OPERATIONS targets which have DImode
word_mode optimize that into the op0, so the invalid constant is emitted
into the IL and checking fails.

The following patch fixes that (and we optimize that & -1 away even earlier
with that).

2023-04-14  Jakub Jelinek  <jakub@redhat.com>

* loop-iv.cc (iv_number_of_iterations): Use gen_int_mode instead
of GEN_INT.