Successfully identified regression in *gcc* in CI configuration tcwg_bmk_llvm_apm/llvm-release-arm-spec2k6-Os. So far, this commit has regressed CI configurations: - tcwg_bmk_llvm_apm/llvm-release-arm-spec2k6-Os
Culprit: <cut> commit b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8 Author: Jakub Jelinek jakub@redhat.com Date: Tue Aug 11 16:46:49 2020 +0200
c-family: Fix ICE in get_atomic_generic_size [PR96545]
As the testcase shows, we would ICE if the type of the first argument of various atomic builtins was pointer to (non-void) incomplete type, we would assume that TYPE_SIZE_UNIT must be non-NULL. This patch diagnoses it instead. And also changes the TREE_CODE != INTEGER_CST check to !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory the int could be too large and not fit.
2020-08-11 Jakub Jelinek jakub@redhat.com
PR c/96545 * c-common.c (get_atomic_generic_size): Require that first argument's type points to a complete type and use tree_fits_uhwi_p instead of just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.
* c-c++-common/pr96545.c: New test.
(cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae) </cut>
Results regressed to (for first_bad == b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=thumb --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=thumb --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -Os_mthumb artifacts/build-b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8/results_id: 1 # 429.mcf,mcf_base.default regressed by 104 # 470.lbm,lbm_base.default regressed by 103
from (for last_good == db00336a49707327552e678b59da8e85384bdae6) # reset_artifacts: -10 # build_abe binutils: -9 # build_abe stage1 -- --set gcc_override_configure=--with-mode=thumb --set gcc_override_configure=--disable-libsanitizer: -8 # build_abe linux: -7 # build_abe glibc: -6 # build_abe stage2 -- --set gcc_override_configure=--with-mode=thumb --set gcc_override_configure=--disable-libsanitizer: -5 # build_llvm true: -3 # true: 0 # benchmark -- -Os_mthumb artifacts/build-db00336a49707327552e678b59da8e85384bdae6/results_id: 1
Artifacts of last_good build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-... Results ID of last_good: apm_32/tcwg_bmk_llvm_apm/bisect-llvm-release-arm-spec2k6-Os/3201 Artifacts of first_bad build: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-... Results ID of first_bad: apm_32/tcwg_bmk_llvm_apm/bisect-llvm-release-arm-spec2k6-Os/3141 Build top page/logs: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-...
Configuration details:
Reproduce builds: <cut> mkdir investigate-gcc-b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8 cd investigate-gcc-b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8
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_llvm-bisect-tcwg_bmk_apm-llvm-release-... --fail curl -o artifacts/manifests/build-parameters.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-... --fail curl -o artifacts/test.sh https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-... --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 b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8 ../artifacts/test.sh
# Reproduce last_good build git checkout --detach db00336a49707327552e678b59da8e85384bdae6 ../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_llvm-bisect-tcwg_bmk_apm-llvm-release-... Build log: https://ci.linaro.org/job/tcwg_bmk_ci_llvm-bisect-tcwg_bmk_apm-llvm-release-...
Full commit (up to 1000 lines): <cut> commit b9bb6a5e12cae44a1cbf298b69f28fc6871f81c8 Author: Jakub Jelinek jakub@redhat.com Date: Tue Aug 11 16:46:49 2020 +0200
c-family: Fix ICE in get_atomic_generic_size [PR96545]
As the testcase shows, we would ICE if the type of the first argument of various atomic builtins was pointer to (non-void) incomplete type, we would assume that TYPE_SIZE_UNIT must be non-NULL. This patch diagnoses it instead. And also changes the TREE_CODE != INTEGER_CST check to !tree_fits_uhwi_p, as we use tree_to_uhwi after this and at least in theory the int could be too large and not fit.
2020-08-11 Jakub Jelinek jakub@redhat.com
PR c/96545 * c-common.c (get_atomic_generic_size): Require that first argument's type points to a complete type and use tree_fits_uhwi_p instead of just INTEGER_CST TREE_CODE check for the TYPE_SIZE_UNIT.
* c-c++-common/pr96545.c: New test.
(cherry picked from commit 7840b4dc05539cf5575b3e9ff57ff5f6c3da2cae) --- gcc/c-family/c-common.c | 9 ++++++++- gcc/testsuite/c-c++-common/pr96545.c | 31 +++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-)
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 20258c331af..b6eb40c8122 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -6948,8 +6948,15 @@ get_atomic_generic_size (location_t loc, tree function, return 0; }
+ if (!COMPLETE_TYPE_P (TREE_TYPE (type_0))) + { + error_at (loc, "argument 1 of %qE must be a pointer to a complete type", + function); + return 0; + } + /* Types must be compile time constant sizes. */ - if (TREE_CODE ((TYPE_SIZE_UNIT (TREE_TYPE (type_0)))) != INTEGER_CST) + if (!tree_fits_uhwi_p ((TYPE_SIZE_UNIT (TREE_TYPE (type_0))))) { error_at (loc, "argument 1 of %qE must be a pointer to a constant size type", diff --git a/gcc/testsuite/c-c++-common/pr96545.c b/gcc/testsuite/c-c++-common/pr96545.c new file mode 100644 index 00000000000..bc6b0cf345c --- /dev/null +++ b/gcc/testsuite/c-c++-common/pr96545.c @@ -0,0 +1,31 @@ +/* PR c/96545 */ +/* { dg-do compile } */ + +extern char x[], y[], z[]; +struct S; +extern struct S s, t, u; +int v, w; + +void +foo (void) +{ + __atomic_exchange (&x, &y, &z, 0); /* { dg-error "must be a pointer to a complete type" } */ +} + +void +bar (void) +{ + __atomic_exchange (&s, &t, &u, 0); /* { dg-error "must be a pointer to a complete type" } */ +} + +void +baz (void) +{ + __atomic_exchange (&v, &t, &w, 0); /* { dg-error "size mismatch in argument 2 of" } */ +} + +void +qux (void) +{ + __atomic_exchange (&v, &w, &t, 0); /* { dg-error "size mismatch in argument 3 of" } */ +} </cut>
linaro-toolchain@lists.linaro.org