From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id 7CFDE3858C52 for ; Wed, 14 Sep 2022 21:04:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7CFDE3858C52 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-wm1-x332.google.com with SMTP id n23-20020a7bc5d7000000b003a62f19b453so16363818wmk.3 for ; Wed, 14 Sep 2022 14:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=list-id:mime-version:subject:message-id:cc:to:date:from:from:to:cc :subject:date; bh=phvAHO8K0TwYuAb9A0FN229hZYYS09MEEsX9fjwxL7E=; b=FrNRFV0WcqQl3pfC5N77ADP1B11KJ6+i3KFNNydM0bBAb1pae6rXLEEpONCu0yq6tb 92YOFlLhrcqALe995RWscREMwaQXWkgKgc5s6VO4a+81H4wFhnZ7tVoaQ5CsewBhGV4z d1f2+PxmX2SyQlClNd7WilFkWrvY471u85i0iJyYjh5s2i7aajwk9rSCLfAA1mPpn5bU zlurl1UPjIuNwdd5zAjuT6bU1n9beZFIXK6248B3HpBwHtxniXYREMtjYaRMciRS6DMr Z6pz6JIKoHmRMOibB1nbdOdRghKDtkZ6bzj6g2jLXlSWzt7SKNnosFiTNBBoTYwRL2Fg ZIHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-id:mime-version:subject:message-id:cc:to:date:from :x-gm-message-state:from:to:cc:subject:date; bh=phvAHO8K0TwYuAb9A0FN229hZYYS09MEEsX9fjwxL7E=; b=vTch8ms9aOOl1x6UjgSORNUs1JmXz4xomEFRxqLk1/bQp2edOkEasDIIFeDyyhtgxk j/E3E7xa4o5G2C6h6wWBJ+5i9jAz0RfYYEyLq/awQm2emOp9h4oh91mEEAV1AJXKWdb7 YU+P4qyUOYftHbjkcCF9ntCs4i9D5l+dvow4JRAonMTvnQ9AcTyv5qKTeRWlnY2M1hmx m25RorGxnwdv5lt7XEi5OmCJQwIsMPK1kbY6xXMITi+vWFtYi4ECpop7oz+/UWW8ADVG FxOz+8CV0rRFncXlLfXP5zS0d0YjovDE8PMWnhvWhZtpZDAQ1ZOzb8Gb1xZYQhLEmKjk ysjw== X-Gm-Message-State: ACgBeo2r4J4aYQUQUKk6YQY6FvWK/5xqen6f25yiLw3mtVS8cARKVsTx q+Mvrca0hAMF+DgdJkiLsbg0RQ== X-Google-Smtp-Source: AA6agR4WL4VfdnMUo3U6Ew0daNKWZ6DWhe6nZ40B8RvNFhrM4aAetdqwEkw9tvZiC9/HM3v74kCIpA== X-Received: by 2002:a05:600c:524d:b0:3b4:8ad0:6d with SMTP id fc13-20020a05600c524d00b003b48ad0006dmr4606192wmb.194.1663189477926; Wed, 14 Sep 2022 14:04:37 -0700 (PDT) Received: from jenkins.jenkins (ci.linaro.org. [88.99.136.175]) by smtp.gmail.com with ESMTPSA id y1-20020adfdf01000000b0022a297950cesm279518wrl.23.2022.09.14.14.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Sep 2022 14:04:37 -0700 (PDT) From: ci_notify@linaro.org X-Google-Original-From: linaro-infrastructure-errors@lists.linaro.org Date: Wed, 14 Sep 2022 21:04:35 +0000 (UTC) To: Jakub Jelinek Cc: gcc-regression@gcc.gnu.org Message-ID: <983351409.19445.1663189477240@jenkins.jenkins> Subject: [TCWG CI] Failure after basepoints/gcc-13-2658-g645ef01a463: Disallow pointer operands for |, ^ and partly & [PR106878] MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_19444_27444394.1663189476161" X-Jenkins-Job: TCWG Build tcwg_gnu_native_build/master-arm X-Jenkins-Result: SUCCESS List-ID: X-Spam-Status: No, score=-13.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org ------=_Part_19444_27444394.1663189476161 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Failure after basepoints/gcc-13-2658-g645ef01a463: Disallow pointer operands for |, ^ and partly & [PR106878]: Results changed to -10 # true: 0 # build_abe binutils: 1 # build_abe gcc: 2 # build_abe linux: 4 # build_abe glibc: # FAILED # First few build errors in logs: # 00:00:27 fmtmsg.c:100:1: error: type mismatch in binary expression # 00:00:27 fmtmsg.c:100:1: error: type mismatch in binary expression # 00:00:27 fmtmsg.c:100:1: internal compiler error: verify_gimple failed # 00:00:28 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/glibc-glibc.git~master/stdlib/fmtmsg.o] Error 1 # 00:00:28 fmtmsg.c:100:1: error: type mismatch in binary expression # 00:00:28 fmtmsg.c:100:1: error: type mismatch in binary expression # 00:00:28 fmtmsg.c:100:1: internal compiler error: verify_gimple failed # 00:00:28 make[2]: *** [../o-iterator.mk:9: /home/tcwg-buildslave/workspace/tcwg_gnu_10/abe/builds/armv8l-unknown-linux-gnueabihf/armv8l-unknown-linux-gnueabihf/glibc-glibc.git~master/stdlib/fmtmsg.os] Error 1 # 00:00:29 make[1]: *** [Makefile:484: stdlib/subdir_lib] Error 2 # 00:00:29 make: *** [Makefile:9: all] Error 2 from -10 # true: 0 # build_abe binutils: 1 # build_abe gcc: 2 # build_abe linux: 4 # build_abe glibc: 5 # build_abe gdb: 6 THIS IS THE END OF INTERESTING STUFF. BELOW ARE LINKS TO BUILDS, REPRODUCTION INSTRUCTIONS, AND THE RAW COMMIT. For latest status see comments in https://linaro.atlassian.net/browse/GNU-692 . Status of basepoints/gcc-13-2658-g645ef01a463 commit for tcwg_gnu_native_build: commit 645ef01a463f15fc230e2155719c7a12cec89acf Author: Jakub Jelinek Date: Wed Sep 14 12:36:36 2022 +0200 Disallow pointer operands for |, ^ and partly & [PR106878] My change to match.pd (that added the two simplifications this patch touches) results in more |/^/& assignments with pointer arguments, but since r12-1608 we reject pointer operands for BIT_NOT_EXPR. Disallowing them for BIT_NOT_EXPR and allowing for BIT_{IOR,XOR,AND}_EXPR leads to a match.pd maintainance nightmare (see one of the patches in the PR), so either we want to allow pointer operand on BIT_NOT_EXPR (but then we run into issues e.g. with the ranger which expects it can emulate BIT_NOT_EXPR ~X as - 1 - X which doesn't work for pointers which don't support MINUS_EXPR), or the following patch disallows pointer arguments for all of BIT_{IOR,XOR,AND}_EXPR with the exception of BIT_AND_EXPR with INTEGER_CST last operand (for simpler pointer realignment). I had to tweak one reassoc optimization and the two match.pd simplifications. 2022-09-14 Jakub Jelinek PR tree-optimization/106878 * tree-cfg.cc (verify_gimple_assign_binary): Disallow pointer, reference or OFFSET_TYPE BIT_IOR_EXPR, BIT_XOR_EXPR or, unless the second argument is INTEGER_CST, BIT_AND_EXPR. * match.pd ((type) X op CST -> (type) (X op ((type-x) CST)), (type) (((type2) X) op Y) -> (X op (type) Y)): Punt for POINTER_TYPE_P or OFFSET_TYPE. * tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): For pointers cast them to pointer sized integers first. * gcc.c-torture/compile/pr106878.c: New test. * master-arm ** Failure after basepoints/gcc-13-2658-g645ef01a463: Disallow pointer operands for |, ^ and partly & [PR106878]: ** https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-arm/445/ Bad build: https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-arm/445/artifact/artifacts Good build: https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-arm/444/artifact/artifacts Reproduce current build: mkdir -p investigate-gcc-645ef01a463f15fc230e2155719c7a12cec89acf cd investigate-gcc-645ef01a463f15fc230e2155719c7a12cec89acf # Fetch scripts git clone https://git.linaro.org/toolchain/jenkins-scripts # Fetch manifests for bad and good builds mkdir -p bad/artifacts good/artifacts curl -o bad/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-arm/445/artifact/artifacts/manifest.sh --fail curl -o good/artifacts/manifest.sh https://ci.linaro.org/job/tcwg_gnu_native_build-build-master-arm/444/artifact/artifacts/manifest.sh --fail # Reproduce bad build (cd bad; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts) # Reproduce good build (cd good; ../jenkins-scripts/tcwg_gnu-build.sh ^^ true %%rr[top_artifacts] artifacts) Full commit (up to 1000 lines): commit 645ef01a463f15fc230e2155719c7a12cec89acf Author: Jakub Jelinek Date: Wed Sep 14 12:36:36 2022 +0200 Disallow pointer operands for |, ^ and partly & [PR106878] My change to match.pd (that added the two simplifications this patch touches) results in more |/^/& assignments with pointer arguments, but since r12-1608 we reject pointer operands for BIT_NOT_EXPR. Disallowing them for BIT_NOT_EXPR and allowing for BIT_{IOR,XOR,AND}_EXPR leads to a match.pd maintainance nightmare (see one of the patches in the PR), so either we want to allow pointer operand on BIT_NOT_EXPR (but then we run into issues e.g. with the ranger which expects it can emulate BIT_NOT_EXPR ~X as - 1 - X which doesn't work for pointers which don't support MINUS_EXPR), or the following patch disallows pointer arguments for all of BIT_{IOR,XOR,AND}_EXPR with the exception of BIT_AND_EXPR with INTEGER_CST last operand (for simpler pointer realignment). I had to tweak one reassoc optimization and the two match.pd simplifications. 2022-09-14 Jakub Jelinek PR tree-optimization/106878 * tree-cfg.cc (verify_gimple_assign_binary): Disallow pointer, reference or OFFSET_TYPE BIT_IOR_EXPR, BIT_XOR_EXPR or, unless the second argument is INTEGER_CST, BIT_AND_EXPR. * match.pd ((type) X op CST -> (type) (X op ((type-x) CST)), (type) (((type2) X) op Y) -> (X op (type) Y)): Punt for POINTER_TYPE_P or OFFSET_TYPE. * tree-ssa-reassoc.cc (optimize_range_tests_cmp_bitwise): For pointers cast them to pointer sized integers first. * gcc.c-torture/compile/pr106878.c: New test. --- gcc/match.pd | 6 +++++- gcc/testsuite/gcc.c-torture/compile/pr106878.c | 15 +++++++++++++++ gcc/tree-cfg.cc | 20 ++++++++++++++++++-- gcc/tree-ssa-reassoc.cc | 16 +++++++++++++++- 4 files changed, 53 insertions(+), 4 deletions(-) diff --git a/gcc/match.pd b/gcc/match.pd index 17318f523fb..345bcb701a5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1763,6 +1763,8 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && (int_fits_type_p (@1, TREE_TYPE (@0)) || tree_nop_conversion_p (TREE_TYPE (@0), type))) || types_match (@0, @1)) + && !POINTER_TYPE_P (TREE_TYPE (@0)) + && TREE_CODE (TREE_TYPE (@0)) != OFFSET_TYPE /* ??? This transform conflicts with fold-const.cc doing Convert (T)(x & c) into (T)x & (T)c, if c is an integer constants (if x has signed type, the sign bit cannot be set @@ -1799,7 +1801,9 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (GIMPLE && TREE_CODE (@1) != INTEGER_CST && tree_nop_conversion_p (type, TREE_TYPE (@2)) - && types_match (type, @0)) + && types_match (type, @0) + && !POINTER_TYPE_P (TREE_TYPE (@0)) + && TREE_CODE (TREE_TYPE (@0)) != OFFSET_TYPE) (bitop @0 (convert @1))))) (for bitop (bit_and bit_ior) diff --git a/gcc/testsuite/gcc.c-torture/compile/pr106878.c b/gcc/testsuite/gcc.c-torture/compile/pr106878.c new file mode 100644 index 00000000000..c8457189437 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr106878.c @@ -0,0 +1,15 @@ +/* PR tree-optimization/106878 */ + +typedef __INTPTR_TYPE__ intptr_t; +typedef __UINTPTR_TYPE__ uintptr_t; +int a; + +int +foo (const int *c) +{ + uintptr_t d = ((intptr_t) c | (intptr_t) &a) & 65535 << 16; + intptr_t e = (intptr_t) c; + if (d != (e & 65535 << 16)) + return 1; + return 0; +} diff --git a/gcc/tree-cfg.cc b/gcc/tree-cfg.cc index e39d9471220..41ce1b29d17 100644 --- a/gcc/tree-cfg.cc +++ b/gcc/tree-cfg.cc @@ -4167,6 +4167,8 @@ verify_gimple_assign_binary (gassign *stmt) case ROUND_MOD_EXPR: case RDIV_EXPR: case EXACT_DIV_EXPR: + case BIT_IOR_EXPR: + case BIT_XOR_EXPR: /* Disallow pointer and offset types for many of the binary gimple. */ if (POINTER_TYPE_P (lhs_type) || TREE_CODE (lhs_type) == OFFSET_TYPE) @@ -4182,9 +4184,23 @@ verify_gimple_assign_binary (gassign *stmt) case MIN_EXPR: case MAX_EXPR: - case BIT_IOR_EXPR: - case BIT_XOR_EXPR: + /* Continue with generic binary expression handling. */ + break; + case BIT_AND_EXPR: + if (POINTER_TYPE_P (lhs_type) + && TREE_CODE (rhs2) == INTEGER_CST) + break; + /* Disallow pointer and offset types for many of the binary gimple. */ + if (POINTER_TYPE_P (lhs_type) + || TREE_CODE (lhs_type) == OFFSET_TYPE) + { + error ("invalid types for %qs", code_name); + debug_generic_expr (lhs_type); + debug_generic_expr (rhs1_type); + debug_generic_expr (rhs2_type); + return true; + } /* Continue with generic binary expression handling. */ break; diff --git a/gcc/tree-ssa-reassoc.cc b/gcc/tree-ssa-reassoc.cc index e13e2cb308d..f45e552a8cc 100644 --- a/gcc/tree-ssa-reassoc.cc +++ b/gcc/tree-ssa-reassoc.cc @@ -3608,10 +3608,14 @@ optimize_range_tests_cmp_bitwise (enum tree_code opcode, int first, int length, tree type2 = NULL_TREE; bool strict_overflow_p = false; candidates.truncate (0); + if (POINTER_TYPE_P (type1)) + type1 = pointer_sized_int_node; for (j = i; j; j = chains[j - 1]) { tree type = TREE_TYPE (ranges[j - 1].exp); strict_overflow_p |= ranges[j - 1].strict_overflow_p; + if (POINTER_TYPE_P (type)) + type = pointer_sized_int_node; if ((b % 4) == 3) { /* For the signed < 0 cases, the types should be @@ -3642,6 +3646,8 @@ optimize_range_tests_cmp_bitwise (enum tree_code opcode, int first, int length, tree type = TREE_TYPE (ranges[j - 1].exp); if (j == k) continue; + if (POINTER_TYPE_P (type)) + type = pointer_sized_int_node; if ((b % 4) == 3) { if (!useless_type_conversion_p (type1, type)) @@ -3671,7 +3677,7 @@ optimize_range_tests_cmp_bitwise (enum tree_code opcode, int first, int length, op = r->exp; continue; } - if (id == l) + if (id == l || POINTER_TYPE_P (TREE_TYPE (op))) { code = (b % 4) == 3 ? BIT_NOT_EXPR : NOP_EXPR; g = gimple_build_assign (make_ssa_name (type1), code, op); @@ -3695,6 +3701,14 @@ optimize_range_tests_cmp_bitwise (enum tree_code opcode, int first, int length, gimple_seq_add_stmt_without_update (&seq, g); op = gimple_assign_lhs (g); } + type1 = TREE_TYPE (ranges[k - 1].exp); + if (POINTER_TYPE_P (type1)) + { + gimple *g + = gimple_build_assign (make_ssa_name (type1), NOP_EXPR, op); + gimple_seq_add_stmt_without_update (&seq, g); + op = gimple_assign_lhs (g); + } candidates.pop (); if (update_range_test (&ranges[k - 1], NULL, candidates.address (), candidates.length (), opcode, ops, op, ------=_Part_19444_27444394.1663189476161--