Successfully identified regression in *gcc* in CI configuration 
tcwg_bmk_gnu_eabi_stm32/gnu_eabi-master-arm_eabi-coremark-Os.  So far, this 
commit has regressed CI configurations:
 - tcwg_bmk_gnu_eabi_stm32/gnu_eabi-master-arm_eabi-coremark-Os

Culprit:
<cut>
commit 784de5292c34e287c848b382b431599b818ea76e
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Apr 16 09:34:26 2021 +0200

    c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]
    
    The requires clause parsing has code to suggest users wrapping
    non-primary expressions in (), so if it e.g. parses a primary expression
    and sees it is followed by ++, --, ., ( or -> among other things it
    will try to reparse it as assignment expression or what and if that works
    suggests wrapping it inside of parens.
    When it is requires-clause that is after <typename T> etc. it already
    has an exception from that as ( can occur in valid C++20 expression there
    - starting the parameters of the lambda.
    In C++23 another case can occur, as the parameters with the ()s can be
    omitted, requires C can be followed immediately by -> which starts a
    trailing return type.  Even in that case, we don't want to parse that
    as C->...
    
    2021-04-16  Jakub Jelinek  <ja...@redhat.com>
    
            PR c++/99850
            * parser.c (cp_parser_constraint_requires_parens) <case CPP_DEREF>:
            If lambda_p, return pce_ok instead of pce_maybe_postfix.
    
            * g++.dg/cpp23/lambda-specifiers2.C: New test.
</cut>

Results regressed to (for first_bad == 784de5292c34e287c848b382b431599b818ea76e)
# reset_artifacts:
-10
# build_abe binutils:
-9
# build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer --set 
gcc_override_configure=--disable-multilib --set 
gcc_override_configure=--with-cpu=cortex-m4 --set 
gcc_override_configure=--with-mode=thumb --set 
gcc_override_configure=--with-float=hard:
-8
# build_abe newlib:
-6
# build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer --set 
gcc_override_configure=--disable-multilib --set 
gcc_override_configure=--with-cpu=cortex-m4 --set 
gcc_override_configure=--with-mode=thumb --set 
gcc_override_configure=--with-float=hard:
-5
# true:
0
# benchmark -Os_mthumb -- 
artifacts/build-784de5292c34e287c848b382b431599b818ea76e/results_id:
1

from (for last_good == 20eb7a1891cfd7fa85295a236cebe0322d041edd)
# reset_artifacts:
-10
# build_abe binutils:
-9
# build_abe stage1 -- --set gcc_override_configure=--disable-libsanitizer --set 
gcc_override_configure=--disable-multilib --set 
gcc_override_configure=--with-cpu=cortex-m4 --set 
gcc_override_configure=--with-mode=thumb --set 
gcc_override_configure=--with-float=hard:
-8
# build_abe newlib:
-6
# build_abe stage2 -- --set gcc_override_configure=--disable-libsanitizer --set 
gcc_override_configure=--disable-multilib --set 
gcc_override_configure=--with-cpu=cortex-m4 --set 
gcc_override_configure=--with-mode=thumb --set 
gcc_override_configure=--with-float=hard:
-5
# true:
0
# benchmark -Os_mthumb -- artifacts/build-baseline/results_id:
1

Artifacts of last_good build: 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/build-20eb7a1891cfd7fa85295a236cebe0322d041edd/
Results ID of last_good: 
stm32_STM32L476RGTx/tcwg_bmk_gnu_eabi_stm32/baseline-gnu_eabi-master-arm_eabi-coremark-Os/2215
Artifacts of first_bad build: 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/build-784de5292c34e287c848b382b431599b818ea76e/
Results ID of first_bad: 
stm32_STM32L476RGTx/tcwg_bmk_gnu_eabi_stm32/bisect-gnu_eabi-master-arm_eabi-coremark-Os/2252
Build top page/logs: 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/

Configuration details:


Reproduce builds:
<cut>
mkdir investigate-gcc-784de5292c34e287c848b382b431599b818ea76e
cd investigate-gcc-784de5292c34e287c848b382b431599b818ea76e

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_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/manifests/build-baseline.sh
 --fail
curl -o artifacts/manifests/build-parameters.sh 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/manifests/build-parameters.sh
 --fail
curl -o artifacts/test.sh 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/test.sh
 --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 784de5292c34e287c848b382b431599b818ea76e
../artifacts/test.sh

# Reproduce last_good build
git checkout --detach 20eb7a1891cfd7fa85295a236cebe0322d041edd
../artifacts/test.sh

cd ..
</cut>

History of pending regressions and results: 
https://git.linaro.org/toolchain/ci/base-artifacts.git/log/?h=linaro-local/ci/tcwg_bmk_gnu_eabi_stm32/gnu_eabi-master-arm_eabi-coremark-Os

Artifacts: 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/artifact/artifacts/
Build log: 
https://ci.linaro.org/job/tcwg_bmk_ci_gnu_eabi-bisect-tcwg_bmk_stm32-gnu_eabi-master-arm_eabi-coremark-Os/12/consoleText

Full commit (up to 1000 lines):
<cut>
commit 784de5292c34e287c848b382b431599b818ea76e
Author: Jakub Jelinek <ja...@redhat.com>
Date:   Fri Apr 16 09:34:26 2021 +0200

    c++: Fix up C++23 [] <...> requires primary -> type {} parsing [PR99850]
    
    The requires clause parsing has code to suggest users wrapping
    non-primary expressions in (), so if it e.g. parses a primary expression
    and sees it is followed by ++, --, ., ( or -> among other things it
    will try to reparse it as assignment expression or what and if that works
    suggests wrapping it inside of parens.
    When it is requires-clause that is after <typename T> etc. it already
    has an exception from that as ( can occur in valid C++20 expression there
    - starting the parameters of the lambda.
    In C++23 another case can occur, as the parameters with the ()s can be
    omitted, requires C can be followed immediately by -> which starts a
    trailing return type.  Even in that case, we don't want to parse that
    as C->...
    
    2021-04-16  Jakub Jelinek  <ja...@redhat.com>
    
            PR c++/99850
            * parser.c (cp_parser_constraint_requires_parens) <case CPP_DEREF>:
            If lambda_p, return pce_ok instead of pce_maybe_postfix.
    
            * g++.dg/cpp23/lambda-specifiers2.C: New test.
---
 gcc/cp/parser.c                                 | 13 +++++++++++++
 gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C |  7 +++++++
 2 files changed, 20 insertions(+)

diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index 940751b5f05..dfc9b8251a7 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -28530,7 +28530,20 @@ cp_parser_constraint_requires_parens (cp_parser 
*parser, bool lambda_p)
       case CPP_PLUS_PLUS:
       case CPP_MINUS_MINUS:
       case CPP_DOT:
+       /* Unenclosed postfix operator.  */
+       return pce_maybe_postfix;
+
       case CPP_DEREF:
+       /* A primary constraint that precedes the lambda-declarator of a
+          lambda expression is followed by trailing return type.
+
+             []<typename T> requires C -> void {}
+
+          Don't try to re-parse this as a postfix expression in
+          C++23 and later.  In C++20 ( needs to come in between but we
+          allow it to be omitted with pedwarn.  */
+       if (lambda_p)
+         return pce_ok;
        /* Unenclosed postfix operator.  */
        return pce_maybe_postfix;
    }
diff --git a/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C 
b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C
new file mode 100644
index 00000000000..0cc69bebc64
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp23/lambda-specifiers2.C
@@ -0,0 +1,7 @@
+// PR c++/99850
+// P1102R2 - Down with ()!
+// { dg-do compile { target c++23 } }
+
+auto l = []<auto> requires true -> void {};
+template <typename...> concept C = true;
+auto m = []<typename... Ts> requires (C<Ts> && ...) -> void {};
</cut>
_______________________________________________
linaro-toolchain mailing list
linaro-toolchain@lists.linaro.org
https://lists.linaro.org/mailman/listinfo/linaro-toolchain

Reply via email to