diff -Nru gcc-10-10.3.0/debian/changelog gcc-10-10.3.0/debian/changelog --- gcc-10-10.3.0/debian/changelog 2022-01-13 10:55:32.000000000 +0000 +++ gcc-10-10.3.0/debian/changelog 2022-03-24 12:12:38.000000000 +0000 @@ -1,3 +1,32 @@ +gcc-10 (10.3.0-15ubuntu1) jammy; urgency=medium + + * Merge with Debian; remaining changes: + - Build from upstream sources. + + -- Matthias Klose Thu, 24 Mar 2022 13:12:38 +0100 + +gcc-10 (10.3.0-15) unstable; urgency=medium + + * Update to git 20220324 from the gcc-10 branch. + - Fix PR tree-optimization/103237, PR middle-end/103181, + PR middle-end/103248, PR tree-optimization/102798, PR ipa/102762, + PR tree-optimization/100923, PR tree-optimization/101158, + PR target/103627 (PPC), PR target/103627 (PPC), PR target/104469 (x86), + PR target/104458 (x86), PR target/104451 (x86), PR target/104090 (PPC), + PR middle-end/95115, PR target/102976 (PPC), PR ada/103538, + PR ada/103538, PR fortran/104619, PR fortran/104311, PR fortran/104331, + PR fortran/83079, PR fortran/104127, PR fortran/104227, + PR fortran/101762, PR fortran/67804, PR fortran/103782, + PR fortran/103692, PR fortran/102332, PR sanitizer/102911, + PR libstdc++/102358, PR target/87496 (PPC), PR target/104208 (PPC), + PR target/104453 (x86), PR tree-optimization/104511, + PR target/100784 (x86), PR target/104253 (PPC). + * Support the ld.mold linker, patch taken from the trunk. + * Don't enable -fcf-protection with -m16 and -m32. LP: #1940029. + * Don't run the tests on ppc64 and sh4, hanging on the buildds. + + -- Matthias Klose Thu, 24 Mar 2022 13:03:07 +0100 + gcc-10 (10.3.0-14ubuntu1) jammy; urgency=medium * Merge with Debian; remaining changes: diff -Nru gcc-10-10.3.0/debian/patches/gcc-distro-specs.diff gcc-10-10.3.0/debian/patches/gcc-distro-specs.diff --- gcc-10-10.3.0/debian/patches/gcc-distro-specs.diff 2020-11-18 23:37:50.000000000 +0000 +++ gcc-10-10.3.0/debian/patches/gcc-distro-specs.diff 2022-03-24 12:12:23.000000000 +0000 @@ -66,7 +66,7 @@ + Available on x86 and x86_64. */ +#ifndef CF_PROTECTION_SPEC +# ifdef DIST_DEFAULT_CF_PROTECTION -+# define CF_PROTECTION_SPEC " %{!fcf-protection*:%{!fno-cf-protection:-fcf-protection}}" ++# define CF_PROTECTION_SPEC " %{!m16:%{!m32:%{!fcf-protection*:%{!fno-cf-protection:-fcf-protection}}}}" +# else +# define CF_PROTECTION_SPEC "" +# endif diff -Nru gcc-10-10.3.0/debian/patches/gcc-mold.diff gcc-10-10.3.0/debian/patches/gcc-mold.diff --- gcc-10-10.3.0/debian/patches/gcc-mold.diff 1970-01-01 00:00:00.000000000 +0000 +++ gcc-10-10.3.0/debian/patches/gcc-mold.diff 2022-03-24 12:12:23.000000000 +0000 @@ -0,0 +1,85 @@ +# DP: Support ld.mold linker, patch taken from the trunk. + +--- a/src/gcc/collect2.c ++++ b/src/gcc/collect2.c +@@ -785,6 +785,7 @@ main (int argc, char **argv) + USE_GOLD_LD, + USE_BFD_LD, + USE_LLD_LD, ++ USE_MOLD_LD, + USE_LD_MAX + } selected_linker = USE_DEFAULT_LD; + static const char *const ld_suffixes[USE_LD_MAX] = +@@ -793,7 +794,8 @@ main (int argc, char **argv) + PLUGIN_LD_SUFFIX, + "ld.gold", + "ld.bfd", +- "ld.lld" ++ "ld.lld", ++ "ld.mold" + }; + static const char *const real_ld_suffix = "real-ld"; + static const char *const collect_ld_suffix = "collect-ld"; +@@ -970,6 +972,8 @@ main (int argc, char **argv) + selected_linker = USE_GOLD_LD; + else if (strcmp (argv[i], "-fuse-ld=lld") == 0) + selected_linker = USE_LLD_LD; ++ else if (strcmp (argv[i], "-fuse-ld=mold") == 0) ++ selected_linker = USE_MOLD_LD; + else if (strncmp (argv[i], "-o", 2) == 0) + { + /* Parse the output filename if it's given so that we can make +@@ -1082,7 +1086,7 @@ main (int argc, char **argv) + ld_file_name = 0; + #ifdef DEFAULT_LINKER + if (selected_linker == USE_BFD_LD || selected_linker == USE_GOLD_LD || +- selected_linker == USE_LLD_LD) ++ selected_linker == USE_LLD_LD || selected_linker == USE_MOLD_LD) + { + char *linker_name; + # ifdef HOST_EXECUTABLE_SUFFIX +@@ -1317,7 +1321,7 @@ main (int argc, char **argv) + else if (!use_collect_ld + && strncmp (arg, "-fuse-ld=", 9) == 0) + { +- /* Do not pass -fuse-ld={bfd|gold|lld} to the linker. */ ++ /* Do not pass -fuse-ld={bfd|gold|lld|mold} to the linker. */ + ld1--; + ld2--; + } +--- a/src/gcc/common.opt ++++ b/src/gcc/common.opt +@@ -2967,6 +2967,10 @@ fuse-ld=lld + Common Driver Negative(fuse-ld=lld) + Use the lld LLVM linker instead of the default linker. + ++fuse-ld=mold ++Common Driver Negative(fuse-ld=mold) ++Use the Modern linker (MOLD) linker instead of the default linker. ++ + fuse-linker-plugin + Common Undocumented Var(flag_use_linker_plugin) + +--- a/src/gcc/gcc.c ++++ b/src/gcc/gcc.c +@@ -4307,6 +4307,10 @@ driver_handle_option (struct gcc_options + use_ld = ".gold"; + break; + ++ case OPT_fuse_ld_mold: ++ use_ld = ".mold"; ++ break; ++ + case OPT_fcompare_debug_second: + compare_debug_second = 1; + break; +--- a/src/gcc/opts.c ++++ b/src/gcc/opts.c +@@ -2875,6 +2875,7 @@ common_handle_option (struct gcc_options + case OPT_fuse_ld_bfd: + case OPT_fuse_ld_gold: + case OPT_fuse_ld_lld: ++ case OPT_fuse_ld_mold: + case OPT_fuse_linker_plugin: + /* No-op. Used by the driver and passed to us because it starts with f.*/ + break; diff -Nru gcc-10-10.3.0/debian/patches/gcc-mold-doc.diff gcc-10-10.3.0/debian/patches/gcc-mold-doc.diff --- gcc-10-10.3.0/debian/patches/gcc-mold-doc.diff 1970-01-01 00:00:00.000000000 +0000 +++ gcc-10-10.3.0/debian/patches/gcc-mold-doc.diff 2022-03-24 12:12:23.000000000 +0000 @@ -0,0 +1,15 @@ +# DP: Support ld.mold linker, patch taken from the trunk (documentation). + +--- a/src/gcc/doc/invoke.texi ++++ b/src/gcc/doc/invoke.texi +@@ -16266,6 +16266,10 @@ Use the @command{gold} linker instead of the default linker. + @opindex fuse-ld=lld + Use the LLVM @command{lld} linker instead of the default linker. + ++@item -fuse-ld=mold ++@opindex fuse-ld=mold ++Use the Modern Linker (@command{mold}) instead of the default linker. ++ + @cindex Libraries + @item -l@var{library} + @itemx -l @var{library} diff -Nru gcc-10-10.3.0/debian/patches/git-updates.diff gcc-10-10.3.0/debian/patches/git-updates.diff --- gcc-10-10.3.0/debian/patches/git-updates.diff 2022-01-13 10:55:27.000000000 +0000 +++ gcc-10-10.3.0/debian/patches/git-updates.diff 2022-03-24 12:12:23.000000000 +0000 @@ -1,7 +1,7 @@ -# DP: updates from the gcc-10 branch upto 20220113 (35ca78a35a9). +# DP: updates from the gcc-10 branch upto 20220324 (d800a6f6c03). LANG=C git diff --no-renames --src-prefix=a/src/ --dst-prefix=b/src/ \ - f00b5710a30f22efc3171c393e56aeb335c3cd39 35ca78a35a9c5352a39bbb087c3eeb8b2ba78588 \ + f00b5710a30f22efc3171c393e56aeb335c3cd39 d800a6f6c03e404a5f033299d9fd1c5caa3b7738 \ | awk '/^diff .*\.texi/ {skip=1; next} /^diff / { skip=0 } skip==0' \ | grep -v -E '^(diff|index)' @@ -33,7 +33,32 @@ STAGE3_CXXFLAGS += -D__USE_MINGW_ACCESS --- a/src/contrib/ChangeLog +++ b/src/contrib/ChangeLog -@@ -1,3 +1,56 @@ +@@ -1,3 +1,81 @@ ++2022-01-27 Martin Liska ++ ++ * gcc-git-customization.sh: Sync from master. ++ * git-descr.sh: New file. ++ * git-undescr.sh: New file. ++ ++2022-01-24 Martin Liska ++ ++ * gcc-changelog/git_commit.py: Sync from master. ++ * gcc-changelog/test_email.py: Likewise. ++ * gcc-changelog/test_patches.txt: Likewise. ++ ++2022-01-19 Martin Liska ++ ++ * git-backport.py: Sync from master. ++ * git-commit-mklog.py: Likewise. ++ * git-fix-changelog.py: New file. ++ ++2022-01-17 Martin Liska ++ ++ Backported from master: ++ 2022-01-17 Martin Liska ++ ++ * git-backport.py: Support renaming of .cc files. ++ +2021-11-08 Martin Liska + + * gcc-changelog/git_check_commit.py: Sync from master. @@ -489,7 +514,26 @@ for file in sorted(changed_files - mentioned_files): if not self.in_ignored_location(file): if file in self.new_files: -@@ -721,3 +809,12 @@ class GitCommit: +@@ -630,9 +718,15 @@ class GitCommit: + self.changelog_entries.append(entry) + # strip prefix of the file + assert file.startswith(entry.folder) +- file = file[len(entry.folder):].lstrip('/') +- entry.lines.append('\t* %s: New file.' % file) +- entry.files.append(file) ++ # do not allow auto-addition of New files ++ # for the top-level folder ++ if entry.folder: ++ file = file[len(entry.folder):].lstrip('/') ++ entry.lines.append('\t* %s: New file.' % file) ++ entry.files.append(file) ++ else: ++ msg = 'new file in the top-level folder not mentioned in a ChangeLog' ++ self.errors.append(Error(msg, file)) + else: + used_pattern = [p for p in mentioned_patterns + if file.startswith(p)] +@@ -721,3 +815,12 @@ class GitCommit: print('Errors:') for error in self.errors: print(error) @@ -740,7 +784,7 @@ assert not email.errors def test_wrong_changelog_entry(self): -@@ -404,3 +403,46 @@ class TestGccChangelog(unittest.TestCase): +@@ -404,3 +403,51 @@ class TestGccChangelog(unittest.TestCase): email = self.from_patch_glob('0001-Add-horse2.patch') assert not email.errors assert email.changelog_entries[0].files == ['koníček.txt'] @@ -787,6 +831,11 @@ + email = self.from_patch_glob('non-ascii-email.patch') + assert (email.errors[0].message == + 'non-ASCII characters in git commit email address (jbglaw@ług-owl.de)') ++ ++ def test_new_file_in_root_folder(self): ++ email = self.from_patch_glob('toplev-new-file.patch') ++ assert (email.errors[0].message == ++ 'new file in the top-level folder not mentioned in a ChangeLog') --- a/src/contrib/gcc-changelog/test_patches.txt +++ b/src/contrib/gcc-changelog/test_patches.txt @@ -68,13 +68,6 @@ xxxx-xx-xx Claudiu Zissulescu @@ -1458,7 +1507,7 @@ + diff --git a/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c b/gcc/testsuite/gcc.target/aarch64/advsimd-intrinsics/vdot-3-1.c new file mode 100755 -@@ -3398,4 +3238,254 @@ index 00000000000..56c67f58752 +@@ -3398,4 +3238,336 @@ index 00000000000..56c67f58752 -- 2.29.2 @@ -1479,7 +1528,7 @@ +From: Martin Liska +Date: Wed, 13 Jan 2021 16:26:45 +0100 +Subject: [PATCH 1/2] Add macro. - ++ +gcc/ChangeLog: + + * config/i386/i386.md (*fix_trunc_i387_1, *add3_eq, @@ -1713,10 +1762,195 @@ +@@ -0,0 +1,1 @@ ++ +-- ++ ++=== toplev-new-file.patch === ++From 05e37b6e65027188f08e6374c7d356d75b54738e Mon Sep 17 00:00:00 2001 ++From: Martin Liska ++Date: Mon, 24 Jan 2022 12:46:27 +0100 ++Subject: [PATCH] New file. ++ ++ChangeLog: ++ ++ * Makefile.in: Update. ++ ++gcc/ChangeLog: + ++ * ipa-icf.cc: Update. ++--- ++ Makefile.am | 1 + ++ Makefile.in | 1 + ++ gcc/ipa-icf.cc | 1 + ++ gcc/ipa-icf2.cc | 1 + ++ 4 files changed, 4 insertions(+) ++ create mode 100644 Makefile.am ++ create mode 100644 gcc/ipa-icf2.cc ++ ++diff --git a/Makefile.am b/Makefile.am ++new file mode 100644 ++index 00000000000..f0129caae3d ++--- /dev/null +++++ b/Makefile.am ++@@ -0,0 +1 @@ +++new file. ++diff --git a/Makefile.in b/Makefile.in ++index 79c77fccf0f..7a090030119 100644 ++--- a/Makefile.in +++++ b/Makefile.in ++@@ -1,4 +1,5 @@ ++ +++ ++ # Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'. ++ # ++ # Makefile for directory with subdirs to build. ++diff --git a/gcc/ipa-icf.cc b/gcc/ipa-icf.cc ++index 765ae746745..15735b6684f 100644 ++--- a/gcc/ipa-icf.cc +++++ b/gcc/ipa-icf.cc ++@@ -1,3 +1,4 @@ +++ ++ /* Interprocedural Identical Code Folding pass ++ Copyright (C) 2014-2022 Free Software Foundation, Inc. ++ ++diff --git a/gcc/ipa-icf2.cc b/gcc/ipa-icf2.cc ++new file mode 100644 ++index 00000000000..c49c556e0e4 ++--- /dev/null +++++ b/gcc/ipa-icf2.cc ++@@ -0,0 +1 @@ +++tt ++-- ++2.34.1 ++ ++From 80c9d63af350b280bfccb82adb3867c25a25e6d0 Mon Sep 17 00:00:00 2001 ++From: Martin Liska ++Date: Mon, 24 Jan 2022 12:17:09 +0100 ++Subject: [PATCH] Add Makefile.am file. ++ ++Foo bar. ++ ++ChangeLog: ++ ++--- ++ Makefile.am | 0 ++ 1 file changed, 0 insertions(+), 0 deletions(-) ++ create mode 100644 Makefile.am ++ ++diff --git a/Makefile.am b/Makefile.am ++new file mode 100644 ++index 00000000000..d6459e00543 ++--- /dev/null +++++ b/Makefile.am ++@@ -0,0 +1 @@ +++xxx ++-- ++2.34.1 +--- a/src/contrib/gcc-git-customization.sh ++++ b/src/contrib/gcc-git-customization.sh +@@ -22,14 +22,24 @@ git config alias.svn-rev '!f() { rev=$1; shift; git log --all --grep="^From-SVN: + + # Add git commands to convert git commit to monotonically increasing revision number + # and vice versa +-git config alias.gcc-descr \!"f() { if test \${1:-no} = --full; then c=\${2:-master}; r=\$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' \$c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-,r,p'); expr match \${r:-no} '^r[0-9]\\+\$' >/dev/null && r=\${r}-0-g\$(git rev-parse \${2:-master}); else c=\${1:-master}; r=\$(git describe --all --match 'basepoints/gcc-[0-9]*' \$c | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)-\\([0-9]\\+\\)-g[0-9a-f]*\$,r\\2-\\3,p;s,^\\(tags/\\)\\?basepoints/gcc-\\([0-9]\\+\\)\$,r\\2-0,p'); fi; if test -n \$r; then o=\$(git config --get gcc-config.upstream); rr=\$(echo \$r | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\\(-g[0-9a-f]\\+\\)\\?\$,\\1,p'); if git rev-parse --verify --quiet \${o:-origin}/releases/gcc-\$rr >/dev/null; then m=releases/gcc-\$rr; else m=master; fi; git merge-base --is-ancestor \$c \${o:-origin}/\$m && \echo \${r}; fi; }; f" +-git config alias.gcc-undescr \!"f() { o=\$(git config --get gcc-config.upstream); r=\$(echo \$1 | sed -n 's,^r\\([0-9]\\+\\)-[0-9]\\+\$,\\1,p'); n=\$(echo \$1 | sed -n 's,^r[0-9]\\+-\\([0-9]\\+\\)\$,\\1,p'); test -z \$r && echo Invalid id \$1 && exit 1; h=\$(git rev-parse --verify --quiet \${o:-origin}/releases/gcc-\$r); test -z \$h && h=\$(git rev-parse --verify --quiet \${o:-origin}/master); p=\$(git describe --all --match 'basepoints/gcc-'\$r \$h | sed -n 's,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+-\\([0-9]\\+\\)-g[0-9a-f]*\$,\\2,p;s,^\\(tags/\\)\\?basepoints/gcc-[0-9]\\+\$,0,p'); git rev-parse --verify \$h~\$(expr \$p - \$n); }; f" ++git config alias.gcc-descr '!f() { "`git rev-parse --show-toplevel`/contrib/git-descr.sh" $@; } ; f' ++git config alias.gcc-undescr '!f() { "`git rev-parse --show-toplevel`/contrib/git-undescr.sh" $@; } ; f' ++ ++git config alias.gcc-verify '!f() { "`git rev-parse --show-toplevel`/contrib/gcc-changelog/git_check_commit.py" $@; } ; f' ++git config alias.gcc-backport '!f() { "`git rev-parse --show-toplevel`/contrib/git-backport.py" $@; } ; f' ++git config alias.gcc-fix-changelog '!f() { "`git rev-parse --show-toplevel`/contrib/git-fix-changelog.py" $@; } ; f' ++git config alias.gcc-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/mklog.py" $@; } ; f' ++git config alias.gcc-commit-mklog '!f() { "`git rev-parse --show-toplevel`/contrib/git-commit-mklog.py" "$@"; }; f' + + # Make diff on MD files use "(define" as a function marker. + # Use this in conjunction with a .gitattributes file containing + # *.md diff=md + git config diff.md.xfuncname '^\(define.*$' + ++# Tell git send-email where patches go. ++# ??? Maybe also set sendemail.tocmd to guess from MAINTAINERS? ++git config sendemail.to 'gcc-patches@gcc.gnu.org' ++ + set_user=$(git config --get "user.name") + set_email=$(git config --get "user.email") + +@@ -122,6 +132,17 @@ echo "(local branches starting / can be pushed directly to your" + ask "personal area on the gcc server)" $old_pfx new_pfx + git config "gcc-config.userpfx" "$new_pfx" + ++echo ++ask "Install prepare-commit-msg git hook for 'git commit-mklog' alias" yes dohook ++if [ "x$dohook" = xyes ]; then ++ hookdir=`git rev-parse --git-path hooks` ++ if [ -f "$hookdir/prepare-commit-msg" ]; then ++ echo " Moving existing prepare-commit-msg hook to prepare-commit-msg.bak" ++ mv "$hookdir/prepare-commit-msg" "$hookdir/prepare-commit-msg.bak" ++ fi ++ install -c "`git rev-parse --show-toplevel`/contrib/prepare-commit-msg" "$hookdir" ++fi ++ + # Scan the existing settings to see if there are any we need to rewrite. + vendors=$(git config --get-all "remote.${upstream}.fetch" "refs/vendors/" | sed -r "s:.*refs/vendors/([^/]+)/.*:\1:" | sort | uniq) + url=$(git config --get "remote.${upstream}.url") +--- a/src/contrib/git-backport.py ++++ b/src/contrib/git-backport.py +@@ -20,46 +20,16 @@ + # Boston, MA 02110-1301, USA. + + import argparse ++import os + import subprocess + ++script_folder = os.path.dirname(os.path.abspath(__file__)) ++fixup_script = os.path.join(script_folder, 'git-fix-changelog.py') ++ + if __name__ == '__main__': +- parser = argparse.ArgumentParser(description='Backport a git revision and ' +- 'stash all ChangeLog files.') ++ parser = argparse.ArgumentParser(description='Backport a git revision.') + parser.add_argument('revision', help='Revision') + args = parser.parse_args() + +- r = subprocess.run('git cherry-pick -x %s' % args.revision, shell=True) +- if r.returncode == 0: +- cmd = 'git show --name-only --pretty="" -- "*ChangeLog"' +- changelogs = subprocess.check_output(cmd, shell=True, encoding='utf8') +- changelogs = changelogs.strip() +- if changelogs: +- for changelog in changelogs.split('\n'): +- subprocess.check_output('git checkout HEAD~ %s' % changelog, +- shell=True) +- subprocess.check_output('git commit --amend --no-edit', shell=True) +- else: +- # 1) remove all ChangeLog files from conflicts +- out = subprocess.check_output('git diff --name-only --diff-filter=U', +- shell=True, +- encoding='utf8') +- conflicts = out.strip().split('\n') +- changelogs = [c for c in conflicts if c.endswith('ChangeLog')] +- if changelogs: +- cmd = 'git checkout --theirs %s' % ' '.join(changelogs) +- subprocess.check_output(cmd, shell=True) +- # 2) remove all ChangeLog files from index +- cmd = 'git diff --name-only --diff-filter=M HEAD' +- out = subprocess.check_output(cmd, shell=True, encoding='utf8') +- out = out.strip().split('\n') +- modified = [c for c in out if c.endswith('ChangeLog')] +- for m in modified: +- subprocess.check_output('git reset %s' % m, shell=True) +- subprocess.check_output('git checkout %s' % m, shell=True) +- +- # try to continue +- if len(conflicts) == len(changelogs): +- cmd = 'git -c core.editor=true cherry-pick --continue' +- subprocess.check_output(cmd, shell=True) +- else: +- print('Please resolve all remaining file conflicts.') ++ subprocess.run('git cherry-pick -x %s' % args.revision, shell=True) ++ subprocess.run(fixup_script, shell=True) new file mode 100755 --- /dev/null +++ b/src/contrib/git-commit-mklog.py -@@ -0,0 +1,53 @@ +@@ -0,0 +1,59 @@ +#!/usr/bin/env python3 + +# Copyright (C) 2020 Free Software Foundation, Inc. @@ -1756,6 +1990,8 @@ + help='Add the specified PRs (comma separated)') + parser.add_argument('-p', '--fill-up-bug-titles', action='store_true', + help='Download title of mentioned PRs') ++ parser.add_argument('--co', ++ help='Add Co-Authored-By trailer (comma separated)') + args, unknown_args = parser.parse_known_args() + + myenv['GCC_FORCE_MKLOG'] = '1' @@ -1768,10 +2004,168 @@ + if mklog_args: + myenv['GCC_MKLOG_ARGS'] = ' '.join(mklog_args) + ++ if args.co: ++ for author in args.co.split(','): ++ unknown_args.append(f'--trailer "Co-Authored-By: {author}"') ++ + commit_args = ' '.join(unknown_args) + subprocess.run(f'git commit {commit_args}', shell=True, env=myenv) new file mode 100755 --- /dev/null ++++ b/src/contrib/git-descr.sh +@@ -0,0 +1,37 @@ ++#!/bin/sh ++ ++# Script to describe a GCC revision based on git hash ++ ++short=no ++long=no ++c=master ++ ++for arg in "$@" ++do ++ case "$arg" in ++ --short) short=yes long=no ++ ;; ++ --long|--full) long=yes short=no ++ ;; ++ *) c=$arg ++ esac ++done ++ ++if test x$short = xyes; then ++ r=$(git describe --all --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)-\([0-9]\+\)-g[0-9a-f]*$,r\2-\3,p;s,^\(tags/\)\?basepoints/gcc-\([0-9]\+\)$,r\2-0,p'); ++elif test x$long = xyes; then ++ r=$(git describe --all --abbrev=40 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\(tags/\)\?basepoints/gcc-,r,p') ++else ++ r=$(git describe --all --abbrev=14 --match 'basepoints/gcc-[0-9]*' $c | sed -n 's,^\(tags/\)\?basepoints/gcc-,r,p'); ++ expr match ${r:-no} 'r[0-9]\+$' >/dev/null && r=${r}-0-g$(git rev-parse $c); ++fi; ++if test -n $r; then ++ o=$(git config --get gcc-config.upstream); ++ rr=$(echo $r | sed -n 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'); ++ if git rev-parse --verify --quiet ${o:-origin}/releases/gcc-$rr >/dev/null; then ++ m=releases/gcc-$rr; ++ else ++ m=master; ++ fi; ++ git merge-base --is-ancestor $c ${o:-origin}/$m && echo ${r}; ++fi; +new file mode 100755 +--- /dev/null ++++ b/src/contrib/git-fix-changelog.py +@@ -0,0 +1,92 @@ ++#!/usr/bin/env python3 ++ ++# Copyright (C) 2020 Free Software Foundation, Inc. ++# ++# This file is part of GCC. ++# ++# GCC is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3, or (at your option) ++# any later version. ++# ++# GCC is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++# ++# You should have received a copy of the GNU General Public License ++# along with GCC; see the file COPYING. If not, write to ++# the Free Software Foundation, 51 Franklin Street, Fifth Floor, ++# Boston, MA 02110-1301, USA. ++# ++# The script tries to fix commit message where ChangeLog entries ++# can point to .cc renamed files. ++ ++import argparse ++import os ++import subprocess ++import tempfile ++ ++DESCRIPTION = 'Fix up ChangeLog of the current commit.' ++ ++script_folder = os.path.dirname(os.path.abspath(__file__)) ++verify_script = os.path.join(script_folder, ++ 'gcc-changelog/git_check_commit.py') ++ ++ ++def replace_file_in_changelog(lines, filename, fixed): ++ # consider all componenets of a path: gcc/ipa-icf.cc ++ while filename: ++ for i, line in enumerate(lines): ++ if filename in line: ++ lines[i] = line.replace(filename, fixed) ++ return ++ ++ parts = filename.split('/') ++ if len(parts) == 1: ++ return ++ filename = '/'.join(parts[1:]) ++ fixed = '/'.join(fixed.split('/')[1:]) ++ ++ ++if __name__ == '__main__': ++ parser = argparse.ArgumentParser(description=DESCRIPTION) ++ args = parser.parse_args() ++ ++ # Update commit message if change for a .cc file was taken ++ r = subprocess.run(f'{verify_script} HEAD', shell=True, encoding='utf8', ++ stdout=subprocess.PIPE, stderr=subprocess.PIPE) ++ if r.returncode != 0: ++ lines = r.stdout.splitlines() ++ cmd = 'git show -s --format=%B' ++ commit_message = subprocess.check_output(cmd, shell=True, ++ encoding='utf8').strip() ++ commit_message = commit_message.splitlines() ++ ++ # Parse the following lines: ++ # ERR: unchanged file mentioned in a ChangeLog \ ++ # (did you mean "gcc/ipa-icf.cc"?): "gcc/ipa-icf.c" ++ replaced = 0 ++ for line in lines: ++ if ('unchanged file mentioned' in line and ++ 'did you mean' in line): ++ filename = line.split()[-1].strip('"') ++ fixed = line[line.index('did you mean'):] ++ fixed = fixed[fixed.index('"') + 1:] ++ fixed = fixed[:fixed.index('"')] ++ ++ if filename.count('/') == fixed.count('/'): ++ replace_file_in_changelog(commit_message, filename, fixed) ++ replaced += 1 ++ ++ if replaced: ++ with tempfile.NamedTemporaryFile('w', encoding='utf8', ++ delete=False) as w: ++ w.write('\n'.join(commit_message)) ++ w.close() ++ subprocess.check_output(f'git commit --amend -F {w.name}', ++ shell=True, encoding='utf8') ++ os.unlink(w.name) ++ print(f'Commit message updated: {replaced} file(s) renamed.') ++ else: ++ print('Commit message has not been updated.') +new file mode 100755 +--- /dev/null ++++ b/src/contrib/git-undescr.sh +@@ -0,0 +1,13 @@ ++#!/bin/sh ++ ++# Script to undescribe a GCC revision ++ ++o=$(git config --get gcc-config.upstream); ++r=$(echo $1 | sed -n 's,^r\([0-9]\+\)-[0-9]\+\(-g[0-9a-f]\+\)\?$,\1,p'); ++n=$(echo $1 | sed -n 's,^r[0-9]\+-\([0-9]\+\)\(-g[0-9a-f]\+\)\?$,\1,p'); ++ ++test -z $r && echo Invalid id $1 && exit 1; ++h=$(git rev-parse --verify --quiet ${o:-origin}/releases/gcc-$r); ++test -z $h && h=$(git rev-parse --verify --quiet ${o:-origin}/master); ++p=$(git describe --all --match 'basepoints/gcc-'$r $h | sed -n 's,^\(tags/\)\?basepoints/gcc-[0-9]\+-\([0-9]\+\)-g[0-9a-f]*$,\2,p;s,^\(tags/\)\?basepoints/gcc-[0-9]\+$,0,p'); ++git rev-parse --verify $h~$(expr $p - $n); +new file mode 100755 +--- /dev/null +++ b/src/contrib/mklog.py @@ -0,0 +1,356 @@ +#!/usr/bin/env python3 @@ -2639,7 +3033,243 @@ + assert changelog == EXPECTED9 --- a/src/gcc/ChangeLog +++ b/src/gcc/ChangeLog -@@ -1,3 +1,1442 @@ +@@ -1,3 +1,1678 @@ ++2022-03-18 Peter Bergner ++ ++ Backported from master: ++ 2022-03-04 Peter Bergner ++ ++ PR target/87496 ++ PR target/104208 ++ * config/rs6000/rs6000.c (rs6000_option_override_internal): Make the ++ ISA 2.06 requirement for -mabi=ieeelongdouble conditional on ++ -mlong-double-128. ++ Move the -mabi=ieeelongdouble and -mabi=ibmlongdouble error checking ++ from here... ++ * common/config/rs6000/rs6000-common.c (rs6000_handle_option): ++ ... to here. ++ ++2022-03-16 Richard Biener ++ ++ Backported from master: ++ 2022-02-09 Richard Biener ++ ++ PR target/104453 ++ * config/i386/i386.c (ix86_gimple_fold_builtin): Guard shift ++ folding for NULL LHS. ++ ++2022-03-16 Richard Biener ++ ++ Backported from master: ++ 2022-02-14 Richard Biener ++ ++ PR tree-optimization/104511 ++ * tree-ssa-forwprop.c (simplify_vector_constructor): Avoid ++ touching DFP <-> FP conversions. ++ ++2022-03-16 Richard Biener ++ ++ Backported from master: ++ 2022-01-20 Richard Biener ++ ++ PR target/100784 ++ * config/i386/i386.c (ix86_gimple_fold_builtin): Check for ++ LHS before folding __builtin_ia32_shufpd and friends. ++ ++2022-03-12 Michael Meissner ++ ++ PR target/99708 ++ * config/rs6000/rs6000-c.c: Revert 2022-03-05 patch. ++ ++2022-03-06 Michael Meissner ++ ++ PR target/104253 ++ * config/rs6000/rs6000.c (init_float128_ibm): Update the ++ conversion functions used to convert IFmode types. Backport ++ change made to the master branch on 2022-02-14. ++ ++2022-03-06 Michael Meissner ++ ++ PR target/99708 ++ * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Define ++ __SIZEOF_IBM128__ if the IBM 128-bit long double type is created. ++ Define __SIZEOF_FLOAT128__ if the IEEE 128-bit floating point type ++ is created. Backport change to master branch on 2022-02-17. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-15 Richard Biener ++ ++ PR tree-optimization/103237 ++ * tree-vect-loop.c (vect_is_simple_reduction): Fail for ++ double reductions with multiple inner loop LC PHI nodes. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-22 Richard Biener ++ ++ PR middle-end/103181 ++ PR middle-end/103248 ++ * tree-eh.c (operation_could_trap_helper_p): Properly ++ check vector constants for a zero element for integer ++ division. Separate floating point and integer division code. ++ Properly handle fixed-point RDIV_EXPR. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-08 Richard Biener ++ ++ PR tree-optimization/102798 ++ * tree-vect-data-refs.c (vect_create_addr_base_for_vector_ref): ++ Only copy points-to info to newly generated SSA names. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-10-15 Richard Biener ++ ++ PR ipa/102762 ++ * tree-inline.c (copy_bb): Avoid underflowing nargs. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-06-08 Richard Biener ++ ++ PR tree-optimization/100923 ++ * tree-ssa-sccvn.c (valueize_refs_1): Take a pointer to ++ the operand vector to be valueized. ++ (valueize_refs): Likewise. ++ (valueize_shared_reference_ops_from_ref): Adjust. ++ (valueize_shared_reference_ops_from_call): Likewise. ++ (vn_reference_lookup_3): Likewise. ++ (vn_reference_lookup_pieces): Likewise. Re-valueize ++ with honoring availability when we are about to create ++ the ao_ref and valueized before. ++ (vn_reference_lookup): Likewise. ++ (vn_reference_insert_pieces): Adjust. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-06-22 Richard Biener ++ ++ PR tree-optimization/101158 ++ * tree-vect-slp.c (vect_build_slp_tree_1): Move same operand ++ checking after checking for matching operation. ++ ++2022-02-15 Kewen Lin ++ ++ Backported from master: ++ 2022-02-07 Kewen Lin ++ ++ PR target/103627 ++ * config/rs6000/rs6000.c (rs6000_option_override_internal): Move the ++ hunk affecting VSX and ALTIVEC to appropriate place. ++ ++2022-02-15 Kewen Lin ++ ++ Backported from master: ++ 2022-02-07 Kewen Lin ++ ++ PR target/103627 ++ * config/rs6000/rs6000.c (rs6000_option_override_internal): Disable ++ MMA if !TARGET_VSX. ++ ++2022-02-14 Maciej W. Rozycki ++ ++ Backported from master: ++ 2022-02-08 Maciej W. Rozycki ++ ++ * config/riscv/t-riscv (riscv-sr.o): Add $(TM_H) dependency. ++ ++2022-02-13 Alan Modra ++ ++ Backported from master: ++ 2020-10-01 Alan Modra ++ ++ * config/rs6000/ppc-asm.h: Support __PCREL__ code. ++ ++2022-02-10 Uros Bizjak ++ ++ Backported from master: ++ 2022-02-10 Uroš Bizjak ++ ++ PR target/104469 ++ * config/i386/sse.md (vec_unpacks_float_lo_v4si): ++ Change operand 1 constraint to register_operand. ++ ++2022-02-09 Uroš Bizjak ++ ++ PR target/104458 ++ * config/i386/i386-expand.c (ix86_split_idivmod): ++ Force operands[2] and operands[3] into a register.. ++ ++2022-02-09 liuhongt ++ ++ PR target/104451 ++ * config/i386/sse.md (3): lowpart_subreg ++ operands[2] from SImode to QImode. ++ ++2022-02-03 Sebastian Huber ++ ++ PR target/104090 ++ * config/rs6000/rs6000.c (rs6000_machine_from_flags): Use also ++ rs6000_cpu. ++ ++2022-02-02 Xi Ruoyao ++ ++ Backported from master: ++ 2022-02-01 Xi Ruoyao ++ ++ PR middle-end/95115 ++ * fold-const.c (const_binop): Do not fold NaN result from ++ non-NaN operands. ++ ++2022-01-15 Peter Bergner ++ ++ Backported from master: ++ 2021-11-16 Peter Bergner ++ ++ PR target/102976 ++ * config/rs6000/mma.md (*vsx_assemble_pair): Add early-clobber for ++ output operand. ++ (*mma_assemble_acc): Likewise. ++ ++2022-01-15 Peter Bergner ++ ++ * config/rs6000/mma.md (UNSPEC_VSX_ASSEMBLE): New unspec. ++ (vsx_assemble_pair): Use mma_assemble_input_operand. ++ Expand into UNSPEC_VSX_ASSEMBLE wrapper. ++ (*vsx_assemble_pair): New define_insn_and_split. ++ * config/rs6000/rs6000.c (rs6000_split_multireg_move): Handle ++ UNSPEC_VSX_ASSEMBLE. ++ ++2022-01-15 Peter Bergner ++ ++ Backported from master: ++ 2021-09-14 Peter Bergner ++ ++ * config/rs6000/mma.md (unspecv): Add UNSPECV_MMA_XXSETACCZ. ++ (*movpxi): Remove 'O' alternative. ++ (mma_xxsetaccz): Change to define_insn. Use UNSPECV_MMA_XXSETACCZ. ++ Add comment. ++ * config/rs6000/rs6000.c (rs6000_rtx_costs): Handle UNSPEC_VOLATILE. ++ ++2022-01-14 Eric Botcazou ++ ++ * ipa-param-manipulation.c (ipa_dump_adjusted_parameters): Dump ++ reverse flag as "reverse" for the sake of consistency. ++ * ipa-sra.c: Fix copyright year. ++ (ipa_sra_function_summaries::duplicate): Copy the reverse flag. ++ (dump_isra_access): Tweak dump line. ++ (isra_write_node_summary): Write the reverse flag. ++ (isra_read_node_info): Read it. ++ (pull_accesses_from_callee): Test its consistency and copy it. ++ +2022-01-12 Richard Biener + + Backported from master: @@ -4086,10 +4716,32 @@ +++ b/src/gcc/DATESTAMP @@ -1 +1 @@ -20210408 -+20220113 ++20220324 --- a/src/gcc/ada/ChangeLog +++ b/src/gcc/ada/ChangeLog -@@ -1,3 +1,64 @@ +@@ -1,3 +1,86 @@ ++2022-01-19 H.J. Lu ++ ++ Backported from master: ++ 2022-01-19 H.J. Lu ++ ++ PR ada/103538 ++ * gcc-interface/Makefile.in (target_cpu): Set to x32 for ++ x86_64-linux-gnux32. ++ ++2022-01-19 H.J. Lu ++ ++ Backported from master: ++ 2022-01-19 H.J. Lu ++ ++ PR ada/103538 ++ * Makefile.rtl (LIBGNAT_TARGET_PAIRS): Add ++ $(TRASYM_DWARF_UNIX_PAIRS), ++ s-tsmona.adb + + * gcc-interface/decl.c (validate_size): Do not issue an error if the @@ -4154,6 +4806,27 @@ 2021-04-08 Release Manager * GCC 10.3.0 released. +--- a/src/gcc/ada/Makefile.rtl ++++ b/src/gcc/ada/Makefile.rtl +@@ -2441,13 +2441,18 @@ ifeq ($(strip $(filter-out %x32 linux%,$(target_cpu) $(target_os))),) + s-tasinf.adbx_rs6000_long_double_type_size == 64) ++ { ++ error_at (loc, "option %<%s%> requires %<-mlong-double-128%>", ++ decoded->orig_option_with_args_text); ++ return true; ++ } ++ break; ++ + case OPT_mrecip: + opts->x_rs6000_recip_name = (value) ? "default" : "none"; + break; --- a/src/gcc/config/aarch64/aarch64-bti-insert.c +++ b/src/gcc/config/aarch64/aarch64-bti-insert.c @@ -120,6 +120,17 @@ aarch64_pac_insn_p (rtx x) @@ -7583,6 +8311,18 @@ } gcc_unreachable (); } +--- a/src/gcc/config/i386/i386-expand.c ++++ b/src/gcc/config/i386/i386-expand.c +@@ -1140,6 +1140,9 @@ ix86_split_idivmod (machine_mode mode, rtx operands[], + rtx scratch, tmp0, tmp1, tmp2; + rtx (*gen_divmod4_1) (rtx, rtx, rtx, rtx); + ++ operands[2] = force_reg (mode, operands[2]); ++ operands[3] = force_reg (mode, operands[3]); ++ + switch (mode) + { + case E_SImode: --- a/src/gcc/config/i386/i386.c +++ b/src/gcc/config/i386/i386.c @@ -6356,12 +6356,29 @@ ix86_compute_frame_layout (void) @@ -7676,7 +8416,25 @@ if (NOTE_P (i) && NOTE_KIND (i) == NOTE_INSN_EPILOGUE_BEG && !flag_non_call_exceptions && !can_throw_internal (insn)) -@@ -21333,10 +21350,12 @@ ix86_stack_protect_fail (void) +@@ -17831,6 +17848,8 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi) + + do_shift: + gcc_assert (n_args >= 2); ++ if (!gimple_call_lhs (stmt)) ++ break; + arg0 = gimple_call_arg (stmt, 0); + arg1 = gimple_call_arg (stmt, 1); + if (n_args > 2) +@@ -17894,7 +17913,7 @@ ix86_gimple_fold_builtin (gimple_stmt_iterator *gsi) + + case IX86_BUILTIN_SHUFPD: + arg2 = gimple_call_arg (stmt, 2); +- if (TREE_CODE (arg2) == INTEGER_CST) ++ if (TREE_CODE (arg2) == INTEGER_CST && gimple_call_lhs (stmt)) + { + location_t loc = gimple_location (stmt); + unsigned HOST_WIDE_INT imask = TREE_INT_CST_LOW (arg2); +@@ -21333,10 +21352,12 @@ ix86_stack_protect_fail (void) After all, the relocation needed is the same as for the call insn. Whether or not a particular assembler allows us to enter such, I guess we'll have to see. */ @@ -7690,7 +8448,7 @@ { int type = DW_EH_PE_sdata8; if (!TARGET_64BIT -@@ -21345,9 +21364,11 @@ asm_preferred_eh_data_format (int code, int global) +@@ -21345,9 +21366,11 @@ asm_preferred_eh_data_format (int code, int global) type = DW_EH_PE_sdata4; return (global ? DW_EH_PE_indirect : 0) | DW_EH_PE_pcrel | type; } @@ -7769,6 +8527,15 @@ (clobber (reg:CC FLAGS_REG))])] --- a/src/gcc/config/i386/sse.md +++ b/src/gcc/config/i386/sse.md +@@ -6752,7 +6752,7 @@ (define_expand "vec_unpacks_float_lo_v4si" + (define_expand "vec_unpacks_float_hi_v8si" + [(set (match_dup 2) + (vec_select:V4SI +- (match_operand:V8SI 1 "vector_operand") ++ (match_operand:V8SI 1 "register_operand") + (parallel [(const_int 4) (const_int 5) + (const_int 6) (const_int 7)]))) + (set (match_operand:V4DF 0 "register_operand") @@ -16927,7 +16927,7 @@ (define_insn "ssse3_abs2" (set (attr "prefix_rex") (symbol_ref "x86_extended_reg_mentioned_p (insn)")) (set_attr "mode" "DI,TI")]) @@ -7778,7 +8545,18 @@ [(set (match_operand:MMXMODEI 0 "register_operand") (abs:MMXMODEI (match_operand:MMXMODEI 1 "register_operand")))] -@@ -21728,8 +21728,9 @@ (define_expand "_scattersi" +@@ -19418,8 +19418,9 @@ (define_expand "3" + negate = true; + } + par = gen_rtx_PARALLEL (V16QImode, rtvec_alloc (16)); ++ tmp = lowpart_subreg (QImode, operands[2], SImode); + for (i = 0; i < 16; i++) +- XVECEXP (par, 0, i) = operands[2]; ++ XVECEXP (par, 0, i) = tmp; + + tmp = gen_reg_rtx (V16QImode); + emit_insn (gen_vec_initv16qiqi (tmp, par)); +@@ -21728,8 +21729,9 @@ (define_expand "_scattersi" "TARGET_AVX512F" { operands[5] @@ -7790,7 +8568,7 @@ }) (define_insn "*avx512f_scattersi" -@@ -21737,10 +21738,11 @@ (define_insn "*avx512f_scattersi" +@@ -21737,10 +21739,11 @@ (define_insn "*avx512f_scattersi" [(unspec:P [(match_operand:P 0 "vsib_address_operand" "Tv") (match_operand: 2 "register_operand" "v") @@ -7804,7 +8582,7 @@ (match_operand:VI48F 3 "register_operand" "v")] UNSPEC_SCATTER)) (clobber (match_scratch: 1 "=&Yk"))] -@@ -21766,8 +21768,9 @@ (define_expand "_scatterdi" +@@ -21766,8 +21769,9 @@ (define_expand "_scatterdi" "TARGET_AVX512F" { operands[5] @@ -7816,7 +8594,7 @@ }) (define_insn "*avx512f_scatterdi" -@@ -21775,10 +21778,11 @@ (define_insn "*avx512f_scatterdi" +@@ -21775,10 +21779,11 @@ (define_insn "*avx512f_scatterdi" [(unspec:P [(match_operand:P 0 "vsib_address_operand" "Tv") (match_operand: 2 "register_operand" "v") @@ -8373,6 +9151,17 @@ -march= Generate code for given RISC-V ISA (e.g. RV64IM). ISA strings must be lower-case. +--- a/src/gcc/config/riscv/t-riscv ++++ b/src/gcc/config/riscv/t-riscv +@@ -6,7 +6,7 @@ riscv-builtins.o: $(srcdir)/config/riscv/riscv-builtins.c $(CONFIG_H) \ + $(srcdir)/config/riscv/riscv-builtins.c + + riscv-sr.o: $(srcdir)/config/riscv/riscv-sr.c $(CONFIG_H) \ +- $(SYSTEM_H) ++ $(SYSTEM_H) $(TM_H) + $(COMPILER) -c $(ALL_COMPILERFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) \ + $(srcdir)/config/riscv/riscv-sr.c + --- a/src/gcc/config/rs6000/aix.h +++ b/src/gcc/config/rs6000/aix.h @@ -280,3 +280,8 @@ @@ -8407,6 +9196,165 @@ #define vec_double __builtin_vec_double #define vec_doublee __builtin_vec_doublee #define vec_doubleo __builtin_vec_doubleo +--- a/src/gcc/config/rs6000/mma.md ++++ b/src/gcc/config/rs6000/mma.md +@@ -36,7 +36,8 @@ (define_constants [(MAX_MMA_OPERANDS 7)]) + ;; Constants for creating unspecs + + (define_c_enum "unspec" +- [UNSPEC_MMA_ASSEMBLE_ACC ++ [UNSPEC_VSX_ASSEMBLE ++ UNSPEC_MMA_ASSEMBLE_ACC + UNSPEC_MMA_PMXVBF16GER2 + UNSPEC_MMA_PMXVBF16GER2NN + UNSPEC_MMA_PMXVBF16GER2NP +@@ -99,6 +100,10 @@ (define_c_enum "unspec" + UNSPEC_MMA_XXMTACC + ]) + ++(define_c_enum "unspecv" ++ [UNSPECV_MMA_XXSETACCZ ++ ]) ++ + ;; MMA instructions with 1 accumulator argument + (define_int_iterator MMA_ACC [UNSPEC_MMA_XXMFACC + UNSPEC_MMA_XXMTACC]) +@@ -325,42 +330,55 @@ (define_expand "movpxi" + }) + + (define_insn_and_split "*movpxi" +- [(set (match_operand:PXI 0 "nonimmediate_operand" "=d,m,d,d") +- (match_operand:PXI 1 "input_operand" "m,d,d,O"))] ++ [(set (match_operand:PXI 0 "nonimmediate_operand" "=d,m,d") ++ (match_operand:PXI 1 "input_operand" "m,d,d"))] + "TARGET_MMA + && (gpc_reg_operand (operands[0], PXImode) + || gpc_reg_operand (operands[1], PXImode))" + "@ + # + # +- # +- xxsetaccz %A0" +- "&& reload_completed +- && !(fpr_reg_operand (operands[0], PXImode) && operands[1] == const0_rtx)" ++ #" ++ "&& reload_completed" + [(const_int 0)] + { + rs6000_split_multireg_move (operands[0], operands[1]); + DONE; + } +- [(set_attr "type" "vecload,vecstore,veclogical,mma") +- (set_attr "length" "8,8,16,*") +- (set_attr "max_prefixed_insns" "2,2,*,*")]) ++ [(set_attr "type" "vecload,vecstore,veclogical") ++ (set_attr "length" "8,8,16") ++ (set_attr "max_prefixed_insns" "2,2,*")]) + + (define_expand "vsx_assemble_pair" + [(match_operand:POI 0 "vsx_register_operand") +- (match_operand:V16QI 1 "input_operand") +- (match_operand:V16QI 2 "input_operand")] ++ (match_operand:V16QI 1 "mma_assemble_input_operand") ++ (match_operand:V16QI 2 "mma_assemble_input_operand")] + "TARGET_MMA" + { +- rtx dst; ++ rtx src = gen_rtx_UNSPEC (POImode, ++ gen_rtvec (2, operands[1], operands[2]), ++ UNSPEC_VSX_ASSEMBLE); ++ emit_move_insn (operands[0], src); ++ DONE; ++}) + +- /* Let the compiler know the code below fully defines our output value. */ +- emit_clobber (operands[0]); ++;; We cannot update the two output registers atomically, so mark the output ++;; as an early clobber so we don't accidentally clobber the input operands. */ + +- dst = simplify_gen_subreg (V16QImode, operands[0], POImode, 0); +- emit_move_insn (dst, operands[1]); +- dst = simplify_gen_subreg (V16QImode, operands[0], POImode, 16); +- emit_move_insn (dst, operands[2]); ++(define_insn_and_split "*vsx_assemble_pair" ++ [(set (match_operand:POI 0 "vsx_register_operand" "=&wa") ++ (unspec:POI [(match_operand:V16QI 1 "mma_assemble_input_operand" "mwa") ++ (match_operand:V16QI 2 "mma_assemble_input_operand" "mwa")] ++ UNSPEC_VSX_ASSEMBLE))] ++ "TARGET_MMA" ++ "#" ++ "&& reload_completed" ++ [(const_int 0)] ++{ ++ rtx src = gen_rtx_UNSPEC (POImode, ++ gen_rtvec (2, operands[1], operands[2]), ++ UNSPEC_VSX_ASSEMBLE); ++ rs6000_split_multireg_move (operands[0], src); + DONE; + }) + +@@ -380,8 +398,11 @@ (define_expand "mma_assemble_acc" + DONE; + }) + ++;; We cannot update the four output registers atomically, so mark the output ++;; as an early clobber so we don't accidentally clobber the input operands. */ ++ + (define_insn_and_split "*mma_assemble_acc" +- [(set (match_operand:PXI 0 "fpr_reg_operand" "=d") ++ [(set (match_operand:PXI 0 "fpr_reg_operand" "=&d") + (unspec:PXI [(match_operand:V16QI 1 "mma_assemble_input_operand" "mwa") + (match_operand:V16QI 2 "mma_assemble_input_operand" "mwa") + (match_operand:V16QI 3 "mma_assemble_input_operand" "mwa") +@@ -413,14 +434,16 @@ (define_insn "mma_" + " %A0" + [(set_attr "type" "mma")]) + +-(define_expand "mma_xxsetaccz" +- [(set (match_operand:PXI 0 "fpr_reg_operand") +- (const_int 0))] ++;; We can't have integer constants in PXImode so we wrap this in an ++;; UNSPEC_VOLATILE. ++ ++(define_insn "mma_xxsetaccz" ++ [(set (match_operand:PXI 0 "fpr_reg_operand" "=d") ++ (unspec_volatile:PXI [(const_int 0)] ++ UNSPECV_MMA_XXSETACCZ))] + "TARGET_MMA" +-{ +- emit_insn (gen_movpxi (operands[0], const0_rtx)); +- DONE; +-}) ++ "xxsetaccz %A0" ++ [(set_attr "type" "mma")]) + + (define_insn "mma_" + [(set (match_operand:PXI 0 "fpr_reg_operand" "=&d") +--- a/src/gcc/config/rs6000/ppc-asm.h ++++ b/src/gcc/config/rs6000/ppc-asm.h +@@ -262,6 +262,14 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + #undef toc + + #define FUNC_NAME(name) GLUE(__USER_LABEL_PREFIX__,name) ++#ifdef __PCREL__ ++#define JUMP_TARGET(name) GLUE(FUNC_NAME(name),@notoc) ++#define FUNC_START(name) \ ++ .type FUNC_NAME(name),@function; \ ++ .globl FUNC_NAME(name); \ ++FUNC_NAME(name): \ ++ .localentry FUNC_NAME(name),1 ++#else + #define JUMP_TARGET(name) FUNC_NAME(name) + #define FUNC_START(name) \ + .type FUNC_NAME(name),@function; \ +@@ -270,6 +278,7 @@ FUNC_NAME(name): \ + 0: addis 2,12,(.TOC.-0b)@ha; \ + addi 2,2,(.TOC.-0b)@l; \ + .localentry FUNC_NAME(name),.-FUNC_NAME(name) ++#endif /* !__PCREL__ */ + + #define HIDDEN_FUNC(name) \ + FUNC_START(name) \ --- a/src/gcc/config/rs6000/predicates.md +++ b/src/gcc/config/rs6000/predicates.md @@ -1129,7 +1129,8 @@ (define_special_predicate "mma_assemble_input_operand" @@ -8770,7 +9718,120 @@ } --- a/src/gcc/config/rs6000/rs6000.c +++ b/src/gcc/config/rs6000/rs6000.c -@@ -5550,7 +5550,7 @@ rs6000_machine_from_flags (void) +@@ -3815,6 +3815,15 @@ rs6000_option_override_internal (bool global_init_p) + else if (TARGET_ALTIVEC) + rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~ignore_masks); + ++ /* Disable VSX and Altivec silently if the user switched cpus to power7 in a ++ target attribute or pragma which automatically enables both options, ++ unless the altivec ABI was set. This is set by default for 64-bit, but ++ not for 32-bit. Don't move this before the above code using ignore_masks, ++ since it can reset the cleared VSX/ALTIVEC flag again. */ ++ if (main_target_opt && !main_target_opt->x_rs6000_altivec_abi) ++ rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC) ++ & ~rs6000_isa_flags_explicit); ++ + if (TARGET_CRYPTO && !TARGET_ALTIVEC) + { + if (rs6000_isa_flags_explicit & OPTION_MASK_CRYPTO) +@@ -4032,13 +4041,6 @@ rs6000_option_override_internal (bool global_init_p) + } + else if (rs6000_long_double_type_size == 128) + rs6000_long_double_type_size = FLOAT_PRECISION_TFmode; +- else if (global_options_set.x_rs6000_ieeequad) +- { +- if (global_options.x_rs6000_ieeequad) +- error ("%qs requires %qs", "-mabi=ieeelongdouble", "-mlong-double-128"); +- else +- error ("%qs requires %qs", "-mabi=ibmlongdouble", "-mlong-double-128"); +- } + + /* Set -mabi=ieeelongdouble on some old targets. In the future, power server + systems will also set long double to be IEEE 128-bit. AIX and Darwin +@@ -4048,13 +4050,13 @@ rs6000_option_override_internal (bool global_init_p) + if (!global_options_set.x_rs6000_ieeequad) + rs6000_ieeequad = TARGET_IEEEQUAD_DEFAULT; + +- else ++ else if (TARGET_LONG_DOUBLE_128) + { + if (global_options.x_rs6000_ieeequad + && (!TARGET_POPCNTD || !TARGET_VSX)) + error ("%qs requires full ISA 2.06 support", "-mabi=ieeelongdouble"); + +- if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT && TARGET_LONG_DOUBLE_128) ++ if (rs6000_ieeequad != TARGET_IEEEQUAD_DEFAULT) + { + static bool warned_change_long_double; + if (!warned_change_long_double) +@@ -4209,18 +4211,6 @@ rs6000_option_override_internal (bool global_init_p) + } + } + +- /* Disable VSX and Altivec silently if the user switched cpus to power7 in a +- target attribute or pragma which automatically enables both options, +- unless the altivec ABI was set. This is set by default for 64-bit, but +- not for 32-bit. */ +- if (main_target_opt != NULL && !main_target_opt->x_rs6000_altivec_abi) +- { +- TARGET_FLOAT128_TYPE = 0; +- rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC +- | OPTION_MASK_FLOAT128_KEYWORD) +- & ~rs6000_isa_flags_explicit); +- } +- + /* Enable Altivec ABI for AIX -maltivec. */ + if (TARGET_XCOFF && (TARGET_ALTIVEC || TARGET_VSX)) + { +@@ -4311,6 +4301,16 @@ rs6000_option_override_internal (bool global_init_p) + rs6000_isa_flags &= ~OPTION_MASK_MMA; + } + ++ /* MMA requires SIMD support as ISA 3.1 claims and our implementation ++ such as "*movoo" uses vector pair access which use VSX registers. ++ So make MMA require VSX support here. */ ++ if (TARGET_MMA && !TARGET_VSX) ++ { ++ if ((rs6000_isa_flags_explicit & OPTION_MASK_MMA) != 0) ++ error ("%qs requires %qs", "-mmma", "-mvsx"); ++ rs6000_isa_flags &= ~OPTION_MASK_MMA; ++ } ++ + if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) + rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags); + +@@ -5547,10 +5547,38 @@ const char *rs6000_machine; + const char * + rs6000_machine_from_flags (void) + { ++ /* For some CPUs, the machine cannot be determined by ISA flags. We have to ++ check them first. */ ++ switch (rs6000_cpu) ++ { ++ case PROCESSOR_PPC8540: ++ case PROCESSOR_PPC8548: ++ return "e500"; ++ ++ case PROCESSOR_PPCE300C2: ++ case PROCESSOR_PPCE300C3: ++ return "e300"; ++ ++ case PROCESSOR_PPCE500MC: ++ return "e500mc"; ++ ++ case PROCESSOR_PPCE500MC64: ++ return "e500mc64"; ++ ++ case PROCESSOR_PPCE5500: ++ return "e5500"; ++ ++ case PROCESSOR_PPCE6500: ++ return "e6500"; ++ ++ default: ++ break; ++ } ++ HOST_WIDE_INT flags = rs6000_isa_flags; /* Disable the flags that should never influence the .machine selection. */ @@ -8779,8 +9840,33 @@ if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0) return "power10"; -@@ -16023,9 +16023,11 @@ rs6000_split_multireg_move (rtx dst, rtx src) - && XINT (src, 1) == UNSPEC_MMA_ASSEMBLE_ACC); +@@ -10178,6 +10206,12 @@ init_float128_ibm (machine_mode mode) + set_conv_libfunc (trunc_optab, DDmode, mode, "__dpd_trunctfdd"); + set_conv_libfunc (sext_optab, TDmode, mode, "__dpd_extendtftd"); + ++ set_conv_libfunc (sfix_optab, DImode, mode, "__fixtfdi"); ++ set_conv_libfunc (ufix_optab, DImode, mode, "__fixunstfdi"); ++ ++ set_conv_libfunc (sfloat_optab, mode, DImode, "__floatditf"); ++ set_conv_libfunc (ufloat_optab, mode, DImode, "__floatunditf"); ++ + if (TARGET_POWERPC64) + { + set_conv_libfunc (sfix_optab, TImode, mode, "__fixtfti"); +@@ -16018,20 +16052,28 @@ rs6000_split_multireg_move (rtx dst, rtx src) + + if (GET_CODE (src) == UNSPEC) + { +- gcc_assert (REG_P (dst) +- && FP_REGNO_P (REGNO (dst)) +- && XINT (src, 1) == UNSPEC_MMA_ASSEMBLE_ACC); ++ gcc_assert (XINT (src, 1) == UNSPEC_VSX_ASSEMBLE ++ || XINT (src, 1) == UNSPEC_MMA_ASSEMBLE_ACC); ++ gcc_assert (REG_P (dst)); ++ if (GET_MODE (src) == PXImode) ++ gcc_assert (FP_REGNO_P (REGNO (dst))); ++ if (GET_MODE (src) == POImode) ++ gcc_assert (VSX_REGNO_P (REGNO (dst))); reg_mode = GET_MODE (XVECEXP (src, 0, 0)); - for (int i = 0; i < XVECLEN (src, 0); i++) @@ -8793,6 +9879,30 @@ emit_insn (gen_rtx_SET (dst_i, XVECEXP (src, 0, i))); } + /* We are writing an accumulator register, so we have to + prime it after we've written it. */ +- emit_insn (gen_mma_xxmtacc (dst, dst)); ++ if (TARGET_MMA ++ && GET_MODE (dst) == PXImode && FP_REGNO_P (REGNO (dst))) ++ emit_insn (gen_mma_xxmtacc (dst, dst)); + + return; + } +@@ -21351,6 +21393,14 @@ rs6000_rtx_costs (rtx x, machine_mode mode, int outer_code, + } + break; + ++ case UNSPEC_VOLATILE: ++ if (XINT (x, 1) == UNSPECV_MMA_XXSETACCZ) ++ { ++ *total = 0; ++ return true; ++ } ++ break; ++ + default: + break; + } --- a/src/gcc/config/rs6000/rs6000.md +++ b/src/gcc/config/rs6000/rs6000.md @@ -4806,6 +4806,42 @@ (define_insn "fre" @@ -9524,7 +10634,16 @@ gcov_write_length (offset); --- a/src/gcc/cp/ChangeLog +++ b/src/gcc/cp/ChangeLog -@@ -1,3 +1,376 @@ +@@ -1,3 +1,385 @@ ++2022-02-17 Jason Merrill ++ ++ Revert: ++ 2021-05-20 Jason Merrill ++ ++ PR c++/92918 ++ * name-lookup.c (push_class_level_binding_1): Do overload a new ++ function with a previous using-declaration. ++ +2021-10-03 Iain Sandoe + + Backported from master: @@ -10835,15 +11954,6 @@ { auto_diagnostic_group d; if (warning_at (DECL_SOURCE_LOCATION (decl), OPT_Wshadow, -@@ -4551,7 +4552,7 @@ push_class_level_binding_1 (tree name, tree x) - old_decl = bval; - else if (TREE_CODE (bval) == USING_DECL - && OVL_P (target_decl)) -- return true; -+ old_decl = bval; - else if (OVL_P (target_decl) - && OVL_P (target_bval)) - old_decl = bval; --- a/src/gcc/cp/parser.c +++ b/src/gcc/cp/parser.c @@ -17631,6 +17631,11 @@ cp_parser_explicit_specialization (cp_parser* parser) @@ -12542,9 +13652,139 @@ { tree ntype = TYPE_UNSIGNED (type) ? signed_type_for (type) +@@ -1309,6 +1309,17 @@ const_binop (enum tree_code code, tree arg1, tree arg2) + inexact = real_arithmetic (&value, code, &d1, &d2); + real_convert (&result, mode, &value); + ++ /* Don't constant fold this floating point operation if ++ both operands are not NaN but the result is NaN, and ++ flag_trapping_math. Such operations should raise an ++ invalid operation exception. */ ++ if (flag_trapping_math ++ && MODE_HAS_NANS (mode) ++ && REAL_VALUE_ISNAN (result) ++ && !REAL_VALUE_ISNAN (d1) ++ && !REAL_VALUE_ISNAN (d2)) ++ return NULL_TREE; ++ + /* Don't constant fold this floating point operation if + the result has overflowed and flag_trapping_math. */ + if (flag_trapping_math --- a/src/gcc/fortran/ChangeLog +++ b/src/gcc/fortran/ChangeLog -@@ -1,3 +1,597 @@ +@@ -1,3 +1,709 @@ ++2022-02-23 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-22 Harald Anlauf ++ ++ PR fortran/104619 ++ * resolve.c (resolve_structure_cons): Skip shape check if shape ++ of constructor cannot be determined at compile time. ++ ++2022-02-04 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-03 Harald Anlauf ++ ++ PR fortran/104311 ++ * check.c (gfc_calculate_transfer_sizes): Checks for case when ++ storage size of SOURCE is greater than zero while the storage size ++ of MOLD is zero and MOLD is an array shall not depend on SIZE. ++ ++2022-02-02 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-01 Harald Anlauf ++ ++ PR fortran/104331 ++ * simplify.c (gfc_simplify_eoshift): Avoid NULL pointer ++ dereference when shape is not set. ++ ++2022-01-29 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-15 Harald Anlauf ++ ++ PR fortran/83079 ++ * target-memory.c (gfc_interpret_character): Result length is ++ in bytes and thus depends on the character kind. ++ * trans-intrinsic.c (gfc_conv_intrinsic_transfer): Compute correct ++ string length for the result of the TRANSFER intrinsic and for ++ temporaries for the different character kinds. ++ ++2022-01-29 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-22 Harald Anlauf ++ ++ PR fortran/104127 ++ * simplify.c (gfc_simplify_transfer): Ensure that the result ++ typespec is set up for TRANSFER with MOLD of type CHARACTER ++ including character length even if the result is a zero-sized ++ array. ++ ++2022-01-26 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-25 Harald Anlauf ++ ++ PR fortran/104227 ++ * check.c (gfc_calculate_transfer_sizes): Fix checking of arrays ++ passed as MOLD argument to the TRANSFER intrinsic for having ++ storage size zero. ++ ++2022-01-25 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-09 Harald Anlauf ++ ++ PR fortran/101762 ++ * expr.c (gfc_check_pointer_assign): For pointer initialization ++ targets, check that subscripts and substring indices in ++ specifications are constant expressions. ++ ++2022-01-25 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-13 Harald Anlauf ++ ++ PR fortran/67804 ++ * primary.c (gfc_match_structure_constructor): Recover from errors ++ that occurred while checking for a valid structure constructor in ++ a DATA statement. ++ ++2022-01-21 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-14 Harald Anlauf ++ ++ PR fortran/103782 ++ * expr.c (gfc_simplify_expr): Adjust logic for when to scalarize a ++ call of an intrinsic which may have been overloaded. ++ ++2022-01-20 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-18 Harald Anlauf ++ ++ PR fortran/103692 ++ * array.c (gfc_expand_constructor): Handle zero-sized array ++ constructors. ++ ++2022-01-13 Harald Anlauf ++ ++ Backported from master: ++ 2021-12-29 Harald Anlauf ++ ++ PR fortran/102332 ++ * expr.c (gfc_get_variable_expr): Avoid NULL pointer dereferences ++ during handling of errors with invalid uses of CLASS variables. ++ * match.c (select_type_set_tmp): Likewise. ++ * primary.c (gfc_match_varspec): Likewise. ++ * resolve.c (resolve_variable): Likewise. ++ (resolve_select_type): Likewise. ++ +2022-01-07 Harald Anlauf + + Backported from master: @@ -13181,7 +14421,17 @@ if (e->expr_type == EXPR_ARRAY) { if (!expand_constructor (e->value.constructor)) -@@ -2283,8 +2296,7 @@ gfc_copy_iterator (gfc_iterator *src) +@@ -1870,6 +1883,9 @@ gfc_expand_constructor (gfc_expr *e, bool fatal) + gfc_expr *f; + bool rc; + ++ if (gfc_is_size_zero_array (e)) ++ return true; ++ + /* If we can successfully get an array element at the max array size then + the array is too big to expand, so we just return. */ + f = gfc_get_array_element (e, flag_max_array_constructor); +@@ -2283,8 +2299,7 @@ gfc_copy_iterator (gfc_iterator *src) /********* Subroutines for determining the size of an array *********/ /* These are needed just to accommodate RESHAPE(). There are no @@ -13191,7 +14441,7 @@ /* Get the size of single dimension of an array specification. The -@@ -2317,6 +2329,9 @@ spec_dimen_size (gfc_array_spec *as, int dimen, mpz_t *result) +@@ -2317,6 +2332,9 @@ spec_dimen_size (gfc_array_spec *as, int dimen, mpz_t *result) mpz_add_ui (*result, *result, 1); @@ -13201,7 +14451,7 @@ return true; } -@@ -2390,12 +2405,11 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end) +@@ -2390,12 +2408,11 @@ gfc_ref_dimen_size (gfc_array_ref *ar, int dimen, mpz_t *result, mpz_t *end) { stride_expr = gfc_copy_expr(ar->stride[dimen]); @@ -13536,6 +14786,17 @@ return false; return true; +@@ -6123,8 +6126,8 @@ gfc_calculate_transfer_sizes (gfc_expr *source, gfc_expr *mold, gfc_expr *size, + * representation is not shorter than that of SOURCE. + * If SIZE is present, the result is an array of rank one and size SIZE. + */ +- if (result_elt_size == 0 && *source_size > 0 && !size +- && mold->expr_type == EXPR_ARRAY) ++ if (result_elt_size == 0 && *source_size > 0 ++ && (mold->expr_type == EXPR_ARRAY || mold->rank)) + { + gfc_error ("% argument of % intrinsic at %L is an " + "array and shall not have storage size 0 when % " --- a/src/gcc/fortran/class.c +++ b/src/gcc/fortran/class.c @@ -628,6 +628,7 @@ gfc_get_len_component (gfc_expr *e, int k) @@ -13766,7 +15027,20 @@ e->rank = p->rank; if (e->ts.type == BT_CHARACTER && p->ts.u.cl) -@@ -2295,6 +2328,31 @@ gfc_simplify_expr (gfc_expr *p, int type) +@@ -2183,10 +2216,9 @@ gfc_simplify_expr (gfc_expr *p, int type) + && gfc_intrinsic_func_interface (p, 1) == MATCH_ERROR) + return false; + +- if (p->expr_type == EXPR_FUNCTION) ++ if (p->symtree && (p->value.function.isym || p->ts.type == BT_UNKNOWN)) + { +- if (p->symtree) +- isym = gfc_find_function (p->symtree->n.sym->name); ++ isym = gfc_find_function (p->symtree->n.sym->name); + if (isym && isym->elemental) + scalarize_intrinsic_call (p, false); + } +@@ -2295,6 +2327,31 @@ gfc_simplify_expr (gfc_expr *p, int type) } @@ -13798,7 +15072,7 @@ /* Returns the type of an expression with the exception that iterator variables are automatically integers no matter what else they may be declared as. */ -@@ -3809,6 +3867,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, +@@ -3809,6 +3866,9 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, int proc_pointer; bool same_rank; @@ -13808,7 +15082,65 @@ lhs_attr = gfc_expr_attr (lvalue); if (lvalue->ts.type == BT_UNKNOWN && !lhs_attr.proc_pointer) { -@@ -6168,10 +6229,13 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, +@@ -4273,6 +4333,7 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, + { + gfc_symbol *sym; + bool target; ++ gfc_ref *ref; + + if (gfc_is_size_zero_array (rvalue)) + { +@@ -4302,6 +4363,39 @@ gfc_check_pointer_assign (gfc_expr *lvalue, gfc_expr *rvalue, + &rvalue->where); + return false; + } ++ ++ for (ref = rvalue->ref; ref; ref = ref->next) ++ { ++ switch (ref->type) ++ { ++ case REF_ARRAY: ++ for (int n = 0; n < ref->u.ar.dimen; n++) ++ if (!gfc_is_constant_expr (ref->u.ar.start[n]) ++ || !gfc_is_constant_expr (ref->u.ar.end[n]) ++ || !gfc_is_constant_expr (ref->u.ar.stride[n])) ++ { ++ gfc_error ("Every subscript of target specification " ++ "at %L must be a constant expression", ++ &ref->u.ar.where); ++ return false; ++ } ++ break; ++ ++ case REF_SUBSTRING: ++ if (!gfc_is_constant_expr (ref->u.ss.start) ++ || !gfc_is_constant_expr (ref->u.ss.end)) ++ { ++ gfc_error ("Substring starting and ending points of target " ++ "specification at %L must be constant expressions", ++ &ref->u.ss.start->where); ++ return false; ++ } ++ break; ++ ++ default: ++ break; ++ } ++ } + } + else + { +@@ -5088,7 +5182,8 @@ gfc_get_variable_expr (gfc_symtree *var) + + if (var->n.sym->attr.flavor != FL_PROCEDURE + && ((var->n.sym->as != NULL && var->n.sym->ts.type != BT_CLASS) +- || (var->n.sym->ts.type == BT_CLASS && CLASS_DATA (var->n.sym) ++ || (var->n.sym->ts.type == BT_CLASS && var->n.sym->ts.u.derived ++ && CLASS_DATA (var->n.sym) + && CLASS_DATA (var->n.sym)->as))) + { + e->rank = var->n.sym->ts.type == BT_CLASS +@@ -6168,10 +6263,13 @@ gfc_check_vardef_context (gfc_expr* e, bool pointer, bool alloc_obj, { if (ptr_component && ref->type == REF_COMPONENT) check_intentin = false; @@ -14041,6 +15373,16 @@ { m = MATCH_NO; goto cleanup; +@@ -6338,7 +6338,8 @@ select_type_set_tmp (gfc_typespec *ts) + sym = tmp->n.sym; + gfc_add_type (sym, ts, NULL); + +- if (selector->ts.type == BT_CLASS && selector->attr.class_ok) ++ if (selector->ts.type == BT_CLASS && selector->attr.class_ok ++ && selector->ts.u.derived && CLASS_DATA (selector)) + { + sym->attr.pointer + = CLASS_DATA (selector)->attr.class_pointer; --- a/src/gcc/fortran/module.c +++ b/src/gcc/fortran/module.c @@ -6078,6 +6078,17 @@ write_symtree (gfc_symtree *st) @@ -14085,7 +15427,15 @@ { --- a/src/gcc/fortran/primary.c +++ b/src/gcc/fortran/primary.c -@@ -3062,26 +3062,36 @@ build_actual_constructor (gfc_structure_ctor_component **comp_head, +@@ -2172,6 +2172,7 @@ gfc_match_varspec (gfc_expr *primary, int equiv_flag, bool sub_flag, + && !(gfc_matching_procptr_assignment + && sym->attr.flavor == FL_PROCEDURE)) + || (sym->ts.type == BT_CLASS && sym->attr.class_ok ++ && sym->ts.u.derived && CLASS_DATA (sym) + && (CLASS_DATA (sym)->attr.dimension + || CLASS_DATA (sym)->attr.codimension))) + { +@@ -3062,26 +3063,36 @@ build_actual_constructor (gfc_structure_ctor_component **comp_head, continue; } @@ -14133,9 +15483,39 @@ else if (!comp->attr.artificial) { gfc_error ("No initializer for component %qs given in the" +@@ -3365,6 +3376,7 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) + match m; + gfc_expr *e; + gfc_symtree *symtree; ++ bool t = true; + + gfc_get_ha_sym_tree (sym->name, &symtree); + +@@ -3395,10 +3407,18 @@ gfc_match_structure_constructor (gfc_symbol *sym, gfc_expr **result) + in the structure constructor must be a constant. Try to reduce the + expression here. */ + if (gfc_in_match_data ()) +- gfc_reduce_init_expr (e); ++ t = gfc_reduce_init_expr (e); + +- *result = e; +- return MATCH_YES; ++ if (t) ++ { ++ *result = e; ++ return MATCH_YES; ++ } ++ else ++ { ++ gfc_free_expr (e); ++ return MATCH_ERROR; ++ } + } + + --- a/src/gcc/fortran/resolve.c +++ b/src/gcc/fortran/resolve.c -@@ -1436,6 +1436,41 @@ resolve_structure_cons (gfc_expr *expr, int init) +@@ -1436,6 +1436,43 @@ resolve_structure_cons (gfc_expr *expr, int init) } } @@ -14157,6 +15537,8 @@ + t = false; + break; + }; ++ if (cons->expr->shape == NULL) ++ continue; + mpz_set_ui (len, 1); + mpz_add (len, len, comp->as->upper[n]->value.integer); + mpz_sub (len, len, comp->as->lower[n]->value.integer); @@ -14177,7 +15559,7 @@ if (!comp->attr.pointer || comp->attr.proc_pointer || cons->expr->expr_type == EXPR_NULL) continue; -@@ -4858,6 +4893,8 @@ gfc_resolve_dim_arg (gfc_expr *dim) +@@ -4858,6 +4895,8 @@ gfc_resolve_dim_arg (gfc_expr *dim) base symbol. We traverse the list of reference structures, setting the stored reference to references. Component references can provide an additional array specification. */ @@ -14186,7 +15568,7 @@ static void find_array_spec (gfc_expr *e) -@@ -4867,6 +4904,13 @@ find_array_spec (gfc_expr *e) +@@ -4867,6 +4906,13 @@ find_array_spec (gfc_expr *e) gfc_ref *ref; bool class_as = false; @@ -14200,7 +15582,44 @@ if (e->symtree->n.sym->ts.type == BT_CLASS) { as = CLASS_DATA (e->symtree->n.sym)->as; -@@ -11733,8 +11777,9 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns) +@@ -5633,6 +5679,8 @@ resolve_variable (gfc_expr *e) + can't be translated that way. */ + if (sym->assoc && e->rank == 0 && e->ref && sym->ts.type == BT_CLASS + && sym->assoc->target && sym->assoc->target->ts.type == BT_CLASS ++ && sym->assoc->target->ts.u.derived ++ && CLASS_DATA (sym->assoc->target) + && CLASS_DATA (sym->assoc->target)->as) + { + gfc_ref *ref = e->ref; +@@ -5697,7 +5745,8 @@ resolve_variable (gfc_expr *e) + /* Like above, but for class types, where the checking whether an array + ref is present is more complicated. Furthermore make sure not to add + the full array ref to _vptr or _len refs. */ +- if (sym->assoc && sym->ts.type == BT_CLASS ++ if (sym->assoc && sym->ts.type == BT_CLASS && sym->ts.u.derived ++ && CLASS_DATA (sym) + && CLASS_DATA (sym)->attr.dimension + && (e->ts.type != BT_DERIVED || !e->ts.u.derived->attr.vtype)) + { +@@ -9301,6 +9350,7 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns) + + /* Check F03:C815. */ + if ((c->ts.type == BT_DERIVED || c->ts.type == BT_CLASS) ++ && selector_type + && !selector_type->attr.unlimited_polymorphic + && !gfc_type_is_extensible (c->ts.u.derived)) + { +@@ -9311,7 +9361,8 @@ resolve_select_type (gfc_code *code, gfc_namespace *old_ns) + } + + /* Check F03:C816. */ +- if (c->ts.type != BT_UNKNOWN && !selector_type->attr.unlimited_polymorphic ++ if (c->ts.type != BT_UNKNOWN ++ && selector_type && !selector_type->attr.unlimited_polymorphic + && ((c->ts.type != BT_DERIVED && c->ts.type != BT_CLASS) + || !gfc_type_is_extension_of (selector_type, c->ts.u.derived))) + { +@@ -11733,8 +11784,9 @@ gfc_resolve_code (gfc_code *code, gfc_namespace *ns) gfc_resolve_omp_do_blocks (code, ns); break; case EXEC_SELECT_TYPE: @@ -14212,7 +15631,7 @@ break; case EXEC_DO_CONCURRENT: gfc_do_concurrent_flag = 1; -@@ -13095,7 +13140,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) +@@ -13095,7 +13147,8 @@ resolve_fl_procedure (gfc_symbol *sym, int mp_flag) /* An elemental function is required to return a scalar 12.7.1 */ if (sym->attr.elemental && sym->attr.function @@ -14234,7 +15653,17 @@ gfc_array_size (array, &size); arraysize = mpz_get_ui (size); mpz_clear (size); -@@ -4231,6 +4234,12 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) +@@ -2537,6 +2540,9 @@ gfc_simplify_eoshift (gfc_expr *array, gfc_expr *shift, gfc_expr *boundary, + if (arraysize == 0) + goto final; + ++ if (array->shape == NULL) ++ goto final; ++ + arrayvec = XCNEWVEC (gfc_expr *, arraysize); + array_ctor = gfc_constructor_first (array->value.constructor); + for (i = 0; i < arraysize; i++) +@@ -4231,6 +4237,12 @@ simplify_bound (gfc_expr *array, gfc_expr *dim, gfc_expr *kind, int upper) || (as->type == AS_ASSUMED_SHAPE && upper))) return NULL; @@ -14247,7 +15676,7 @@ gcc_assert (!as || (as->type != AS_DEFERRED && array->expr_type == EXPR_VARIABLE -@@ -6759,7 +6768,13 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, +@@ -6759,7 +6771,13 @@ gfc_simplify_reshape (gfc_expr *source, gfc_expr *shape_exp, gfc_extract_int (e, &shape[rank]); gcc_assert (rank >= 0 && rank < GFC_MAX_DIMENSIONS); @@ -14262,7 +15691,7 @@ rank++; } -@@ -7379,6 +7394,7 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) +@@ -7379,6 +7397,7 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) mpz_t size; gfc_expr *return_value; int d; @@ -14270,7 +15699,7 @@ /* For unary operations, the size of the result is given by the size of the operand. For binary ones, it's the size of the first operand -@@ -7435,6 +7451,10 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) +@@ -7435,6 +7454,10 @@ simplify_size (gfc_expr *array, gfc_expr *dim, int k) return simplified; } @@ -14281,7 +15710,27 @@ if (dim == NULL) { if (!gfc_array_size (array, &size)) -@@ -8071,6 +8091,9 @@ gfc_simplify_transpose (gfc_expr *matrix) +@@ -8031,7 +8054,18 @@ gfc_simplify_transfer (gfc_expr *source, gfc_expr *mold, gfc_expr *size) + set even for array expressions, in order to pass this information into + gfc_target_interpret_expr. */ + if (result->ts.type == BT_CHARACTER && gfc_is_constant_expr (mold_element)) +- result->value.character.length = mold_element->value.character.length; ++ { ++ result->value.character.length = mold_element->value.character.length; ++ ++ /* Let the typespec of the result inherit the string length. ++ This is crucial if a resulting array has size zero. */ ++ if (mold_element->ts.u.cl->length) ++ result->ts.u.cl->length = gfc_copy_expr (mold_element->ts.u.cl->length); ++ else ++ result->ts.u.cl->length = ++ gfc_get_int_expr (gfc_charlen_int_kind, NULL, ++ mold_element->value.character.length); ++ } + + /* Set the number of elements in the result, and determine its size. */ + +@@ -8071,6 +8105,9 @@ gfc_simplify_transpose (gfc_expr *matrix) gcc_assert (matrix->rank == 2); @@ -14293,6 +15742,15 @@ result->rank = 2; --- a/src/gcc/fortran/target-memory.c +++ b/src/gcc/fortran/target-memory.c +@@ -486,7 +486,7 @@ gfc_interpret_character (unsigned char *buffer, size_t buffer_size, + + result->value.character.string[result->value.character.length] = '\0'; + +- return result->value.character.length; ++ return size_character (result->value.character.length, result->ts.kind); + } + + @@ -534,6 +534,9 @@ gfc_interpret_derived (unsigned char *buffer, size_t buffer_size, gfc_expr *resu { int n; @@ -14659,7 +16117,45 @@ atan2d = build_call_expr_loc (input_location, atan2d, 2, args[0], args[1]); se->expr = fold_build2_loc (input_location, MULT_EXPR, type, atan2d, -@@ -8822,7 +8826,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) +@@ -8451,7 +8455,8 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr) + { + case BT_CHARACTER: + tmp = size_of_string_in_bytes (arg->expr->ts.kind, argse.string_length); +- mold_type = gfc_get_character_type_len (arg->expr->ts.kind, tmp); ++ mold_type = gfc_get_character_type_len (arg->expr->ts.kind, ++ argse.string_length); + break; + case BT_CLASS: + tmp = gfc_class_vtab_size_get (argse.expr); +@@ -8553,7 +8558,13 @@ gfc_conv_intrinsic_transfer (gfc_se * se, gfc_expr * expr) + + se->expr = info->descriptor; + if (expr->ts.type == BT_CHARACTER) +- se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len); ++ { ++ tmp = fold_convert (gfc_charlen_type_node, ++ TYPE_SIZE_UNIT (gfc_get_char_type (expr->ts.kind))); ++ se->string_length = fold_build2_loc (input_location, TRUNC_DIV_EXPR, ++ gfc_charlen_type_node, ++ dest_word_len, tmp); ++ } + + return; + +@@ -8607,7 +8618,11 @@ scalar_transfer: + gfc_add_expr_to_block (&se->post, tmp); + + se->expr = tmpdecl; +- se->string_length = fold_convert (gfc_charlen_type_node, dest_word_len); ++ tmp = fold_convert (gfc_charlen_type_node, ++ TYPE_SIZE_UNIT (gfc_get_char_type (expr->ts.kind))); ++ se->string_length = fold_build2_loc (input_location, TRUNC_DIV_EXPR, ++ gfc_charlen_type_node, ++ dest_word_len, tmp); + } + else + { +@@ -8822,7 +8837,8 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) else { /* An optional target. */ @@ -14669,7 +16165,7 @@ gfc_add_data_component (arg2->expr); if (scalar) -@@ -8843,6 +8848,11 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) +@@ -8843,6 +8859,11 @@ gfc_conv_associated (gfc_se *se, gfc_expr *expr) && arg2->expr->symtree->n.sym->attr.dummy) arg2se.expr = build_fold_indirect_ref_loc (input_location, arg2se.expr); @@ -14833,6 +16329,15 @@ count2 = streamer_read_uhwi (&ib); --- a/src/gcc/ipa-param-manipulation.c +++ b/src/gcc/ipa-param-manipulation.c +@@ -145,7 +145,7 @@ ipa_dump_adjusted_parameters (FILE *f, + fprintf (f, " prefix: %s", + ipa_param_prefixes[apm->param_prefix_index]); + if (apm->reverse) +- fprintf (f, ", reverse-sso"); ++ fprintf (f, ", reverse"); + break; + } + fprintf (f, "\n"); @@ -1676,7 +1676,9 @@ ipa_param_body_adjustments::modify_call_stmt (gcall **stmt_p) if (tree lhs = gimple_call_lhs (stmt)) { @@ -14860,7 +16365,108 @@ this_looping = true; --- a/src/gcc/ipa-sra.c +++ b/src/gcc/ipa-sra.c -@@ -340,7 +340,7 @@ class isra_call_summary +@@ -1,6 +1,5 @@ + /* Interprocedural scalar replacement of aggregates +- Copyright (C) 2008-2020 Free Software Foundation, Inc. +- ++ Copyright (C) 2019-2022 Free Software Foundation, Inc. + Contributed by Martin Jambor + + This file is part of GCC. +@@ -21,7 +20,7 @@ along with GCC; see the file COPYING3. If not see + + /* IPA-SRA is an interprocedural pass that removes unused function return + values (turning functions returning a value which is never used into void +- functions), removes unused function parameters. It can also replace an ++ functions) and removes unused function parameters. It can also replace an + aggregate parameter by a set of other parameters representing part of the + original, turning those passed by reference into new ones which pass the + value directly. +@@ -57,7 +56,6 @@ along with GCC; see the file COPYING3. If not see + ipa-param-manipulation.h for more details. */ + + +- + #include "config.h" + #include "system.h" + #include "coretypes.h" +@@ -89,7 +87,7 @@ along with GCC; see the file COPYING3. If not see + #define ISRA_ARG_SIZE_LIMIT_BITS 16 + #define ISRA_ARG_SIZE_LIMIT (1 << ISRA_ARG_SIZE_LIMIT_BITS) + /* How many parameters can feed into a call actual argument and still be +- tracked. */ ++ tracked. */ + #define IPA_SRA_MAX_PARAM_FLOW_LEN 7 + + /* Structure describing accesses to a specific portion of an aggregate +@@ -118,7 +116,7 @@ struct GTY(()) param_access + transformed function - initially not set for portions of formal parameters + that are only used as actual function arguments passed to callees. */ + unsigned certain : 1; +- /* Set if the access has a reversed scalar storage order. */ ++ /* Set if the access has reverse scalar storage order. */ + unsigned reverse : 1; + }; + +@@ -152,7 +150,7 @@ struct gensum_param_access + arguments to a function call that can be tracked. */ + bool nonarg; + +- /* Set if the access has a reversed scalar storage order. */ ++ /* Set if the access has reverse scalar storage order. */ + bool reverse; + }; + +@@ -215,8 +213,8 @@ struct gensum_param_desc + }; + + /* Properly deallocate accesses of DESC. TODO: Since this data structure is +- not in GC memory, this is not necessary and we can consider removing the +- function. */ ++ allocated in GC memory, this is not necessary and we can consider removing ++ the function. */ + + static void + free_param_decl_accesses (isra_param_desc *desc) +@@ -271,9 +269,9 @@ public: + unsigned m_queued : 1; + }; + +-/* Clean up and deallocate isra_func_summary points to. TODO: Since this data +- structure is not in GC memory, this is not necessary and we can consider +- removing the destructor. */ ++/* Deallocate the memory pointed to by isra_func_summary. TODO: Since this ++ data structure is allocated in GC memory, this is not necessary and we can ++ consider removing the destructor. */ + + isra_func_summary::~isra_func_summary () + { +@@ -283,7 +281,6 @@ isra_func_summary::~isra_func_summary () + vec_free (m_parameters); + } + +- + /* Mark the function as not a candidate for any IPA-SRA transformation. Return + true if it was a candidate until now. */ + +@@ -293,6 +290,7 @@ isra_func_summary::zap () + bool ret = m_candidate; + m_candidate = false; + ++ /* TODO: see the destructor above. */ + unsigned len = vec_safe_length (m_parameters); + for (unsigned i = 0; i < len; ++i) + free_param_decl_accesses (&(*m_parameters)[i]); +@@ -302,7 +300,7 @@ isra_func_summary::zap () + } + + /* Structure to describe which formal parameters feed into a particular actual +- arguments. */ ++ argument. */ + + struct isra_param_flow + { +@@ -340,7 +338,7 @@ class isra_call_summary public: isra_call_summary () : m_arg_flow (), m_return_ignored (false), m_return_returned (false), @@ -14869,7 +16475,7 @@ {} void init_inputs (unsigned arg_count); -@@ -359,6 +359,10 @@ public: +@@ -359,6 +357,10 @@ public: /* Set when any of the call arguments are not byte-aligned. */ unsigned m_bit_aligned_arg : 1; @@ -14880,7 +16486,15 @@ }; /* Class to manage function summaries. */ -@@ -472,6 +476,8 @@ isra_call_summary::dump (FILE *f) +@@ -417,6 +419,7 @@ ipa_sra_function_summaries::duplicate (cgraph_node *, cgraph_node *, + to->unit_offset = from->unit_offset; + to->unit_size = from->unit_size; + to->certain = from->certain; ++ to->reverse = from->reverse; + d->accesses->quick_push (to); + } + } +@@ -472,6 +475,8 @@ isra_call_summary::dump (FILE *f) fprintf (f, " return value ignored\n"); if (m_return_returned) fprintf (f, " return value used only to compute caller return value\n"); @@ -14889,7 +16503,7 @@ for (unsigned i = 0; i < m_arg_flow.length (); i++) { fprintf (f, " Parameter %u:\n", i); -@@ -516,6 +522,7 @@ ipa_sra_call_summaries::duplicate (cgraph_edge *, cgraph_edge *, +@@ -516,6 +521,7 @@ ipa_sra_call_summaries::duplicate (cgraph_edge *, cgraph_edge *, new_sum->m_return_ignored = old_sum->m_return_ignored; new_sum->m_return_returned = old_sum->m_return_returned; new_sum->m_bit_aligned_arg = old_sum->m_bit_aligned_arg; @@ -14897,7 +16511,45 @@ } -@@ -979,15 +986,17 @@ ptr_parm_has_nonarg_uses (cgraph_node *node, function *fun, tree parm, +@@ -525,7 +531,7 @@ namespace { + + hash_map *decl2desc; + +-/* Countdown of allowed Alias analysis steps during summary building. */ ++/* Countdown of allowed Alias Analysis steps during summary building. */ + + int aa_walking_limit; + +@@ -645,7 +651,7 @@ dump_isra_access (FILE *f, param_access *access) + if (access->certain) + fprintf (f, ", certain"); + else +- fprintf (f, ", not-certain"); ++ fprintf (f, ", not certain"); + if (access->reverse) + fprintf (f, ", reverse"); + fprintf (f, "\n"); +@@ -907,8 +913,7 @@ isra_track_scalar_value_uses (function *fun, cgraph_node *node, tree name, + + This function is similar to ptr_parm_has_nonarg_uses but its results are + meant for unused parameter removal, as opposed to splitting of parameters +- passed by reference or converting them to passed by value. +- */ ++ passed by reference or converting them to passed by value. */ + + static bool + isra_track_scalar_param_local_uses (function *fun, cgraph_node *node, tree parm, +@@ -948,8 +953,7 @@ isra_track_scalar_param_local_uses (function *fun, cgraph_node *node, tree parm, + This function is similar to isra_track_scalar_param_local_uses but its + results are meant for splitting of parameters passed by reference or turning + them into bits passed by value, as opposed to generic unused parameter +- removal. +- */ ++ removal. */ + + static bool + ptr_parm_has_nonarg_uses (cgraph_node *node, function *fun, tree parm, +@@ -979,15 +983,17 @@ ptr_parm_has_nonarg_uses (cgraph_node *node, function *fun, tree parm, if (gimple_assign_single_p (stmt)) { tree rhs = gimple_assign_rhs1 (stmt); @@ -14924,7 +16576,7 @@ } else if (is_gimple_call (stmt)) { -@@ -1021,15 +1030,17 @@ ptr_parm_has_nonarg_uses (cgraph_node *node, function *fun, tree parm, +@@ -1021,15 +1027,17 @@ ptr_parm_has_nonarg_uses (cgraph_node *node, function *fun, tree parm, continue; } @@ -14951,7 +16603,16 @@ } } -@@ -1901,7 +1912,8 @@ scan_function (cgraph_node *node, struct function *fun) +@@ -1626,7 +1634,7 @@ record_nonregister_call_use (gensum_param_desc *desc, + } + + /* Callback of walk_aliased_vdefs, just mark that there was a possible +- modification. */ ++ modification. */ + + static bool + mark_maybe_modified (ao_ref *, tree, void *data) +@@ -1901,7 +1909,8 @@ scan_function (cgraph_node *node, struct function *fun) if (lhs) scan_expr_access (lhs, stmt, ISRA_CTX_STORE, bb); int flags = gimple_call_flags (stmt); @@ -14961,7 +16622,27 @@ bitmap_set_bit (final_bbs, bb->index); } break; -@@ -2355,6 +2367,7 @@ process_scan_results (cgraph_node *node, struct function *fun, +@@ -2170,7 +2179,7 @@ static bool + check_gensum_access (tree parm, gensum_param_desc *desc, + gensum_param_access *access, + HOST_WIDE_INT *nonarg_acc_size, bool *only_calls, +- int entry_bb_index) ++ int entry_bb_index) + { + if (access->nonarg) + { +@@ -2338,8 +2347,8 @@ process_scan_results (cgraph_node *node, struct function *fun, + offset in this function at IPA level. + + TODO: Measure the overhead and the effect of just being pessimistic. +- Maybe this is only -O3 material? +- */ ++ Maybe this is only -O3 material? */ ++ + bool pdoms_calculated = false; + if (check_pass_throughs) + for (cgraph_edge *cs = node->callees; cs; cs = cs->next_callee) +@@ -2355,6 +2364,7 @@ process_scan_results (cgraph_node *node, struct function *fun, unsigned count = gimple_call_num_args (call_stmt); isra_call_summary *csum = call_sums->get_create (cs); csum->init_inputs (count); @@ -14969,7 +16650,7 @@ for (unsigned argidx = 0; argidx < count; argidx++) { if (!csum->m_arg_flow[argidx].pointer_pass_through) -@@ -2601,6 +2614,7 @@ isra_write_edge_summary (output_block *ob, cgraph_edge *e) +@@ -2601,6 +2611,7 @@ isra_write_edge_summary (output_block *ob, cgraph_edge *e) bp_pack_value (&bp, csum->m_return_ignored, 1); bp_pack_value (&bp, csum->m_return_returned, 1); bp_pack_value (&bp, csum->m_bit_aligned_arg, 1); @@ -14977,7 +16658,15 @@ streamer_write_bitpack (&bp); } -@@ -2719,6 +2733,7 @@ isra_read_edge_summary (struct lto_input_block *ib, cgraph_edge *cs) +@@ -2631,6 +2642,7 @@ isra_write_node_summary (output_block *ob, cgraph_node *node) + streamer_write_uhwi (ob, acc->unit_size); + bitpack_d bp = bitpack_create (ob->main_stream); + bp_pack_value (&bp, acc->certain, 1); ++ bp_pack_value (&bp, acc->reverse, 1); + streamer_write_bitpack (&bp); + } + streamer_write_uhwi (ob, desc->param_size_limit); +@@ -2719,6 +2731,7 @@ isra_read_edge_summary (struct lto_input_block *ib, cgraph_edge *cs) csum->m_return_ignored = bp_unpack_value (&bp, 1); csum->m_return_returned = bp_unpack_value (&bp, 1); csum->m_bit_aligned_arg = bp_unpack_value (&bp, 1); @@ -14985,7 +16674,51 @@ } /* Read intraprocedural analysis information about NODE and all of its outgoing -@@ -3475,7 +3490,8 @@ param_splitting_across_edge (cgraph_edge *cs) +@@ -2748,6 +2761,7 @@ isra_read_node_info (struct lto_input_block *ib, cgraph_node *node, + acc->unit_size = streamer_read_uhwi (ib); + bitpack_d bp = streamer_read_bitpack (ib); + acc->certain = bp_unpack_value (&bp, 1); ++ acc->reverse = bp_unpack_value (&bp, 1); + vec_safe_push (desc->accesses, acc); + } + desc->param_size_limit = streamer_read_uhwi (ib); +@@ -3207,7 +3221,7 @@ isra_mark_caller_param_used (isra_func_summary *from_ifs, int input_idx, + + /* Propagate information that any parameter is not used only locally within a + SCC across CS to the caller, which must be in the same SCC as the +- callee. Push any callers that need to be re-processed to STACK. */ ++ callee. Push any callers that need to be re-processed to STACK. */ + + static void + propagate_used_across_scc_edge (cgraph_edge *cs, vec *stack) +@@ -3245,7 +3259,7 @@ propagate_used_across_scc_edge (cgraph_edge *cs, vec *stack) + + /* Propagate information that any parameter is not used only locally within a + SCC (i.e. is used also elsewhere) to all callers of NODE that are in the +- same SCC. Push any callers that need to be re-processed to STACK. */ ++ same SCC. Push any callers that need to be re-processed to STACK. */ + + static bool + propagate_used_to_scc_callers (cgraph_node *node, void *data) +@@ -3338,7 +3352,8 @@ pull_accesses_from_callee (cgraph_node *caller, isra_param_desc *param_desc, + && pacc->unit_size == argacc->unit_size) + { + if (argacc->alias_ptr_type != pacc->alias_ptr_type +- || !types_compatible_p (argacc->type, pacc->type)) ++ || !types_compatible_p (argacc->type, pacc->type) ++ || argacc->reverse != pacc->reverse) + return "propagated access types would not match existing ones"; + + exact_match = true; +@@ -3395,6 +3410,7 @@ pull_accesses_from_callee (cgraph_node *caller, isra_param_desc *param_desc, + copy->type = argacc->type; + copy->alias_ptr_type = argacc->alias_ptr_type; + copy->certain = true; ++ copy->reverse = argacc->reverse; + vec_safe_push (param_desc->accesses, copy); + } + else if (prop_kinds[j] == ACC_PROP_CERTAIN) +@@ -3475,7 +3491,8 @@ param_splitting_across_edge (cgraph_edge *cs) } else if (!ipf->safe_to_import_accesses) { @@ -14995,6 +16728,14 @@ { if (dump_file && (dump_flags & TDF_DETAILS)) fprintf (dump_file, " %u->%u: cannot import accesses.\n", +@@ -3655,7 +3672,6 @@ retval_used_p (cgraph_node *node, void *) + PREV_ADJUSTMENT. If the parent clone is the original function, + PREV_ADJUSTMENT is NULL and PREV_CLONE_INDEX is equal to BASE_INDEX. */ + +- + static void + push_param_adjustments_for_index (isra_func_summary *ifs, unsigned base_index, + unsigned prev_clone_index, --- a/src/gcc/jit/ChangeLog +++ b/src/gcc/jit/ChangeLog @@ -1,3 +1,10 @@ @@ -15613,7 +17354,274 @@ #endif --- a/src/gcc/testsuite/ChangeLog +++ b/src/gcc/testsuite/ChangeLog -@@ -1,3 +1,1726 @@ +@@ -1,3 +1,1993 @@ ++2022-03-18 Peter Bergner ++ ++ Backported from master: ++ 2022-03-04 Peter Bergner ++ ++ PR target/87496 ++ PR target/104208 ++ * gcc.target/powerpc/pr104208-1.c: New test. ++ * gcc.target/powerpc/pr104208-2.c: Likewise. ++ * gcc.target/powerpc/pr87496-2.c: Swap long double options to trigger ++ the expected error. ++ * gcc.target/powerpc/pr87496-3.c: Likewise. ++ ++2022-03-16 Richard Biener ++ ++ Backported from master: ++ 2022-02-09 Richard Biener ++ ++ PR target/104453 ++ * gcc.target/i386/pr104453.c: New testcase. ++ ++2022-03-16 Richard Biener ++ ++ Backported from master: ++ 2022-02-14 Richard Biener ++ ++ PR tree-optimization/104511 ++ * gcc.dg/pr104511.c: New testcase. ++ ++2022-03-12 Michael Meissner ++ ++ PR target/99708 ++ * gcc.target/powerpc/pr99708.c: Revert 2022-03-05 patch. ++ ++2022-03-06 Michael Meissner ++ ++ PR target/104253 ++ * gcc.target/powerpc/pr104253.c: New test. Backport change made ++ to the master branch on 2022-02-14. ++ ++2022-03-06 Michael Meissner ++ ++ PR target/99708 ++ * gcc.target/powerpc/pr99708.c: New test. Backport change to ++ master branch on 2022-02-17. ++ ++2022-02-23 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-22 Harald Anlauf ++ ++ PR fortran/104619 ++ * gfortran.dg/derived_constructor_comps_7.f90: New test. ++ ++2022-02-17 Jason Merrill ++ ++ Revert: ++ 2022-02-17 Jason Merrill ++ ++ PR c++/92918 ++ * g++.dg/lookup/using66.C: New test. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-15 Richard Biener ++ ++ PR tree-optimization/103237 ++ * gcc.dg/torture/pr103237.c: New testcase. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-22 Richard Biener ++ ++ PR middle-end/103181 ++ PR middle-end/103248 ++ * gcc.dg/torture/pr103181.c: New testcase. ++ * gcc.dg/pr103248.c: Likewise. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-11-08 Richard Biener ++ ++ PR tree-optimization/102798 ++ * gcc.dg/pr102798.c: New testcase. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-10-15 Richard Biener ++ ++ PR ipa/102762 ++ * gcc.dg/torture/pr102762.c: New testcase. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-06-08 Richard Biener ++ ++ PR tree-optimization/100923 ++ * gcc.dg/torture/pr100923.c: New testcase. ++ ++2022-02-17 Richard Biener ++ ++ Backported from master: ++ 2021-06-22 Richard Biener ++ ++ PR tree-optimization/101158 ++ * gfortran.dg/pr101158.f90: New testcase. ++ ++2022-02-15 Kewen Lin ++ ++ Backported from master: ++ 2022-02-07 Kewen Lin ++ ++ PR target/103627 ++ * gcc.target/powerpc/pr103627-3.c: New test. ++ ++2022-02-15 Kewen Lin ++ ++ Backported from master: ++ 2022-02-07 Kewen Lin ++ ++ PR target/103627 ++ * gcc.target/powerpc/pr103627-1.c: New test. ++ * gcc.target/powerpc/pr103627-2.c: New test. ++ ++2022-02-10 H.J. Lu ++ ++ Backported from master: ++ 2022-02-10 H.J. Lu ++ ++ PR target/104458 ++ * gcc.target/i386/pr104458.c: Replace long with long long. ++ ++2022-02-10 Uros Bizjak ++ ++ Backported from master: ++ 2022-02-10 Uroš Bizjak ++ ++ PR target/104469 ++ * gcc.target/i386/pr104469.c: New test. ++ ++2022-02-09 Uroš Bizjak ++ ++ PR target/104458 ++ * gcc.target/i386/pr104458.c: New test. ++ ++2022-02-09 liuhongt ++ ++ PR target/104451 ++ * gcc.target/i386/pr104451.c: New test. ++ ++2022-02-04 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-03 Harald Anlauf ++ ++ PR fortran/104311 ++ * gfortran.dg/transfer_simplify_15.f90: New test. ++ ++2022-02-02 Harald Anlauf ++ ++ Backported from master: ++ 2022-02-01 Harald Anlauf ++ ++ PR fortran/104331 ++ * gfortran.dg/eoshift_9.f90: New test. ++ ++2022-02-02 Xi Ruoyao ++ ++ Backported from master: ++ 2022-02-01 Xi Ruoyao ++ ++ * gcc.dg/pr95115.c: New test. ++ ++2022-01-29 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-15 Harald Anlauf ++ ++ PR fortran/83079 ++ * gfortran.dg/transfer_char_kind4.f90: New test. ++ ++2022-01-29 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-22 Harald Anlauf ++ ++ PR fortran/104127 ++ * gfortran.dg/transfer_simplify_11.f90: Fix logic. ++ * gfortran.dg/transfer_simplify_13.f90: New test. ++ ++2022-01-26 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-25 Harald Anlauf ++ ++ PR fortran/104227 ++ * gfortran.dg/transfer_check_6.f90: New test. ++ ++2022-01-25 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-09 Harald Anlauf ++ ++ PR fortran/101762 ++ * gfortran.dg/pr101762.f90: New test. ++ ++2022-01-25 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-13 Harald Anlauf ++ ++ PR fortran/67804 ++ * gfortran.dg/pr93604.f90: Adjust to changed diagnostics. ++ * gfortran.dg/pr67804.f90: New test. ++ ++2022-01-21 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-14 Harald Anlauf ++ ++ PR fortran/103782 ++ * gfortran.dg/overload_4.f90: New test. ++ ++2022-01-20 Harald Anlauf ++ ++ Backported from master: ++ 2022-01-18 Harald Anlauf ++ ++ PR fortran/103692 ++ * gfortran.dg/pr102520.f90: Adjust error messages. ++ * gfortran.dg/pr103692.f90: New test. ++ ++2022-01-15 Peter Bergner ++ ++ Backported from master: ++ 2021-11-16 Peter Bergner ++ ++ PR target/102976 ++ * gcc.target/powerpc/pr102976.c: New test. ++ ++2022-01-15 Peter Bergner ++ ++ Backported from master: ++ 2021-09-14 Peter Bergner ++ ++ * gcc.target/powerpc/mma-builtin-6.c: Add second call to xxsetacc ++ built-in. Update instruction counts. ++ ++2022-01-14 Eric Botcazou ++ ++ * gnat.dg/lto25.adb: New test. ++ * gnat.dg/opt96.adb: Likewise. ++ * gnat.dg/opt96_pkg.ads, gnat.dg/opt96_pkg.adb: New helper. ++ ++2022-01-13 Harald Anlauf ++ ++ Backported from master: ++ 2021-12-29 Harald Anlauf ++ ++ PR fortran/102332 ++ * gfortran.dg/pr102332.f90: New test. ++ +2022-01-12 Richard Biener + + Backported from master: @@ -18636,33 +20644,6 @@ +} new file mode 100644 --- /dev/null -+++ b/src/gcc/testsuite/g++.dg/lookup/using66.C -@@ -0,0 +1,23 @@ -+// PR c++/92918 -+// { dg-do compile { target c++11 } } -+ -+struct Base03 -+{ -+ static void impl(); -+}; -+ -+struct Problem : Base03 -+{ -+ using Base03::impl; -+ static int impl(char const *); -+ -+ template -+ auto f(const T &t) const -+ -> decltype(impl(t)) -+ { -+ return impl(t); -+ } -+}; -+ -+Problem t; -+int i = t.f("42"); -new file mode 100644 ---- /dev/null +++ b/src/gcc/testsuite/g++.dg/lto/pr97565_0.C @@ -0,0 +1,7 @@ +// { dg-lto-do link } @@ -20006,6 +21987,83 @@ + return log_bad_request(0, __builtin_va_arg_pack()); /* { dg-warning "implicit" } */ +} +void log_bad_request() { foo (0); } /* { dg-warning "conflicting types" } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr102798.c +@@ -0,0 +1,41 @@ ++/* { dg-do run } */ ++/* { dg-options "-O3 -fno-tree-pta" } */ ++ ++typedef __SIZE_TYPE__ size_t; ++ ++__attribute__((__noipa__)) ++void BUF_reverse (unsigned char *out, const unsigned char *in, size_t size) ++{ ++ size_t i; ++ if (in) ++ { ++ out += size - 1; ++ for (i = 0; i < size; i++) ++ *out++ = *in++; ++ } ++ else ++ { ++ unsigned char *q; ++ char c; ++ q = out + size - 1; ++ for (i = 0; i < size ; i++) ++ { ++ *out++ = 1; ++ } ++ } ++} ++ ++int ++main (void) ++{ ++ unsigned char buf[40]; ++ unsigned char buf1[40]; ++ for (unsigned i = 0; i < sizeof (buf); i++) ++ buf[i] = i; ++ BUF_reverse (buf, 0, sizeof (buf)); ++ for (unsigned i = 0; i < sizeof (buf); i++) ++ if (buf[i] != 1) ++ __builtin_abort (); ++ ++ return 0; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr103248.c +@@ -0,0 +1,8 @@ ++/* { dg-do compile } */ ++/* { dg-require-effective-target fixed_point } */ ++/* { dg-options "-fnon-call-exceptions" } */ ++ ++_Accum sa; ++int c; ++ ++void div_csa() { c /= sa; } +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr104511.c +@@ -0,0 +1,16 @@ ++/* { dg-do compile { target dfp } } */ ++/* { dg-options "-O -Wno-psabi" } */ ++ ++typedef _Float64 __attribute__((__vector_size__ (32))) F; ++typedef _Decimal32 __attribute__((__vector_size__ (16))) D; ++ ++extern void bar (void); ++ ++D g; ++void ++foo (F f) ++{ ++ D d = __builtin_convertvector (f, D); ++ bar (); ++ g = d; ++} --- a/src/gcc/testsuite/gcc.dg/pr78213.c +++ b/src/gcc/testsuite/gcc.dg/pr78213.c @@ -1,12 +1,5 @@ @@ -20045,6 +22103,35 @@ } -/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not supported without '-fasan-shadow-offset=' for this target" "" { target *-*-* } 0 } */ +/* { dg-warning ".'-fsanitize=kernel-address' with stack protection is not supported without '-fasan-shadow-offset=' for this target" "" { target riscv*-*-* } 0 } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/pr95115.c +@@ -0,0 +1,25 @@ ++/* { dg-do run } */ ++/* { dg-options "-O2 -ftrapping-math" } */ ++/* { dg-add-options ieee } */ ++/* { dg-require-effective-target fenv_exceptions } */ ++ ++#include ++#include ++ ++double ++x (void) ++{ ++ double d = __builtin_inf (); ++ return d / d; ++} ++ ++int ++main (void) ++{ ++ double r = x (); ++ if (!__builtin_isnan (r)) ++ abort (); ++ if (!fetestexcept (FE_INVALID)) ++ abort (); ++ exit (0); ++} --- a/src/gcc/testsuite/gcc.dg/pr96260.c +++ b/src/gcc/testsuite/gcc.dg/pr96260.c @@ -1,7 +1,7 @@ @@ -20439,6 +22526,35 @@ +} new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/torture/pr100923.c +@@ -0,0 +1,25 @@ ++/* { dg-do run } */ ++ ++int a = 1, b, c, *d = &a, *e = &a, f; ++void g(int h) {} ++void k(int *l) ++{ ++ int ***j; ++ if (c) ++ { ++ *j = &l; ++ ***j; ++ } ++ g(*l); ++ *e = f; ++ if (*l) ++ { ++ int i = b / a; ++ a = i; ++ } ++} ++int main() ++{ ++ k(d); ++ return 0; ++} +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gcc.dg/torture/pr100934.c @@ -0,0 +1,21 @@ +/* { dg-do run } */ @@ -20552,6 +22668,77 @@ +} new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/torture/pr102762.c +@@ -0,0 +1,11 @@ ++/* { dg-do compile } */ ++/* We fail to diagnose the invalid __builtin_va_arg_pack use with -flto. */ ++/* { dg-skip-if "" { *-*-* } { "-flto" } { "" } } */ ++ ++void log_bad_request(); ++void foo(a, b) ++ int a, b; ++{ ++ log_bad_request(0, __builtin_va_arg_pack()); /* { dg-error "invalid use" } */ ++ foo(0); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/torture/pr103181.c +@@ -0,0 +1,24 @@ ++/* { dg-do run } */ ++ ++typedef unsigned char __attribute__((__vector_size__ (2))) U; ++typedef unsigned short S; ++typedef unsigned int __attribute__((__vector_size__ (64))) V; ++ ++V v; ++U a, b, c; ++ ++U ++foo (S s) ++{ ++ v += __builtin_bswap16 (s) || (S) (a / ((U){3, 0})); ++ return b + c; ++} ++ ++int ++main (void) ++{ ++ U x = foo (4); ++ if (x[0] || x[1]) ++ __builtin_abort (); ++ return 0; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.dg/torture/pr103237.c +@@ -0,0 +1,24 @@ ++/* { dg-do run } */ ++/* { dg-additional-options "-ftree-vectorize" } */ ++ ++int g1; ++unsigned int g2 = -1U; ++static void __attribute__((noipa)) ++func_1() ++{ ++ int *l_1 = &g1; ++ for (int g3a = 0; g3a != 4; g3a++) ++ for (int l_2 = 0; l_2 <= 3; l_2++) ++ { ++ unsigned int *l_3 = &g2; ++ *l_1 = *l_3 ^= 1; ++ } ++} ++int ++main() ++{ ++ func_1(); ++ if (g1 != -1) ++ __builtin_abort (); ++ return 0; ++} +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gcc.dg/torture/pr96513.c @@ -0,0 +1,26 @@ +/* { dg-do compile } */ @@ -22301,44 +24488,121 @@ +/* { dg-options "-O2 -mlzcnt" } */ +/* { dg-require-effective-target lzcnt } */ + -+#include "lzcnt-check.h" ++#include "lzcnt-check.h" ++ ++static int ++foo (unsigned int v) ++{ ++ return v ? __builtin_clz (v) : 32; ++} ++ ++/* returns -1 if x == 0 */ ++int ++__attribute__ ((noinline, noclone)) ++bar (unsigned int x) ++{ ++ return 31 - foo (x); ++} ++ ++static void ++lzcnt_test () ++{ ++ int r = bar (0); ++ ++ if (r != -1) ++ abort (); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/i386/pr102761.c +@@ -0,0 +1,11 @@ ++/* PR target/102761 */ ++/* { dg-do compile } */ ++/* { dg-options "-O1" } */ ++ ++int foo (void); ++ ++void ++bar (void) ++{ ++ asm volatile ("%a0" : : "X"(foo () ? 2 : 1)); /* { dg-error "invalid constraints for operand" } */ ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/i386/pr104451.c +@@ -0,0 +1,25 @@ ++/* { dg-do compile } */ ++/* { dg-options "-mavx2 -mxop -O" } */ ++ ++typedef char __attribute__((__vector_size__ (16))) V; ++typedef unsigned char __attribute__((__vector_size__ (16))) UV; ++V v; ++UV uv; + -+static int -+foo (unsigned int v) ++V ++foo (long c) +{ -+ return v ? __builtin_clz (v) : 32; ++ return v << c; +} + -+/* returns -1 if x == 0 */ -+int -+__attribute__ ((noinline, noclone)) -+bar (unsigned int x) ++V ++foo1 (long c) +{ -+ return 31 - foo (x); ++ return v >> c; +} + -+static void -+lzcnt_test () ++UV ++foo2 (unsigned long uc) +{ -+ int r = bar (0); -+ -+ if (r != -1) -+ abort (); ++ return uv >> uc; +} new file mode 100644 --- /dev/null -+++ b/src/gcc/testsuite/gcc.target/i386/pr102761.c ++++ b/src/gcc/testsuite/gcc.target/i386/pr104453.c @@ -0,0 +1,11 @@ -+/* PR target/102761 */ +/* { dg-do compile } */ -+/* { dg-options "-O1" } */ ++/* { dg-options "-mavx512f" } */ + -+int foo (void); ++typedef short __attribute__((__vector_size__ (32))) V; ++V g; + +void -+bar (void) ++foo (void) +{ -+ asm volatile ("%a0" : : "X"(foo () ? 2 : 1)); /* { dg-error "invalid constraints for operand" } */ ++ __builtin_ia32_psrawi256 (g, 0); ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/i386/pr104458.c +@@ -0,0 +1,13 @@ ++/* PR target/104458 */ ++/* { dg-do compile { target { ! ia32 } } } */ ++/* { dg-options "-O1 -m8bit-idiv" } */ ++ ++typedef float __attribute__((__vector_size__ (8))) F; ++ ++int i; ++ ++void ++foo (F f) ++{ ++ i += i % (long long) f; ++} +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/i386/pr104469.c +@@ -0,0 +1,12 @@ ++/* PR target/104469 */ ++/* { dg-do compile } */ ++/* { dg-options "-mavx512f" } */ ++ ++typedef double __attribute__((__vector_size__ (64))) F; ++typedef int __attribute__((__vector_size__ (32))) V; ++ ++F ++foo (V v) ++{ ++ return __builtin_convertvector (v, F); +} deleted file mode 100644 --- a/src/gcc/testsuite/gcc.target/i386/pr71245-1.c @@ -22557,6 +24821,31 @@ +/* { dg-final { scan-assembler-times {\mstxvp\M} 4 } } */ +/* { dg-final { scan-assembler-times {\mxxmfacc\M} 3 } } */ +/* { dg-final { scan-assembler-times {\mxxmtacc\M} 3 } } */ +--- a/src/gcc/testsuite/gcc.target/powerpc/mma-builtin-6.c ++++ b/src/gcc/testsuite/gcc.target/powerpc/mma-builtin-6.c +@@ -5,14 +5,16 @@ + void + foo (__vector_quad *dst) + { +- __vector_quad acc; +- __builtin_mma_xxsetaccz (&acc); +- *dst = acc; ++ __vector_quad acc0, acc1; ++ __builtin_mma_xxsetaccz (&acc0); ++ __builtin_mma_xxsetaccz (&acc1); ++ dst[0] = acc0; ++ dst[1] = acc1; + } + + /* { dg-final { scan-assembler-not {\mlxv\M} } } */ + /* { dg-final { scan-assembler-not {\mlxvp\M} } } */ + /* { dg-final { scan-assembler-not {\mxxmtacc\M} } } */ +-/* { dg-final { scan-assembler-times {\mxxsetaccz\M} 1 } } */ +-/* { dg-final { scan-assembler-times {\mxxmfacc\M} 1 } } */ +-/* { dg-final { scan-assembler-times {\mstxvp\M} 2 } } */ ++/* { dg-final { scan-assembler-times {\mxxsetaccz\M} 2 } } */ ++/* { dg-final { scan-assembler-times {\mxxmfacc\M} 2 } } */ ++/* { dg-final { scan-assembler-times {\mstxvp\M} 4 } } */ new file mode 100644 --- /dev/null +++ b/src/gcc/testsuite/gcc.target/powerpc/mma-builtin-7.c @@ -22777,6 +25066,297 @@ +} new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr102976.c +@@ -0,0 +1,14 @@ ++/* { dg-require-effective-target power10_ok } */ ++/* { dg-options "-O2 -mdejagnu-cpu=power10" } */ ++ ++#include ++void ++bug (__vector_pair *dst) ++{ ++ register vector unsigned char vec0 asm ("vs44"); ++ register vector unsigned char vec1 asm ("vs32"); ++ __builtin_vsx_build_pair (dst, vec0, vec1); ++} ++ ++/* { dg-final { scan-assembler-times {(?p)\mxxlor \d+,44,44\M} 1 } } */ ++/* { dg-final { scan-assembler-times {(?p)\mxxlor \d+,32,32\M} 1 } } */ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr103627-1.c +@@ -0,0 +1,16 @@ ++/* { dg-require-effective-target power10_ok } */ ++/* { dg-options "-mdejagnu-cpu=power10 -mno-vsx" } */ ++ ++/* Verify compiler emits error message instead of ICE. */ ++ ++extern float *dest; ++extern __vector_quad src; ++ ++int ++foo () ++{ ++ __builtin_mma_disassemble_acc (dest, &src); ++ /* { dg-error "'__builtin_mma_disassemble_acc' requires the '-mmma' option" "" { target *-*-* } .-1 } */ ++ return 0; ++} ++ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr103627-2.c +@@ -0,0 +1,16 @@ ++/* { dg-require-effective-target power10_ok } */ ++/* { dg-options "-mdejagnu-cpu=power10 -mmma -mno-vsx" } */ ++ ++/* Verify the emitted error message. */ ++ ++extern float *dest; ++extern __vector_quad src; ++ ++int ++foo () ++{ ++ __builtin_mma_disassemble_acc (dest, &src); ++ /* { dg-error "'-mmma' requires '-mvsx'" "mma" { target *-*-* } 0 } */ ++ return 0; ++} ++ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr103627-3.c +@@ -0,0 +1,20 @@ ++/* There are no error messages for either LE or BE 64bit. */ ++/* { dg-require-effective-target be } */ ++/* { dg-require-effective-target ilp32 } */ ++/* { dg-options "-mdejagnu-cpu=power6" } */ ++ ++/* Verify compiler emits error message instead of ICE. */ ++ ++/* Option -mno-avoid-indexed-addresses is to disable the unexpected ++ warning on indexed addressing which can affect dg checks. */ ++#pragma GCC target "cpu=power10,no-avoid-indexed-addresses" ++int ++main () ++{ ++ float *b; ++ __vector_quad c; ++ __builtin_mma_disassemble_acc (b, &c); ++ /* { dg-error "'__builtin_mma_disassemble_acc' requires the '-mmma' option" "" { target *-*-* } .-1 } */ ++ return 0; ++} ++ +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr104208-1.c +@@ -0,0 +1,9 @@ ++/* PR target/104208 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mlong-double-128 -mabi=ibmlongdouble -mlong-double-64 -Wno-psabi" } */ ++ ++/* Verify we do not emit an error with the options above. It is allowed ++ to reset the long double size to 64-bits after a 128-bit long double ++ ABI has been selected. */ ++ ++int i; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr104208-2.c +@@ -0,0 +1,10 @@ ++/* PR target/104208 */ ++/* { dg-do compile } */ ++/* { dg-options "-O2 -mlong-double-128 -mabi=ieeelongdouble -mlong-double-64 -mno-vsx -Wno-psabi" } */ ++ ++/* Verify we do not emit an error with the options above. IEEE 128-bit ++ long double requires VSX, so using -mno-vsx would normally generate ++ an error. However, if we have changed to a 64-bit long double, then ++ we should allow it. */ ++ ++int i; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr104253.c +@@ -0,0 +1,156 @@ ++/* ++ * Require float128 support because __ibm128 currently is not enabled unless we ++ * also have __float128 support. We require software IEEE 128-bit support, ++ * which will work on power8. If we have hardware IEEE 128-bit support (power9 ++ * or power10), ppc_float128_sw will still enable running the test. ++ */ ++ ++/* { dg-do run } */ ++/* { require-effective-target ppc_float128_sw } */ ++/* { dg-options "-O2 -mvsx -mfloat128" } */ ++ ++/* ++ * PR target/104253 ++ * ++ * Verify that the various conversions to and from __ibm128 work. When the ++ * default for long double is changed to IEEE 128-bit, originally GCC would ++ * call the functions using an 'if' name instead of 'tf' name. ++ */ ++ ++#include ++ ++extern float ibm128_to_sf (__ibm128) __attribute__((noinline)); ++extern double ibm128_to_df (__ibm128) __attribute__((noinline)); ++extern int ibm128_to_si (__ibm128) __attribute__((noinline)); ++extern long long ibm128_to_di (__ibm128) __attribute__((noinline)); ++extern unsigned int ibm128_to_usi (__ibm128) __attribute__((noinline)); ++extern unsigned long long ibm128_to_udi (__ibm128) __attribute__((noinline)); ++ ++extern __ibm128 sf_to_ibm128 (float) __attribute__((noinline)); ++extern __ibm128 df_to_ibm128 (double) __attribute__((noinline)); ++extern __ibm128 si_to_ibm128 (int) __attribute__((noinline)); ++extern __ibm128 di_to_ibm128 (long long) __attribute__((noinline)); ++extern __ibm128 usi_to_ibm128 (unsigned int) __attribute__((noinline)); ++extern __ibm128 udi_to_ibm128 (unsigned long long) __attribute__((noinline)); ++ ++float ++ibm128_to_sf (__ibm128 x) ++{ ++ return x; ++} ++ ++double ++ibm128_to_df (__ibm128 x) ++{ ++ return x; ++} ++ ++int ++ibm128_to_si (__ibm128 x) ++{ ++ return x; ++} ++ ++long long ++ibm128_to_di (__ibm128 x) ++{ ++ return x; ++} ++ ++unsigned int ++ibm128_to_usi (__ibm128 x) ++{ ++ return x; ++} ++ ++unsigned long long ++ibm128_to_udi (__ibm128 x) ++{ ++ return x; ++} ++ ++__ibm128 ++sf_to_ibm128 (float x) ++{ ++ return x; ++} ++ ++__ibm128 ++df_to_ibm128 (double x) ++{ ++ return x; ++} ++ ++__ibm128 ++si_to_ibm128 (int x) ++{ ++ return x; ++} ++ ++__ibm128 ++di_to_ibm128 (long long x) ++{ ++ return x; ++} ++ ++__ibm128 ++usi_to_ibm128 (unsigned int x) ++{ ++ return x; ++} ++ ++__ibm128 ++udi_to_ibm128 (unsigned long long x) ++{ ++ return x; ++} ++ ++volatile float seven_sf = 7.0f; ++volatile double seven_df = 7.0; ++volatile int seven_si = 7; ++volatile long long seven_di = 7LL; ++volatile unsigned int seven_usi = 7U; ++volatile unsigned long long seven_udi = 7ULL; ++volatile __ibm128 seven_ibm128 = 7.0; ++ ++int ++main (void) ++{ ++ if (seven_ibm128 != sf_to_ibm128 (seven_sf)) ++ abort (); ++ ++ if (seven_ibm128 != df_to_ibm128 (seven_df)) ++ abort (); ++ ++ if (seven_ibm128 != si_to_ibm128 (seven_si)) ++ abort (); ++ ++ if (seven_ibm128 != di_to_ibm128 (seven_di)) ++ abort (); ++ ++ if (seven_ibm128 != usi_to_ibm128 (seven_usi)) ++ abort (); ++ ++ if (seven_ibm128 != udi_to_ibm128 (seven_udi)) ++ abort (); ++ ++ if (seven_sf != ibm128_to_sf (seven_ibm128)) ++ abort (); ++ ++ if (seven_df != ibm128_to_df (seven_ibm128)) ++ abort (); ++ ++ if (seven_si != ibm128_to_si (seven_ibm128)) ++ abort (); ++ ++ if (seven_di != ibm128_to_di (seven_ibm128)) ++ abort (); ++ ++ if (seven_usi != ibm128_to_usi (seven_ibm128)) ++ abort (); ++ ++ if (seven_udi != ibm128_to_udi (seven_ibm128)) ++ abort (); ++ ++ return 0; ++} +--- a/src/gcc/testsuite/gcc.target/powerpc/pr87496-2.c ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr87496-2.c +@@ -1,7 +1,7 @@ + /* PR target/87496 */ + /* { dg-do compile { target { powerpc*-*-* } } } */ + /* { dg-skip-if "" { powerpc*-*-darwin* } } */ +-/* { dg-options "-O2 -mdejagnu-cpu=power7 -mabi=ieeelongdouble -mlong-double-64 -Wno-psabi" } */ ++/* { dg-options "-O2 -mdejagnu-cpu=power7 -mlong-double-64 -mabi=ieeelongdouble -Wno-psabi" } */ + + int i; + +--- a/src/gcc/testsuite/gcc.target/powerpc/pr87496-3.c ++++ b/src/gcc/testsuite/gcc.target/powerpc/pr87496-3.c +@@ -1,7 +1,7 @@ + /* PR target/87496 */ + /* { dg-do compile { target { powerpc*-*-* } } } */ + /* { dg-skip-if "" { powerpc*-*-darwin* } } */ +-/* { dg-options "-O2 -mabi=ibmlongdouble -mlong-double-64 -Wno-psabi" } */ ++/* { dg-options "-O2 -mlong-double-64 -mabi=ibmlongdouble -Wno-psabi" } */ + + int i; + +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gcc.target/powerpc/pr97142.c @@ -0,0 +1,35 @@ +/* { dg-do compile } */ @@ -24548,6 +27128,38 @@ character (len=3), parameter :: str3(2) = [ "ABC", "ZYX" ] new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/derived_constructor_comps_7.f90 +@@ -0,0 +1,28 @@ ++! { dg-do run } ++! PR fortran/104619 ++ ++module m ++ implicit none ++ type :: item ++ real :: x ++ end type item ++ type :: container ++ type(item) :: items(3) ++ end type container ++end module ++ ++program p ++ use m ++ implicit none ++ type(item), allocatable :: items(:) ++ type(container) :: c ++ integer :: i, n ++ items = [item(3.0), item(4.0), item(5.0)] ++ c = container(items=[(items(i), i = 1, size(items))]) ++ if (any (c%items% x /= items% x)) stop 1 ++ n = size (items) ++ c = container(items=[(items(i), i = 1, n)]) ++ if (any (c%items% x /= items% x)) stop 2 ++ c = container(items=[(items(i), i = 1, 3)]) ++ if (any (c%items% x /= items% x)) stop 3 ++end program +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/do_check_19.f90 @@ -0,0 +1,21 @@ +! { dg-do compile } @@ -24623,6 +27235,18 @@ + new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/eoshift_9.f90 +@@ -0,0 +1,8 @@ ++! { dg-do compile } ++! PR fortran/104331 - ICE in gfc_simplify_eoshift ++! Contributed by G.Steinmetz ++ ++program p ++ character(3), parameter :: a(:) = ['123'] ! { dg-error "deferred shape" } ++ character(3), parameter :: b(*) = eoshift(a, 1) ++end +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/fmt_nonchar_3.f90 @@ -0,0 +1,7 @@ +! { dg-do compile } @@ -24813,6 +27437,37 @@ call move_alloc (px%a, a) ! OK (7) new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/overload_4.f90 +@@ -0,0 +1,27 @@ ++! { dg-do run } ++! { dg-additional-options "-Wno-intrinsic-shadow" } ++! PR fortran/103782 - ICE overloading an intrinsic like dble or real ++! Contributed by Urban Jost ++ ++program runtest ++ implicit none ++ interface dble ++ procedure to_double ++ end interface dble ++ interface real ++ procedure floor ! not really FLOOR... ++ end interface real ++ if (any (dble ([10.0d0,20.0d0]) - [10.0d0,20.0d0] /= 0.d0)) stop 1 ++ if (any (real ([1.5,2.5]) - [1.5,2.5] /= 0.0 )) stop 2 ++contains ++ elemental function to_double (valuein) result(d_out) ++ doubleprecision,intent(in) :: valuein ++ doubleprecision :: d_out ++ d_out=valuein ++ end function to_double ++ elemental function floor (valuein) result(d_out) ! not really FLOOR... ++ real, intent(in) :: valuein ++ real :: d_out ++ d_out=valuein ++ end function floor ++end program runtest +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/parameter_array_init_8.f90 @@ -0,0 +1,25 @@ +! { dg-do run } @@ -25004,6 +27659,35 @@ +end new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr101158.f90 +@@ -0,0 +1,25 @@ ++! { dg-do compile } ++! { dg-options "-O1 -ftree-slp-vectorize -fwrapv" } ++! { dg-additional-options "-march=armv8-a+sve" { target aarch64-*-* } } ++ ++subroutine sprpl5 (left) ++ implicit none ++ ++ integer :: left ++ integer :: avail1, avail2, delx1, delx2, i2, ic ++ ++ ic = left ++ delx1 = ic / 2 ++ delx2 = delx1 + 1 ++ i2 = ic + delx2 ++ avail1 = i2 ++ avail2 = 1 ++ ++ do delx1 = 1, 2 ++ ic = left + nint (real (left) / 2) ++ if (ic .ge. avail1) avail1 = ic + 1 ++ ++ i2 = ic + delx2 ++ if (i2 .le. avail2) avail2 = i2 + 1 ++ end do ++end subroutine sprpl5 +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr101327.f90 @@ -0,0 +1,11 @@ +! { dg-do compile } @@ -25112,6 +27796,106 @@ +end new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr101762.f90 +@@ -0,0 +1,23 @@ ++! { dg-do compile } ++! PR fortran/101762 - ICE on non-constant pointer initialization targets ++! Contributed by G.Steinmetz ++ ++program p ++ integer, target :: a(3) = [7, 8, 9] ++ integer, pointer :: x => a(3) ++ integer, pointer :: y => a(n()) ! { dg-error "constant expression" } ++ integer, pointer :: z(:) => a(:n()) ! { dg-error "constant expression" } ++ character(7), target :: c = "abcdefg" ++ character(3), pointer :: c0 => c(2:4) ++ character(3), pointer :: c1 => c(m():) ! { dg-error "constant expression" } ++ character(3), pointer :: c2 => c(:m()) ! { dg-error "constant expression" } ++ print *, x, y ++contains ++ pure integer function k () ++ k = 2 ++ end function k ++ subroutine s () ++ integer, pointer :: yy => a(k()) ! { dg-error "constant expression" } ++ print *, yy ++ end subroutine s ++end +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr102332.f90 +@@ -0,0 +1,69 @@ ++! { dg-do compile } ++! PR fortran/102332 - ICE in select_type_set_tmp ++! Contributed by G.Steinmetz ++ ++program p ++ type t ++ real :: a, b ++ end type ++ class(t), allocatable :: x ! Valid ++ select type (y => x) ++ type is (t) ++ y%a = 0 ++ end select ++end ++ ++subroutine s0 (x) ++ type t ++ real :: a, b ++ end type ++ class(t) :: x ! Valid ++ select type (y => x) ++ type is (t) ++ y%a = 0 ++ end select ++end ++ ++subroutine s1 ++ type t ++ real :: a, b ++ end type ++ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" } ++ select type (y => x) ++ type is (t) ++ y%a = 0 ++ end select ++end ++ ++subroutine s3 ++ type t ++ real :: a, b ++ end type ++ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" } ++ select type (y => x) ++ class is (t) ++ y%a = 0 ++ end select ++end ++ ++subroutine s2 ++ type t ++ real :: a, b ++ end type ++ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" } ++ select type (y => x) ++ type default ! { dg-error "Expected" } ++ y%a = 0 ++ end select ++end ++ ++subroutine s4 ++ type t ++ real :: a, b ++ end type ++ class(t) :: x ! { dg-error "must be dummy, allocatable or pointer" } ++ select type (y => x) ++ class default ++ y%a = 0 ++ end select ++end +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr102366.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } @@ -25197,7 +27981,7 @@ new file mode 100644 --- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr102520.f90 -@@ -0,0 +1,12 @@ +@@ -0,0 +1,10 @@ +! { dg-do compile } +! PR fortran/102520 - ICE in expand_constructor, at fortran/array.c:1802 + @@ -25205,11 +27989,9 @@ + type t + end type + type(t), parameter :: a(4) = shape(1) ! { dg-error "Incompatible" } -+ type(t), parameter :: b(2,2) = reshape(a,[2,2]) ! { dg-error "Incompatible" } -+ type(t), parameter :: c(2,2) = transpose(b) ! { dg-error "Unclassifiable" } ++ type(t), parameter :: b(2,2) = reshape(a,[2,2]) ! { dg-error "must be an array" } ++ type(t), parameter :: c(2,2) = transpose(b) ! { dg-error "must be of rank 2" } +end -+ -+! { dg-error "Different shape for array assignment" " " { target *-*-* } 7 } new file mode 100644 --- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr102685.f90 @@ -25354,6 +28136,33 @@ +! { dg-prune-output "must have constant shape" } new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr103692.f90 +@@ -0,0 +1,23 @@ ++! { dg-do compile } ++! { dg-options "-fdump-tree-original" } ++! PR fortran/103692 - ICE in expand_constructor ++! Contributed by G.Steinmetz ++ ++program p ++ character(3), parameter :: a(4) = 'abc' ++ character(*), parameter :: b(*) = (a(2:1)) ++ character(*), parameter :: y(*) = [(a(2:1))] ++ character(*), parameter :: u(*) = a(2:1) ++ character(*), parameter :: v(*) = [a(2:1)] ++ character(*), parameter :: w(-1) = (a(2:1)) ++ character(*), parameter :: x(-1) = a(2:1) ++ character(5), parameter :: c(3,3) = 'def' ++ character(*), parameter :: d(*) = [(c(2:1,2:))] ++ character(*), parameter :: e(*,*) = (c(2:1,2:)) ++ if (len(b) /= 3 .or. size (b) /= 0) stop 1 ++ if (len(y) /= 3 .or. size (y) /= 0) stop 2 ++ if (len(d) /= 5 .or. size (d) /= 0) stop 3 ++ if (len(e) /= 5 .or. any (shape (e) /= [0,2])) stop 4 ++end ++ ++! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "original" } } +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr63797.f90 @@ -0,0 +1,60 @@ +! { dg-do compile } @@ -25416,6 +28225,35 @@ + y% a = sqrt (x% a) + z - w + root (x% a) + y% a = real_root (x% a) +end program test +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/pr67804.f90 +@@ -0,0 +1,25 @@ ++! { dg-do compile } ++! PR fortran/67804 - ICE on bad type in structure constructor in DATA statement ++! Contributed by G.Steinmetz ++ ++program p ++ type t ++ character :: c ++ end type ++ type u ++ character, pointer :: c ++ end type ++ type(t) :: x0, x1, x2, x3, x4, x5, x6, x7, x8, x9 ++ type(u) :: y6 ++ data x0 /t('a')/ ! OK ++ data x1 /t(1)/ ! { dg-error "Cannot convert" } ++ data x2 /t(1.)/ ! { dg-error "Cannot convert" } ++ data x3 /t(1d1)/ ! { dg-error "Cannot convert" } ++ data x4 /t((0.,1.))/ ! { dg-error "Cannot convert" } ++ data x5 /t(.true.)/ ! { dg-error "Cannot convert" } ++ data x6 /t(null())/ ! { dg-error "neither a POINTER nor ALLOCATABLE" } ++ data x7 /t(['1'])/ ! { dg-error "The rank of the element" } ++ data x8 /t([1])/ ! { dg-error "Cannot convert" } ++ data x9 /t(z'0')/ ! { dg-error "Cannot convert" } ++ data y6 /u(null())/ ! OK ++end --- a/src/gcc/testsuite/gfortran.dg/pr68019.f90 +++ b/src/gcc/testsuite/gfortran.dg/pr68019.f90 @@ -9,5 +9,5 @@ program p @@ -25460,6 +28298,16 @@ + integer, parameter :: u = ubound (karray,1) + if (l /= 3 .or. u /= 7 .or. i /= 5) stop 1 +end +--- a/src/gcc/testsuite/gfortran.dg/pr93604.f90 ++++ b/src/gcc/testsuite/gfortran.dg/pr93604.f90 +@@ -5,6 +5,6 @@ program p + integer :: a + end type + type(t) :: x +- data x /t(z'1')/ ! { dg-error "cannot appear in a structure constructor" } ++ data x /t(z'1')/ ! { dg-error "BOZ" } + end + new file mode 100644 --- /dev/null +++ b/src/gcc/testsuite/gfortran.dg/pr95502.f90 @@ -25741,6 +28589,202 @@ c = (/ c0(1)(1:5) /) do i=1,5 if (c(1)(i:i) /= c1(i)) STOP 2 +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/transfer_char_kind4.f90 +@@ -0,0 +1,115 @@ ++! { dg-do run } ++! PR fortran/83079 - ICE and wrong code with TRANSFER and character(kind=4) ++! Exercise TRANSFER intrinsic to check character result length and shape ++ ++program p ++ implicit none ++ character(len=*,kind=4), parameter :: a = 4_'ABCDEF' ++ character(len=6,kind=4) :: b = 4_'abcdef' ++ character(len=*,kind=4), parameter :: c = 4_'XY' ++ character(len=2,kind=4) :: d = 4_'xy' ++ integer :: k, l ++ k = len (a) ++ l = len (c) ++ ++! print *, transfer(4_'xy', [4_'a']) ++ ++ ! TRANSFER with rank-0 result ++ call chk0 (transfer (4_'ABCD', 4_'XY'), 2, 1) ++ call chk0 (transfer (4_'ABCD', c ), l, 2) ++ call chk0 (transfer (4_'ABCD', d ), l, 3) ++ call chk0 (transfer (a , 4_'XY'), 2, 4) ++ call chk0 (transfer (a , c ), l, 5) ++ call chk0 (transfer (a , d ), l, 6) ++ call chk0 (transfer (b , 4_'XY'), 2, 7) ++ call chk0 (transfer (b , c ), l, 8) ++ call chk0 (transfer (b , d ), l, 9) ++ ++ call chk0 (transfer ([4_'ABCD'], 4_'XY'), 2, 11) ++ call chk0 (transfer ([4_'ABCD'], c ), l, 12) ++ call chk0 (transfer ([4_'ABCD'], d ), l, 13) ++ call chk0 (transfer ([a ], 4_'XY'), 2, 14) ++ call chk0 (transfer ([a ], c ), l, 15) ++ call chk0 (transfer ([a ], d ), l, 16) ++ call chk0 (transfer ([b ], 4_'XY'), 2, 17) ++ call chk0 (transfer ([b ], c ), l, 18) ++ call chk0 (transfer ([b ], d ), l, 19) ++ ++ ! TRANSFER with rank-1 result ++ call chk1 (transfer (4_'ABCD', [4_'XY']), 2, 2, 21) ++ call chk1 (transfer (4_'ABCD', [c] ), 2, 2, 22) ++ call chk1 (transfer (4_'ABCD', [d] ), 2, 2, 23) ++ call chk1 (transfer (a , [4_'XY']), 2, k/2, 24) ++ call chk1 (transfer (a , [c] ), l, k/l, 25) ++ call chk1 (transfer (a , [d] ), l, k/l, 26) ++ call chk1 (transfer (b , [4_'XY']), 2, k/2, 27) ++ call chk1 (transfer (b , [c] ), l, k/l, 28) ++ call chk1 (transfer (b , [d] ), l, k/l, 29) ++ ++ call chk1 (transfer (4_'ABCD', 4_'XY',size=2), 2, 2, 31) ++ call chk1 (transfer (4_'ABCD', c ,size=2), 2, 2, 32) ++ call chk1 (transfer (4_'ABCD', d ,size=2), 2, 2, 33) ++ call chk1 (transfer (a , 4_'XY',size=3), 2, 3, 34) ++ call chk1 (transfer (a , c ,size=3), l, 3, 35) ++ call chk1 (transfer (a , d ,size=3), l, 3, 36) ++ call chk1 (transfer (b , 4_'XY',size=3), 2, 3, 37) ++ call chk1 (transfer (b , c ,size=3), l, 3, 38) ++ call chk1 (transfer (b , d ,size=3), l, 3, 39) ++ ++ call chk1 (transfer (4_'ABCD', [4_'XY'],size=2), 2, 2, 41) ++ call chk1 (transfer (4_'ABCD', [c] ,size=2), 2, 2, 42) ++ call chk1 (transfer (4_'ABCD', [d] ,size=2), 2, 2, 43) ++ call chk1 (transfer (a , [4_'XY'],size=3), 2, 3, 44) ++ call chk1 (transfer (a , [c] ,size=3), l, 3, 45) ++ call chk1 (transfer (a , [d] ,size=3), l, 3, 46) ++ call chk1 (transfer (b , [4_'XY'],size=3), 2, 3, 47) ++ call chk1 (transfer (b , [c] ,size=3), l, 3, 48) ++ call chk1 (transfer (b , [d] ,size=3), l, 3, 49) ++ ++ call chk1 (transfer ([4_'ABCD'], [4_'XY']), 2, 2, 51) ++ call chk1 (transfer ([4_'ABCD'], [c] ), 2, 2, 52) ++ call chk1 (transfer ([4_'ABCD'], [d] ), 2, 2, 53) ++ call chk1 (transfer ([a ], [4_'XY']), 2, k/2, 54) ++ call chk1 (transfer ([a ], [c] ), l, k/l, 55) ++ call chk1 (transfer ([a ], [d] ), l, k/l, 56) ++ call chk1 (transfer ([b ], [4_'XY']), 2, k/2, 57) ++ call chk1 (transfer ([b ], [c] ), l, k/l, 58) ++ call chk1 (transfer ([b ], [d] ), l, k/l, 59) ++ ++ call chk1 (transfer (4_'ABCD', c ,size=4/l), l, 4/l, 62) ++ call chk1 (transfer (4_'ABCD', d ,size=4/l), l, 4/l, 63) ++ call chk1 (transfer (a , 4_'XY',size=k/2), 2, k/2, 64) ++ call chk1 (transfer (a , c ,size=k/l), l, k/l, 65) ++ call chk1 (transfer (a , d ,size=k/l), l, k/l, 66) ++ call chk1 (transfer (b , 4_'XY',size=k/2), 2, k/2, 67) ++ call chk1 (transfer (b , c ,size=k/l), l, k/l, 68) ++ call chk1 (transfer (b , d ,size=k/l), l, k/l, 69) ++ ++contains ++ ! Validate rank-0 result ++ subroutine chk0 (str, l, stopcode) ++ character(kind=4,len=*), intent(in) :: str ++ integer, intent(in) :: l, stopcode ++ integer :: i, p ++ i = len (str) ++ p = verify (str, a // b) ! Check for junk characters ++ if (i /= l .or. p > 0) then ++ print *, stopcode, "len=", i, i == l, ">", str, "<" ++ stop stopcode ++ end if ++ end subroutine chk0 ++ ++ ! Validate rank-1 result ++ subroutine chk1 (str, l, m, stopcode) ++ character(kind=4,len=*), intent(in) :: str(:) ++ integer, intent(in) :: l, m, stopcode ++ integer :: i, j, p ++ i = len (str) ++ j = size (str) ++ p = maxval (verify (str, a // b)) ! Check for junk characters ++ if (i /= l .or. j /= m .or. p > 0) then ++ print *, stopcode, "len=", i, i == l, "size=", j, j == m, ">", str, "<" ++ stop stopcode ++ end if ++ end subroutine chk1 ++end +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/transfer_check_6.f90 +@@ -0,0 +1,11 @@ ++! { dg-do compile } ++! PR fortran/104227 - ICE virtual memory exhausted ++! Contributed by G.Steinmetz ++ ++program p ++ type t ++ end type ++ type(t) :: x(2) ++ print *, transfer(1, x) ! { dg-error "shall not have storage size 0" } ++ x = transfer(1, x) ! { dg-error "shall not have storage size 0" } ++end +--- a/src/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90 ++++ b/src/gcc/testsuite/gfortran.dg/transfer_simplify_11.f90 +@@ -4,5 +4,5 @@ + integer, parameter :: N = 2 + character(len=1) :: chr(N) + chr = transfer(repeat("x",ncopies=N),[character(len=1) ::], N) +- if (chr(1) /= 'x' .and. chr(2) /= 'x') STOP 1 ++ if (chr(1) /= 'x' .or. chr(2) /= 'x') STOP 1 + end +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/transfer_simplify_13.f90 +@@ -0,0 +1,34 @@ ++! { dg-do compile } ++! { dg-options "-fdump-tree-original" } ++! PR fortran/104127 - ICE in get_array_charlen ++! Contributed by G.Steinmetz ++ ++program p ++ character(4) :: mold = "XYZ" ++ integer :: i = 0 ++ integer, parameter :: l1 = len (transfer('ab', 'xyz', size=0)) ++ integer, parameter :: s1 = size (transfer('ab', 'xyz', size=0)) ++ integer, parameter :: l4 = len (transfer(4_'abcd', 4_'xy', size=0)) ++ integer, parameter :: s4 = size (transfer(4_'abcd', 4_'xy', size=0)) ++ integer, parameter :: l2 = len (transfer('ab', mold, size=0)) ++ integer, parameter :: l3 = len (transfer('ab', mold, size=1)) ++ integer, parameter :: l5 = len (transfer('ab',['xyz'], size=0)) ++ integer, parameter :: s5 = size (transfer('ab',['xyz'], size=0)) ++ call sub0 ( transfer('a', 'y', size=0) ) ++ call sub1 ([transfer('a', 'y', size=0)]) ++ call sub2 ([transfer('a',['y'],size=0)]) ++ call sub3 ( transfer('a', 'y', size=1) ) ++ call sub4 ([transfer('a', 'y', size=1)]) ++ call sub5 ( transfer('a', 'y', size=i) ) ++ call sub6 ( transfer(1_'abcd', 1_'xy' , size=0)) ++ call sub7 ( transfer(1_'abcd',[1_'xy'], size=0)) ++ call sub8 ( transfer(4_'abcd', 4_'xy' , size=0)) ++ call sub9 ( transfer(4_'abcd',[4_'xy'], size=0)) ++ print *, transfer('abcd', 'xy', size=0) ++ if (l1 /= 3 .or. s1 /= 0) stop 1 ++ if (l4 /= 2 .or. s4 /= 0) stop 2 ++ if (l2 /= 4 .or. l3 /= 4) stop 3 ++ if (l5 /= 3 .or. s5 /= 0) stop 4 ++end ++ ++! { dg-final { scan-tree-dump-not "_gfortran_stop_numeric" "original" } } +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gfortran.dg/transfer_simplify_15.f90 +@@ -0,0 +1,11 @@ ++! { dg-do compile } ++! PR fortran/104311 - ICE out of memory ++! Contributed by G.Steinmetz ++ ++program p ++ type t ++ end type ++ type(t) :: x(2) ++ print *, transfer(1,x,2) ! { dg-error "shall not have storage size 0" } ++ print *, transfer(1,x,huge(1)) ! { dg-error "shall not have storage size 0" } ++end --- a/src/gcc/testsuite/gfortran.dg/transfer_simplify_2.f90 +++ b/src/gcc/testsuite/gfortran.dg/transfer_simplify_2.f90 @@ -145,7 +145,7 @@ contains @@ -25784,6 +28828,24 @@ +end Derived_Type7; new file mode 100644 --- /dev/null ++++ b/src/gcc/testsuite/gnat.dg/lto25.adb +@@ -0,0 +1,14 @@ ++-- { dg-do run } ++-- { dg-options "-O2 -flto" { target lto } } ++ ++with Opt96_Pkg; use Opt96_Pkg; ++ ++procedure Lto25 is ++ R : Rec; ++ D : Data; ++begin ++ D.Foo.Bar := (0.02, 0.01); ++ if R.F (D) /= 30 then ++ raise Program_Error; ++ end if; ++end; +new file mode 100644 +--- /dev/null +++ b/src/gcc/testsuite/gnat.dg/opt92.adb @@ -0,0 +1,38 @@ +-- { dg-do compile { target { lp64 || llp64 } } } @@ -25824,6 +28886,80 @@ +begin + Compute (B); +end; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gnat.dg/opt96.adb +@@ -0,0 +1,14 @@ ++-- { dg-do run } ++-- { dg-options "-O2" } ++ ++with Opt96_Pkg; use Opt96_Pkg; ++ ++procedure Opt96 is ++ R : Rec; ++ D : Data; ++begin ++ D.Foo.Bar := (0.02, 0.01); ++ if R.F (D) /= 30 then ++ raise Program_Error; ++ end if; ++end; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gnat.dg/opt96_pkg.adb +@@ -0,0 +1,16 @@ ++package body Opt96_Pkg is ++ ++ function F (D : Data) return Integer is ++ X : constant Long_Float := Long_Float (D.Foo.Bar.X); ++ Y : constant Long_Float := Long_Float (D.Foo.Bar.Y); ++ begin ++ return Integer ((X * 1000.0) + (Y * 1000.0)); ++ end; ++ ++ function F (Self : Rec; D : Data'Class) return Integer is ++ Base_Data : constant Data := Data (D); ++ begin ++ return F (Base_Data); ++ end; ++ ++end Opt96_Pkg; +new file mode 100644 +--- /dev/null ++++ b/src/gcc/testsuite/gnat.dg/opt96_pkg.ads +@@ -0,0 +1,32 @@ ++with System; ++ ++package Opt96_Pkg is ++ ++ type Baz_Type is delta (1.0 / 2.0**16) range 0.0 .. 1.0 - (1.0 / 2.0**16); ++ for Baz_Type'Small use (1.0 / 2.0**16); ++ for Baz_Type'Size use 16; ++ ++ type Bar_Type is record ++ X : Baz_Type; ++ Y : Baz_Type; ++ end record; ++ for Bar_Type use record ++ X at 0 range 0 .. 15; ++ Y at 2 range 0 .. 15; ++ end record; ++ for Bar_Type'Bit_Order use System.High_Order_First; ++ for Bar_Type'Scalar_Storage_Order use System.High_Order_First; ++ ++ type Foo_Type is record ++ Bar : Bar_Type; ++ end record; ++ ++ type Data is tagged record ++ Foo : Foo_Type; ++ end record; ++ ++ type Rec is tagged null record; ++ ++ function F (Self : Rec; D : Data'Class) return Integer; ++ ++end Opt96_Pkg; --- a/src/gcc/testsuite/gnat.dg/unchecked_convert5.adb +++ b/src/gcc/testsuite/gnat.dg/unchecked_convert5.adb @@ -1,4 +1,4 @@ @@ -26203,9 +29339,67 @@ print_gimple_stmt (dump_file, DR_STMT (drb), 0, TDF_SLIM); } +--- a/src/gcc/tree-eh.c ++++ b/src/gcc/tree-eh.c +@@ -2462,13 +2462,35 @@ operation_could_trap_helper_p (enum tree_code op, + case FLOOR_MOD_EXPR: + case ROUND_MOD_EXPR: + case TRUNC_MOD_EXPR: +- case RDIV_EXPR: +- if (honor_snans) +- return true; +- if (fp_operation) +- return flag_trapping_math; + if (!TREE_CONSTANT (divisor) || integer_zerop (divisor)) + return true; ++ if (TREE_CODE (divisor) == VECTOR_CST) ++ { ++ /* Inspired by initializer_each_zero_or_onep. */ ++ unsigned HOST_WIDE_INT nelts = vector_cst_encoded_nelts (divisor); ++ if (VECTOR_CST_STEPPED_P (divisor) ++ && !TYPE_VECTOR_SUBPARTS (TREE_TYPE (divisor)) ++ .is_constant (&nelts)) ++ return true; ++ for (unsigned int i = 0; i < nelts; ++i) ++ { ++ tree elt = vector_cst_elt (divisor, i); ++ if (integer_zerop (elt)) ++ return true; ++ } ++ } ++ return false; ++ ++ case RDIV_EXPR: ++ if (fp_operation) ++ { ++ if (honor_snans) ++ return true; ++ return flag_trapping_math; ++ } ++ /* Fixed point operations also use RDIV_EXPR. */ ++ if (!TREE_CONSTANT (divisor) || fixed_zerop (divisor)) ++ return true; + return false; + + case LT_EXPR: --- a/src/gcc/tree-inline.c +++ b/src/gcc/tree-inline.c -@@ -2132,6 +2132,7 @@ copy_bb (copy_body_data *id, basic_block bb, +@@ -2105,7 +2105,13 @@ copy_bb (copy_body_data *id, basic_block bb, + size_t n; + + for (p = DECL_ARGUMENTS (id->src_fn); p; p = DECL_CHAIN (p)) +- nargs--; ++ { ++ /* Avoid crashing on invalid IL that doesn't have a ++ varargs function or that passes not enough arguments. */ ++ if (nargs == 0) ++ break; ++ nargs--; ++ } + + /* Create the new array of arguments. */ + n = nargs + gimple_call_num_args (call_stmt); +@@ -2132,6 +2138,7 @@ copy_bb (copy_body_data *id, basic_block bb, GF_CALL_VA_ARG_PACK. */ gimple_call_copy_flags (new_call, call_stmt); gimple_call_set_va_arg_pack (new_call, false); @@ -26328,6 +29522,24 @@ /* Initialize the value-handle array. */ threadedge_initialize_values (); +--- a/src/gcc/tree-ssa-forwprop.c ++++ b/src/gcc/tree-ssa-forwprop.c +@@ -2403,6 +2403,15 @@ simplify_vector_constructor (gimple_stmt_iterator *gsi) + ? VEC_UNPACK_FLOAT_HI_EXPR + : VEC_UNPACK_HI_EXPR); + ++ /* Conversions between DFP and FP have no special tree code ++ but we cannot handle those since all relevant vector conversion ++ optabs only have a single mode. */ ++ if (CONVERT_EXPR_CODE_P (conv_code) ++ && FLOAT_TYPE_P (TREE_TYPE (type)) ++ && (DECIMAL_FLOAT_TYPE_P (TREE_TYPE (type)) ++ != DECIMAL_FLOAT_TYPE_P (TREE_TYPE (conv_src_type)))) ++ return false; ++ + if (CONVERT_EXPR_CODE_P (conv_code) + && (2 * TYPE_PRECISION (TREE_TYPE (TREE_TYPE (orig[0]))) + == TYPE_PRECISION (TREE_TYPE (type))) --- a/src/gcc/tree-ssa-phiopt.c +++ b/src/gcc/tree-ssa-phiopt.c @@ -465,6 +465,9 @@ factor_out_conditional_conversion (edge e0, edge e1, gphi *phi, @@ -26412,6 +29624,15 @@ ref->set = set; --- a/src/gcc/tree-ssa-sccvn.c +++ b/src/gcc/tree-ssa-sccvn.c +@@ -492,7 +492,7 @@ vuse_ssa_val (tree x) + return x; + } + +-/* Similar to the above but used as callback for walk_non_aliases_vuses ++/* Similar to the above but used as callback for walk_non_aliased_vuses + and thus should stop at unvisited VUSE to not walk across region + boundaries. */ + @@ -738,6 +738,7 @@ vn_reference_eq (const_vn_reference_t const vr1, const_vn_reference_t const vr2) vn_reference_op_t vro1, vro2; vn_reference_op_s tem1, tem2; @@ -26462,7 +29683,7 @@ } break; case VAR_DECL: -@@ -1518,6 +1527,26 @@ contains_storage_order_barrier_p (vec ops) +@@ -1518,13 +1527,33 @@ contains_storage_order_barrier_p (vec ops) return false; } @@ -26489,7 +29710,93 @@ /* Transform any SSA_NAME's in a vector of vn_reference_op_s structures into their value numbers. This is done in-place, and the vector passed in is returned. *VALUEIZED_ANYTHING will specify -@@ -2835,6 +2864,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, + whether any operands were valueized. */ + +-static vec +-valueize_refs_1 (vec orig, bool *valueized_anything, ++static void ++valueize_refs_1 (vec *orig, bool *valueized_anything, + bool with_avail = false) + { + vn_reference_op_t vro; +@@ -1532,7 +1561,7 @@ valueize_refs_1 (vec orig, bool *valueized_anything, + + *valueized_anything = false; + +- FOR_EACH_VEC_ELT (orig, i, vro) ++ FOR_EACH_VEC_ELT (*orig, i, vro) + { + if (vro->opcode == SSA_NAME + || (vro->op0 && TREE_CODE (vro->op0) == SSA_NAME)) +@@ -1571,16 +1600,16 @@ valueize_refs_1 (vec orig, bool *valueized_anything, + if (i > 0 + && vro->op0 + && TREE_CODE (vro->op0) == ADDR_EXPR +- && orig[i - 1].opcode == MEM_REF) ++ && (*orig)[i - 1].opcode == MEM_REF) + { +- if (vn_reference_fold_indirect (&orig, &i)) ++ if (vn_reference_fold_indirect (orig, &i)) + *valueized_anything = true; + } + else if (i > 0 + && vro->opcode == SSA_NAME +- && orig[i - 1].opcode == MEM_REF) ++ && (*orig)[i - 1].opcode == MEM_REF) + { +- if (vn_reference_maybe_forwprop_address (&orig, &i)) ++ if (vn_reference_maybe_forwprop_address (orig, &i)) + *valueized_anything = true; + } + /* If it transforms a non-constant ARRAY_REF into a constant +@@ -1598,15 +1627,13 @@ valueize_refs_1 (vec orig, bool *valueized_anything, + off.to_shwi (&vro->off); + } + } +- +- return orig; + } + +-static vec +-valueize_refs (vec orig) ++static void ++valueize_refs (vec *orig) + { + bool tem; +- return valueize_refs_1 (orig, &tem); ++ valueize_refs_1 (orig, &tem); + } + + static vec shared_lookup_references; +@@ -1623,8 +1650,7 @@ valueize_shared_reference_ops_from_ref (tree ref, bool *valueized_anything) + return vNULL; + shared_lookup_references.truncate (0); + copy_reference_ops_from_ref (ref, &shared_lookup_references); +- shared_lookup_references = valueize_refs_1 (shared_lookup_references, +- valueized_anything); ++ valueize_refs_1 (&shared_lookup_references, valueized_anything); + return shared_lookup_references; + } + +@@ -1639,7 +1665,7 @@ valueize_shared_reference_ops_from_call (gcall *call) + return vNULL; + shared_lookup_references.truncate (0); + copy_reference_ops_from_call (call, &shared_lookup_references); +- shared_lookup_references = valueize_refs (shared_lookup_references); ++ valueize_refs (&shared_lookup_references); + return shared_lookup_references; + } + +@@ -2490,7 +2516,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, + if (*disambiguate_only <= TR_VALUEIZE_AND_DISAMBIGUATE) + { + copy_reference_ops_from_ref (lhs, &lhs_ops); +- lhs_ops = valueize_refs_1 (lhs_ops, &valueized_anything, true); ++ valueize_refs_1 (&lhs_ops, &valueized_anything, true); + } + vn_context_bb = saved_rpo_bb; + ao_ref_init (&lhs_ref, lhs); +@@ -2835,6 +2861,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, routines to extract the assigned bits. */ else if (known_eq (ref->size, maxsize) && is_gimple_reg_type (vr->type) @@ -26497,7 +29804,7 @@ && !contains_storage_order_barrier_p (vr->operands) && gimple_assign_single_p (def_stmt) && CHAR_BIT == 8 -@@ -2986,6 +3016,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, +@@ -2986,6 +3013,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, to access pieces from or we can combine to a larger entity. */ else if (known_eq (ref->size, maxsize) && is_gimple_reg_type (vr->type) @@ -26505,7 +29812,109 @@ && !contains_storage_order_barrier_p (vr->operands) && gimple_assign_single_p (def_stmt) && TREE_CODE (gimple_assign_rhs1 (def_stmt)) == SSA_NAME) -@@ -4105,7 +4136,7 @@ vn_nary_op_insert_pieces_predicated (unsigned int length, enum tree_code code, +@@ -3167,7 +3195,7 @@ vn_reference_lookup_3 (ao_ref *ref, tree vuse, void *data_, + vr->operands.truncate (i + 1 + rhs.length ()); + FOR_EACH_VEC_ELT (rhs, j, vro) + vr->operands[i + 1 + j] = *vro; +- vr->operands = valueize_refs (vr->operands); ++ valueize_refs (&vr->operands); + if (old == shared_lookup_references) + shared_lookup_references = vr->operands; + vr->hashcode = vn_reference_compute_hash (vr); +@@ -3460,8 +3488,9 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, + operands.address (), + sizeof (vn_reference_op_s) + * operands.length ()); +- vr1.operands = operands = shared_lookup_references +- = valueize_refs (shared_lookup_references); ++ bool valueized_p; ++ valueize_refs_1 (&shared_lookup_references, &valueized_p); ++ vr1.operands = shared_lookup_references; + vr1.type = type; + vr1.set = set; + vr1.base_set = base_set; +@@ -3477,13 +3506,31 @@ vn_reference_lookup_pieces (tree vuse, alias_set_type set, + ao_ref r; + unsigned limit = param_sccvn_max_alias_queries_per_access; + vn_walk_cb_data data (&vr1, NULL_TREE, NULL, kind, true, NULL_TREE); ++ vec ops_for_ref; ++ if (!valueized_p) ++ ops_for_ref = vr1.operands; ++ else ++ { ++ /* For ao_ref_from_mem we have to ensure only available SSA names ++ end up in base and the only convenient way to make this work ++ for PRE is to re-valueize with that in mind. */ ++ ops_for_ref.create (operands.length ()); ++ ops_for_ref.quick_grow (operands.length ()); ++ memcpy (ops_for_ref.address (), ++ operands.address (), ++ sizeof (vn_reference_op_s) ++ * operands.length ()); ++ valueize_refs_1 (&ops_for_ref, &valueized_p, true); ++ } + if (ao_ref_init_from_vn_reference (&r, set, base_set, type, +- vr1.operands)) ++ ops_for_ref)) + *vnresult + = ((vn_reference_t) + walk_non_aliased_vuses (&r, vr1.vuse, true, vn_reference_lookup_2, + vn_reference_lookup_3, vuse_valueize, + limit, &data)); ++ if (ops_for_ref != shared_lookup_references) ++ ops_for_ref.release (); + gcc_checking_assert (vr1.operands == shared_lookup_references); + } + +@@ -3512,14 +3559,14 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, + { + vec operands; + struct vn_reference_s vr1; +- bool valuezied_anything; ++ bool valueized_anything; + + if (vnresult) + *vnresult = NULL; + + vr1.vuse = vuse_ssa_val (vuse); + vr1.operands = operands +- = valueize_shared_reference_ops_from_ref (op, &valuezied_anything); ++ = valueize_shared_reference_ops_from_ref (op, &valueized_anything); + vr1.type = TREE_TYPE (op); + ao_ref op_ref; + ao_ref_init (&op_ref, op); +@@ -3535,11 +3582,18 @@ vn_reference_lookup (tree op, tree vuse, vn_lookup_kind kind, + vn_reference_t wvnresult; + ao_ref r; + unsigned limit = param_sccvn_max_alias_queries_per_access; ++ auto_vec ops_for_ref; ++ if (valueized_anything) ++ { ++ copy_reference_ops_from_ref (op, &ops_for_ref); ++ bool tem; ++ valueize_refs_1 (&ops_for_ref, &tem, true); ++ } + /* Make sure to use a valueized reference if we valueized anything. + Otherwise preserve the full reference for advanced TBAA. */ +- if (!valuezied_anything ++ if (!valueized_anything + || !ao_ref_init_from_vn_reference (&r, vr1.set, vr1.base_set, +- vr1.type, vr1.operands)) ++ vr1.type, ops_for_ref)) + ao_ref_init (&r, op); + vn_walk_cb_data data (&vr1, r.ref ? NULL_TREE : op, + last_vuse_ptr, kind, tbaa_p, mask); +@@ -3667,7 +3721,8 @@ vn_reference_insert_pieces (tree vuse, alias_set_type set, + vr1 = XOBNEW (&vn_tables_obstack, vn_reference_s); + vr1->value_id = value_id; + vr1->vuse = vuse_ssa_val (vuse); +- vr1->operands = valueize_refs (operands); ++ vr1->operands = operands; ++ valueize_refs (&vr1->operands); + vr1->type = type; + vr1->punned = false; + vr1->set = set; +@@ -4105,7 +4160,7 @@ vn_nary_op_insert_pieces_predicated (unsigned int length, enum tree_code code, } static bool @@ -26514,7 +29923,7 @@ static tree vn_nary_op_get_predicated_value (vn_nary_op_t vno, basic_block bb) -@@ -4114,9 +4145,12 @@ vn_nary_op_get_predicated_value (vn_nary_op_t vno, basic_block bb) +@@ -4114,9 +4169,12 @@ vn_nary_op_get_predicated_value (vn_nary_op_t vno, basic_block bb) return vno->u.result; for (vn_pval *val = vno->u.values; val; val = val->next) for (unsigned i = 0; i < val->n; ++i) @@ -26530,7 +29939,7 @@ return val->result; return NULL_TREE; } -@@ -4401,10 +4435,11 @@ vn_phi_insert (gimple *phi, tree result, bool backedges_varying_p) +@@ -4401,10 +4459,11 @@ vn_phi_insert (gimple *phi, tree result, bool backedges_varying_p) /* Return true if BB1 is dominated by BB2 taking into account edges @@ -26544,7 +29953,7 @@ { edge_iterator ei; edge e; -@@ -4421,7 +4456,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) +@@ -4421,7 +4480,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) { edge prede = NULL; FOR_EACH_EDGE (e, ei, bb1->preds) @@ -26554,7 +29963,7 @@ { if (prede) { -@@ -4443,7 +4479,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) +@@ -4443,7 +4503,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) /* Iterate to the single executable bb2 successor. */ edge succe = NULL; FOR_EACH_EDGE (e, ei, bb2->succs) @@ -26564,7 +29973,7 @@ { if (succe) { -@@ -4461,7 +4498,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) +@@ -4461,7 +4522,8 @@ dominated_by_p_w_unex (basic_block bb1, basic_block bb2) { FOR_EACH_EDGE (e, ei, succe->dest->preds) if (e != succe @@ -26574,7 +29983,7 @@ { succe = NULL; break; -@@ -6758,7 +6796,7 @@ rpo_elim::eliminate_avail (basic_block bb, tree op) +@@ -6758,7 +6820,7 @@ rpo_elim::eliminate_avail (basic_block bb, tree op) may also be able to "pre-compute" (bits of) the next immediate (non-)dominator during the RPO walk when marking edges as executable. */ @@ -26583,7 +29992,7 @@ { tree leader = ssa_name (av->leader); /* Prevent eliminations that break loop-closed SSA. */ -@@ -7351,11 +7389,9 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, +@@ -7351,11 +7413,9 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, e->flags &= ~EDGE_DFS_BACK; int *rpo = XNEWVEC (int, n_basic_blocks_for_fn (fn) - NUM_FIXED_BLOCKS); @@ -26597,7 +30006,7 @@ if (!do_region) BITMAP_FREE (exit_bbs); -@@ -7433,12 +7469,20 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, +@@ -7433,12 +7493,20 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, vn_valueize = rpo_vn_valueize; /* Initialize the unwind state and edge/BB executable state. */ @@ -26619,7 +30028,7 @@ bb->flags &= ~BB_EXECUTABLE; bool has_backedges = false; edge e; -@@ -7450,51 +7494,12 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, +@@ -7450,51 +7518,12 @@ do_rpo_vn (function *fn, edge entry, bitmap exit_bbs, e->flags &= ~EDGE_EXECUTABLE; if (iterate || e == entry || (skip_entry_phis && bb == entry->dest)) continue; @@ -26742,6 +30151,16 @@ /* Skip the pair if inter-iteration dependencies are irrelevant and intra-iteration dependencies are guaranteed to be honored. */ +@@ -4645,7 +4650,8 @@ vect_create_addr_base_for_vector_ref (stmt_vec_info stmt_info, + + if (DR_PTR_INFO (dr) + && TREE_CODE (addr_base) == SSA_NAME +- && !SSA_NAME_PTR_INFO (addr_base)) ++ /* We should only duplicate pointer info to newly created SSA names. */ ++ && SSA_NAME_VAR (addr_base) == dest) + { + vect_duplicate_ssa_name_ptr_info (addr_base, dr_info); + if (offset || byte_offset) --- a/src/gcc/tree-vect-loop-manip.c +++ b/src/gcc/tree-vect-loop-manip.c @@ -1760,7 +1760,8 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters, @@ -26756,7 +30175,25 @@ } --- a/src/gcc/tree-vect-loop.c +++ b/src/gcc/tree-vect-loop.c -@@ -8415,6 +8415,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo, +@@ -3236,6 +3236,17 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, + return def_stmt_info; + } + ++ /* When the inner loop of a double reduction ends up with more than ++ one loop-closed PHI we have failed to classify alternate such ++ PHIs as double reduction, leading to wrong code. See PR103237. */ ++ if (inner_loop_of_double_reduc && lcphis.length () != 1) ++ { ++ if (dump_enabled_p ()) ++ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, ++ "unhandle double reduction\n"); ++ return NULL; ++ } ++ + /* If this isn't a nested cycle or if the nested cycle reduction value + is used ouside of the inner loop we cannot handle uses of the reduction + value. */ +@@ -8415,6 +8426,7 @@ maybe_set_vectorized_backedge_value (loop_vec_info loop_vinfo, if (gphi *phi = dyn_cast (USE_STMT (use_p))) if (gimple_bb (phi)->loop_father->header == gimple_bb (phi) && (phi_info = loop_vinfo->lookup_stmt (phi)) @@ -26764,7 +30201,7 @@ && VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (phi_info)) && STMT_VINFO_REDUC_TYPE (phi_info) != FOLD_LEFT_REDUCTION && STMT_VINFO_REDUC_TYPE (phi_info) != EXTRACT_LAST_REDUCTION) -@@ -8936,7 +8937,10 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) +@@ -8936,7 +8948,10 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) !gsi_end_p (gsi); gsi_next (&gsi)) { gcall *call = dyn_cast (gsi_stmt (gsi)); @@ -26776,7 +30213,7 @@ { tree lhs = gimple_get_lhs (call); if (!VECTOR_TYPE_P (TREE_TYPE (lhs))) -@@ -8946,6 +8950,17 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) +@@ -8946,6 +8961,17 @@ vect_transform_loop (loop_vec_info loop_vinfo, gimple *loop_vectorized_call) gsi_replace (&gsi, new_stmt, true); } } @@ -26796,6 +30233,50 @@ --- a/src/gcc/tree-vect-slp.c +++ b/src/gcc/tree-vect-slp.c +@@ -969,31 +969,31 @@ vect_build_slp_tree_1 (unsigned char *swap, + continue; + } + +- if (need_same_oprnds) ++ if (!load_p && rhs_code == CALL_EXPR) + { +- tree other_op1 = (call_stmt +- ? gimple_call_arg (call_stmt, 1) +- : gimple_assign_rhs2 (stmt)); +- if (!operand_equal_p (first_op1, other_op1, 0)) ++ if (!compatible_calls_p (as_a (stmts[0]->stmt), ++ as_a (stmt))) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, +- "Build SLP failed: different shift " +- "arguments in %G", stmt); ++ "Build SLP failed: different calls in %G", ++ stmt); + /* Mismatch. */ + continue; + } + } + +- if (!load_p && rhs_code == CALL_EXPR) ++ if (need_same_oprnds) + { +- if (!compatible_calls_p (as_a (stmts[0]->stmt), +- as_a (stmt))) ++ tree other_op1 = (call_stmt ++ ? gimple_call_arg (call_stmt, 1) ++ : gimple_assign_rhs2 (stmt)); ++ if (!operand_equal_p (first_op1, other_op1, 0)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, +- "Build SLP failed: different calls in %G", +- stmt); ++ "Build SLP failed: different shift " ++ "arguments in %G", stmt); + /* Mismatch. */ + continue; + } @@ -1515,6 +1515,10 @@ vect_build_slp_tree_2 (vec_info *vinfo, } if (dump_enabled_p ()) @@ -27388,7 +30869,24 @@ /* Given two virtual locations *LOC0 and *LOC1, return the first --- a/src/libgcc/ChangeLog +++ b/src/libgcc/ChangeLog -@@ -1,3 +1,67 @@ +@@ -1,3 +1,84 @@ ++2022-02-13 Alan Modra ++ ++ Backported from master: ++ 2021-07-15 Alan Modra ++ ++ * config/rs6000/morestack.S (R2_SAVE): Define. ++ (__morestack): Save and restore r2. Set up r2 for called ++ functions. ++ ++2022-02-13 Alan Modra ++ ++ Backported from master: ++ 2020-10-01 Alan Modra ++ ++ * config/rs6000/morestack.S, ++ * config/rs6000/tramp.S: Support __PCREL__ code. ++ +2021-10-27 John David Anglin + + * config.host (hppa*64*-*-linux*): Don't add pa/t-linux to @@ -27744,6 +31242,186 @@ -HOST_LIBGCC2_CFLAGS += -Dpa64=1 -DELF=1 +LIB2ADD_ST = $(srcdir)/config/pa/linux-atomic.c +--- a/src/libgcc/config/rs6000/morestack.S ++++ b/src/libgcc/config/rs6000/morestack.S +@@ -31,6 +31,7 @@ + #define PARAMS 48 + #endif + #define MORESTACK_FRAMESIZE (PARAMS+96) ++#define R2_SAVE -MORESTACK_FRAMESIZE+PARAMS-8 + #define PARAMREG_SAVE -MORESTACK_FRAMESIZE+PARAMS+0 + #define STATIC_CHAIN_SAVE -MORESTACK_FRAMESIZE+PARAMS+64 + #define R29_SAVE -MORESTACK_FRAMESIZE+PARAMS+72 +@@ -55,11 +56,18 @@ + .type name,@function; \ + name##: + ++#ifdef __PCREL__ ++#define ENTRY(name) \ ++ ENTRY0(name); \ ++ .localentry name, 1 ++#define JUMP_TARGET(name) name##@notoc ++#else + #define ENTRY(name) \ + ENTRY0(name); \ + 0: addis %r2,%r12,.TOC.-0b@ha; \ + addi %r2,%r2,.TOC.-0b@l; \ + .localentry name, .-name ++#endif + + #else + +@@ -81,6 +89,9 @@ BODY_LABEL(name)##: + + #define SIZE(name) .size name, .-BODY_LABEL(name) + ++#ifndef JUMP_TARGET ++#define JUMP_TARGET(name) name ++#endif + + .text + # Just like __morestack, but with larger excess allocation +@@ -133,6 +144,17 @@ ENTRY0(__morestack_non_split) + # cr7 must also be preserved. + + ENTRY0(__morestack) ++ ++#if _CALL_ELF == 2 ++# Functions with localentry bits of zero cannot make calls if those ++# calls might change r2. This is true generally, and also true for ++# __morestack with its special calling convention. When __morestack's ++# caller is non-pcrel but libgcc is pcrel, the functions called here ++# might modify r2. r2 must be preserved on exit, and also restored ++# for the call back to our caller. ++ std %r2,R2_SAVE(%r1) ++#endif ++ + # Save parameter passing registers, our arguments, lr, r29 + # and use r29 as a frame pointer. + std %r3,PARAMREG_SAVE+0(%r1) +@@ -151,12 +173,26 @@ ENTRY0(__morestack) + std %r12,LINKREG_SAVE(%r1) + std %r3,NEWSTACKSIZE_SAVE(%r1) # new stack size + mr %r29,%r1 ++#if _CALL_ELF == 2 ++ .cfi_offset %r2,R2_SAVE ++#endif + .cfi_offset %r29,R29_SAVE + .cfi_def_cfa_register %r29 + stdu %r1,-MORESTACK_FRAMESIZE(%r1) + ++#if _CALL_ELF == 2 && !defined __PCREL__ ++# If this isn't a pcrel libgcc then the functions we call here will ++# require r2 to be valid. If __morestack is called from pcrel code r2 ++# won't be valid. Set it up. ++ bcl 20,31,1f ++1: ++ mflr %r12 ++ addis %r2,%r12,.TOC.-1b@ha ++ addi %r2,%r2,.TOC.-1b@l ++#endif ++ + # void __morestack_block_signals (void) +- bl __morestack_block_signals ++ bl JUMP_TARGET(__morestack_block_signals) + + # void *__generic_morestack (size_t *pframe_size, + # void *old_stack, +@@ -164,7 +200,7 @@ ENTRY0(__morestack) + addi %r3,%r29,NEWSTACKSIZE_SAVE + mr %r4,%r29 + li %r5,0 # no copying from old stack +- bl __generic_morestack ++ bl JUMP_TARGET(__generic_morestack) + + # Start using new stack + stdu %r29,-32(%r3) # back-chain +@@ -183,12 +219,15 @@ ENTRY0(__morestack) + std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss + + # void __morestack_unblock_signals (void) +- bl __morestack_unblock_signals ++ bl JUMP_TARGET(__morestack_unblock_signals) + + # Set up for a call to the target function, located 3 + # instructions after __morestack's return address. + # + ld %r12,LINKREG_SAVE(%r29) ++#if _CALL_ELF == 2 ++ ld %r2,R2_SAVE(%r29) ++#endif + ld %r3,PARAMREG_SAVE+0(%r29) # restore arg regs + ld %r4,PARAMREG_SAVE+8(%r29) + ld %r5,PARAMREG_SAVE+16(%r29) +@@ -218,11 +257,20 @@ ENTRY0(__morestack) + std %r10,PARAMREG_SAVE+56(%r29) + #endif + +- bl __morestack_block_signals ++#if _CALL_ELF == 2 && !defined __PCREL__ ++# r2 was restored for calling back into our caller. Set it up again. ++ bcl 20,31,1f ++1: ++ mflr %r12 ++ addis %r2,%r12,.TOC.-1b@ha ++ addi %r2,%r2,.TOC.-1b@l ++#endif ++ ++ bl JUMP_TARGET(__morestack_block_signals) + + # void *__generic_releasestack (size_t *pavailable) + addi %r3,%r29,NEWSTACKSIZE_SAVE +- bl __generic_releasestack ++ bl JUMP_TARGET(__generic_releasestack) + + # Reset __private_ss stack guard to value for old stack + ld %r12,NEWSTACKSIZE_SAVE(%r29) +@@ -231,7 +279,7 @@ ENTRY0(__morestack) + .LEHE0: + std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss + +- bl __morestack_unblock_signals ++ bl JUMP_TARGET(__morestack_unblock_signals) + + # Use old stack again. + mr %r1,%r29 +@@ -239,6 +287,9 @@ ENTRY0(__morestack) + # Restore return value regs, and return. + ld %r0,LINKREG_SAVE(%r29) + mtlr %r0 ++#if _CALL_ELF == 2 ++ ld %r2,R2_SAVE(%r29) ++#endif + ld %r3,PARAMREG_SAVE+0(%r29) + ld %r4,PARAMREG_SAVE+8(%r29) + ld %r5,PARAMREG_SAVE+16(%r29) +@@ -260,13 +311,15 @@ cleanup: + std %r3,PARAMREG_SAVE(%r29) # Save exception header + # size_t __generic_findstack (void *stack) + mr %r3,%r29 +- bl __generic_findstack ++ bl JUMP_TARGET(__generic_findstack) + sub %r3,%r29,%r3 + addi %r3,%r3,BACKOFF + std %r3,-0x7000-64(%r13) # tcbhead_t.__private_ss + ld %r3,PARAMREG_SAVE(%r29) +- bl _Unwind_Resume ++ bl JUMP_TARGET(_Unwind_Resume) ++#ifndef __PCREL__ + nop ++#endif + .cfi_endproc + SIZE (__morestack) + +@@ -310,7 +363,7 @@ ENTRY(__stack_split_initialize) + # void __generic_morestack_set_initial_sp (void *sp, size_t len) + mr %r3,%r1 + li %r4, 0x4000 +- b __generic_morestack_set_initial_sp ++ b JUMP_TARGET(__generic_morestack_set_initial_sp) + # The lack of .cfi_endproc here is deliberate. This function and the + # following ones can all use the default FDE. + SIZE (__stack_split_initialize) --- a/src/libgcc/config/rs6000/t-linux +++ b/src/libgcc/config/rs6000/t-linux @@ -11,10 +11,12 @@ HOST_LIBGCC2_CFLAGS += -mno-minimal-toc @@ -27775,9 +31453,25 @@ srwi r4,r4,2 /* # words to move */ addi r9,r3,-4 /* adjust pointer for lwzu */ mtctr r4 -@@ -150,8 +149,7 @@ FUNC_START(__trampoline_setup) +@@ -140,18 +139,23 @@ trampoline_size = .-trampoline_initial + /* R5 = function address */ + /* R6 = static chain */ + ++#ifndef __PCREL__ + .pushsection ".toc","aw" + .LC0: + .quad trampoline_initial-8 + .popsection ++#endif + + FUNC_START(__trampoline_setup) + .cfi_startproc ++#ifdef __PCREL__ ++ pla 7,(trampoline_initial-8)@pcrel ++#else addis 7,2,.LC0@toc@ha ld 7,.LC0@toc@l(7) /* trampoline address -8 */ ++#endif - li r8,trampoline_size /* verify that the trampoline is big enough */ - cmpw cr1,r8,r4 @@ -30044,7 +33738,14 @@ +} --- a/src/libitm/ChangeLog +++ b/src/libitm/ChangeLog -@@ -1,3 +1,11 @@ +@@ -1,3 +1,18 @@ ++2022-02-13 Alan Modra ++ ++ Backported from master: ++ 2020-10-01 Alan Modra ++ ++ * config/powerpc/sjlj.S: Support __PCREL__ code. ++ +2021-06-18 Jonathan Wakely + + Backported from master: @@ -30056,6 +33757,33 @@ 2021-04-08 Release Manager * GCC 10.3.0 released. +--- a/src/libitm/config/powerpc/sjlj.S ++++ b/src/libitm/config/powerpc/sjlj.S +@@ -26,7 +26,23 @@ + + #include "asmcfi.h" + +-#if defined(__powerpc64__) && _CALL_ELF == 2 ++#if defined(__powerpc64__) && _CALL_ELF == 2 && defined(__PCREL__) ++.macro FUNC name ++ .globl \name ++ .type \name, @function ++\name: ++ .localentry \name, 1 ++.endm ++.macro END name ++ .size \name, . - \name ++.endm ++.macro HIDDEN name ++ .hidden \name ++.endm ++.macro CALL name ++ bl \name @notoc ++.endm ++#elif defined(__powerpc64__) && _CALL_ELF == 2 + .macro FUNC name + .globl \name + .type \name, @function new file mode 100644 --- /dev/null +++ b/src/libitm/testsuite/libitm.c++/libstdc++-pr91488.C @@ -30409,7 +34137,16 @@ import std.traits : isArray; --- a/src/libsanitizer/ChangeLog +++ b/src/libsanitizer/ChangeLog -@@ -1,3 +1,31 @@ +@@ -1,3 +1,40 @@ ++2022-01-19 H.J. Lu ++ ++ Backported from master: ++ 2022-01-12 H.J. Lu ++ ++ PR sanitizer/102911 ++ * asan/asan_malloc_linux.cpp (kDlsymAllocPoolSize): Set it to ++ 8192 on Linux. ++ +2021-08-05 Martin Liska + + PR sanitizer/101749 @@ -30441,6 +34178,17 @@ 2021-04-08 Release Manager * GCC 10.3.0 released. +--- a/src/libsanitizer/asan/asan_malloc_linux.cpp ++++ b/src/libsanitizer/asan/asan_malloc_linux.cpp +@@ -31,7 +31,7 @@ using namespace __asan; + + static uptr allocated_for_dlsym; + static uptr last_dlsym_alloc_size_in_words; +-static const uptr kDlsymAllocPoolSize = SANITIZER_RTEMS ? 4096 : 1024; ++static const uptr kDlsymAllocPoolSize = SANITIZER_RTEMS ? 4096 : 8192; + static uptr alloc_memory_for_dlsym[kDlsymAllocPoolSize]; + + static INLINE bool IsInDlsymAllocPool(const void *ptr) { --- a/src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc +++ b/src/libsanitizer/sanitizer_common/sanitizer_common_interceptors_ioctl.inc @@ -366,15 +366,6 @@ static void ioctl_table_fill() { @@ -30559,7 +34307,18 @@ } --- a/src/libstdc++-v3/ChangeLog +++ b/src/libstdc++-v3/ChangeLog -@@ -1,3 +1,1637 @@ +@@ -1,3 +1,1648 @@ ++2022-02-17 Patrick Palka ++ ++ Backported from master: ++ 2021-10-21 Patrick Palka ++ ++ PR libstdc++/102358 ++ * include/bits/stl_iterator.h (__niter_base): Make constexpr ++ for C++20. ++ (__miter_base): Likewise. ++ * testsuite/25_algorithms/move/constexpr.cc: New test. ++ +2022-01-05 Jonathan Wakely + + Backported from master: @@ -35358,7 +39117,7 @@ constexpr counted_iterator& operator++() { -@@ -2170,20 +2263,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION +@@ -2170,22 +2263,20 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION iter_difference_t<_It> _M_length = 0; }; @@ -35383,7 +39142,18 @@ + /// @} group iterators template ++ _GLIBCXX20_CONSTEXPR + auto + __niter_base(move_iterator<_Iterator> __it) + -> decltype(make_move_iterator(__niter_base(__it.base()))) +@@ -2199,6 +2290,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION + }; + + template ++ _GLIBCXX20_CONSTEXPR auto + __miter_base(move_iterator<_Iterator> __it) + -> decltype(__miter_base(__it.base())) --- a/src/libstdc++-v3/include/bits/stl_iterator_base_types.h +++ b/src/libstdc++-v3/include/bits/stl_iterator_base_types.h @@ -79,7 +79,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION @@ -44359,6 +48129,29 @@ test01(); + test02(); } +new file mode 100644 +--- /dev/null ++++ b/src/libstdc++-v3/testsuite/25_algorithms/move/constexpr.cc +@@ -0,0 +1,19 @@ ++// { dg-options "-std=gnu++20" } ++// { dg-do compile { target c++20 } } ++ ++#include ++#include ++ ++constexpr bool ++test01() ++{ ++ // PR libstdc++/102358 ++ int x[2] = {1,2}, y[2]; ++ std::span in(x), out(y); ++ std::move(std::move_iterator(in.begin()), std::move_iterator(in.end()), ++ out.begin()); ++ return std::equal(std::move_iterator(in.begin()), std::move_iterator(in.end()), ++ std::move_iterator(out.begin())); ++} ++ ++static_assert(test01()); --- a/src/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc +++ b/src/libstdc++-v3/testsuite/25_algorithms/move/constrained.cc @@ -26,6 +26,7 @@ diff -Nru gcc-10-10.3.0/debian/rules.defs gcc-10-10.3.0/debian/rules.defs --- gcc-10-10.3.0/debian/rules.defs 2021-10-29 12:09:25.000000000 +0000 +++ gcc-10-10.3.0/debian/rules.defs 2022-03-24 12:12:23.000000000 +0000 @@ -1631,9 +1631,13 @@ endif #check_no_cpus := m68k check_no_systems := # gnu kfreebsd-gnu +check_no_archs := # ppc64 sh4 ifneq (,$(filter $(DEB_TARGET_ARCH_CPU),$(check_no_cpus))) with_check := disabled for cpu $(DEB_TARGET_ARCH_CPU) endif +ifneq (,$(filter $(DEB_TARGET_ARCH),$(check_no_archs))) + with_check := disabled for cpu $(DEB_TARGET_ARCH) +endif #ifneq (,$(findstring $(DEB_TARGET_GNU_SYSTEM),$(check_no_systems))) # with_check := disabled for system $(DEB_TARGET_GNU_SYSTEM) #endif @@ -1654,7 +1658,7 @@ #endif # override the Debian porters, we need to know about the test results ifeq ($(distribution),Debian) - ifneq (,$(filter $(DEB_HOST_ARCH), m68k sh4)) + ifneq (,$(filter $(DEB_HOST_ARCH), m68k)) with_check := yes endif endif diff -Nru gcc-10-10.3.0/debian/rules.parameters gcc-10-10.3.0/debian/rules.parameters --- gcc-10-10.3.0/debian/rules.parameters 2022-01-13 10:55:32.000000000 +0000 +++ gcc-10-10.3.0/debian/rules.parameters 2022-03-24 12:12:38.000000000 +0000 @@ -2,14 +2,14 @@ GCC_VERSION := 10.3.0 NEXT_GCC_VERSION := 10.3.1 BASE_VERSION := 10 -SOURCE_VERSION := 10.3.0-14ubuntu1 -DEB_VERSION := 10.3.0-14ubuntu1 -DEB_EVERSION := 1:10.3.0-14ubuntu1 -DEB_GDC_VERSION := 10.3.0-14ubuntu1 +SOURCE_VERSION := 10.3.0-15ubuntu1 +DEB_VERSION := 10.3.0-15ubuntu1 +DEB_EVERSION := 1:10.3.0-15ubuntu1 +DEB_GDC_VERSION := 10.3.0-15ubuntu1 DEB_SOVERSION := 5 DEB_SOEVERSION := 1:5 DEB_LIBGCC_SOVERSION := -DEB_LIBGCC_VERSION := 10.3.0-14ubuntu1 +DEB_LIBGCC_VERSION := 10.3.0-15ubuntu1 DEB_STDCXX_SOVERSION := 5 DEB_GOMP_SOVERSION := 5 GCC_SONAME := 1 diff -Nru gcc-10-10.3.0/debian/rules.patch gcc-10-10.3.0/debian/rules.patch --- gcc-10-10.3.0/debian/rules.patch 2022-01-13 10:55:27.000000000 +0000 +++ gcc-10-10.3.0/debian/rules.patch 2022-03-24 12:12:23.000000000 +0000 @@ -26,6 +26,7 @@ rename-info-files \ pr97250-doc \ pr97250-follow-up-doc \ + gcc-mold-doc \ # git-doc-updates \ # $(if $(with_linaro_branch),,svn-doc-updates) \ @@ -83,6 +84,7 @@ musl-ssp \ pr99264-follow-up \ arm-arch-extensions \ + gcc-mold \ ifneq (,$(filter $(distrelease), jessie stretch buster precise trusty xenial bionic)) debian_patches += pr85678-revert