Successfully identified regression in *gcc* in CI configuration tcwg_bmk_gnu_tx1/gnu-master-aarch64-spec2k6-O2. So far, this commit has regressed CI configurations: - tcwg_bmk_gnu_tx1/gnu-master-aarch64-spec2k6-O2
Culprit: <cut> commit d999d9b7e53b9a9cd2004a19e84c637e5e5013f5 Author: Patrick Palka ppalka@redhat.com Date: Thu Jun 3 09:39:13 2021 -0400
c++: cv-qualified dependent name of alias tmpl [PR100592]
Here, the dependent template name in the return type of f() resolves to an alias of int& after substitution, and we end up complaining about qualifying this reference type with 'const' from cp_build_qualified_type rather than just silently dropping the qualification as per [dcl.ref]/1.
The problem is ultimately that make_typename_type ignores the tf_keep_type_decl flag when the dependent name is a template-id. This in turn causes the TYPE_DECL check within tsubst <case TYPENAME_TYPE> to fail, and so we end up not passing tf_ignore_bad_quals to cp_build_qualified_type. This patch fixes this by making make_typename_type respect the tf_keep_type_decl flag in this situation.
PR c++/100592
gcc/cp/ChangeLog:
* decl.c (make_typename_type): After calling lookup_template_class, adjust the result to its TYPE_NAME and then consider the tf_keep_type_decl flag.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-71.C: New test. </cut>
Results regressed to (for first_bad == d999d9b7e53b9a9cd2004a19e84c637e5e5013f5) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # true: 0 # benchmark -O2 -- artifacts/build-d999d9b7e53b9a9cd2004a19e84c637e5e5013f5/results_id: 1 # 447.dealII,dealII_base.default regressed by 103 # 447.dealII,[.] _ZNK8MappingQILi3EE19transform_covariantEP6Ten regressed by 117
from (for last_good == 69f517ac20566a645ff41a9bfca535822205a538) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer: -5 # true: 0 # benchmark -O2 -- artifacts/build-69f517ac20566a645ff41a9bfca535822205a538/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... Results ID of last_good: tx1_64/tcwg_bmk_gnu_tx1/bisect-gnu-master-aarch64-spec2k6-O2/2208 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... Results ID of first_bad: tx1_64/tcwg_bmk_gnu_tx1/bisect-gnu-master-aarch64-spec2k6-O2/2248 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar...
Configuration details:
Reproduce builds: <cut> mkdir investigate-gcc-d999d9b7e53b9a9cd2004a19e84c637e5e5013f5 cd investigate-gcc-d999d9b7e53b9a9cd2004a19e84c637e5e5013f5
git clone https://git.linaro.org/toolchain/jenkins-scripts
mkdir -p artifacts/manifests curl -o artifacts/manifests/build-baseline.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... --fail chmod +x artifacts/test.sh
# Reproduce the baseline build (build all pre-requisites) ./jenkins-scripts/tcwg_bmk-build.sh @@ artifacts/manifests/build-baseline.sh
# Save baseline build state (which is then restored in artifacts/test.sh) mkdir -p ./bisect rsync -a --del --delete-excluded --exclude /bisect/ --exclude /artifacts/ --exclude /gcc/ ./ ./bisect/baseline/
cd gcc
# Reproduce first_bad build git checkout --detach d999d9b7e53b9a9cd2004a19e84c637e5e5013f5 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach 69f517ac20566a645ff41a9bfca535822205a538 ../artifacts/test.sh
cd .. </cut>
History of pending regressions and results: https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/c...
Artifacts: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_gnu-bisect-tcwg_bmk_tx1-gnu-master-aar...
Full commit (up to 1000 lines): <cut> commit d999d9b7e53b9a9cd2004a19e84c637e5e5013f5 Author: Patrick Palka ppalka@redhat.com Date: Thu Jun 3 09:39:13 2021 -0400
c++: cv-qualified dependent name of alias tmpl [PR100592]
Here, the dependent template name in the return type of f() resolves to an alias of int& after substitution, and we end up complaining about qualifying this reference type with 'const' from cp_build_qualified_type rather than just silently dropping the qualification as per [dcl.ref]/1.
The problem is ultimately that make_typename_type ignores the tf_keep_type_decl flag when the dependent name is a template-id. This in turn causes the TYPE_DECL check within tsubst <case TYPENAME_TYPE> to fail, and so we end up not passing tf_ignore_bad_quals to cp_build_qualified_type. This patch fixes this by making make_typename_type respect the tf_keep_type_decl flag in this situation.
PR c++/100592
gcc/cp/ChangeLog:
* decl.c (make_typename_type): After calling lookup_template_class, adjust the result to its TYPE_NAME and then consider the tf_keep_type_decl flag.
gcc/testsuite/ChangeLog:
* g++.dg/cpp0x/alias-decl-71.C: New test. --- gcc/cp/decl.c | 13 +++++++++---- gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C | 13 +++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index fb21a3a1ae8..a3687dbb0dd 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -4136,10 +4136,15 @@ make_typename_type (tree context, tree name, enum tag_types tag_type, return error_mark_node;
if (want_template) - return lookup_template_class (t, TREE_OPERAND (fullname, 1), - NULL_TREE, context, - /*entering_scope=*/0, - complain | tf_user); + { + t = lookup_template_class (t, TREE_OPERAND (fullname, 1), + NULL_TREE, context, + /*entering_scope=*/0, + complain | tf_user); + if (t == error_mark_node) + return error_mark_node; + t = TYPE_NAME (t); + }
if (DECL_ARTIFICIAL (t) || !(complain & tf_keep_type_decl)) t = TREE_TYPE (t); diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C new file mode 100644 index 00000000000..6a61f93a0b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-71.C @@ -0,0 +1,13 @@ +// PR c++/100592 +// { dg-do compile { target c++11 } } + +template<bool> +struct meta { + template<class> using if_c = int&; +}; + +template<bool B> +typename meta<B>::template if_c<void> const f(); + +using type = decltype(f<true>()); +using type = int&; </cut>