From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-x102b.google.com (mail-pj1-x102b.google.com [IPv6:2607:f8b0:4864:20::102b]) by sourceware.org (Postfix) with ESMTPS id 5549C3858D33 for ; Wed, 15 Feb 2023 19:50:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5549C3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-x102b.google.com with SMTP id w20-20020a17090a8a1400b00233d7314c1cso3377681pjn.5 for ; Wed, 15 Feb 2023 11:50:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=vNKcFXQ6ZG+3CnWJwFrqydVDj+wiKZ3abPe4jzMvjcE=; b=DeMiODjbAFRn+DE1Qi0S2HSmJ1c1pPGAeHVUSSZgVMnrrak/Wo3/4zoYYFZZ3hwBFg AlBXzj2FYd0KYeg9Jh3NjPHsKZeYiCeBHafqXRmauor2YvcoJNIB8OKTJbYM1X4asD/b VEDLidOyPoAAgN3Sk1SrGWMS4noJ2ybe/NqT8wypZvlhKmeGx7Ju+mrO5JoBEqV9NVLO H3lZqjSgKWQPqOSMTZ5tTMUsuXw0YrHJdQR11zcJqEbqN21SJ6H9WIXDGWcZ5/gLiNCO R0y+n/rBcUGdYizJ04mHHgYr1cK9ZqxnudPeKvou1BxFZmH3iGR3eywMJBCA84eDi2cR 9+4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=vNKcFXQ6ZG+3CnWJwFrqydVDj+wiKZ3abPe4jzMvjcE=; b=xcchyycRQtGrcqJAQGEe+oYJkwysARAgSk1jteQJJjmkRPWDrEdguRO2AV97MP58Bt veh92wbTs4WP4Svnn4SQuKlEwHABB0tlLpPNfiHjGnFxCrBgYG0zw6l3zEflUL45FoK3 ohhVXLUf59GV2B+/r8c4NrYbtCdg+/5zKb3jClGaV/hnVUnNF1bZZ1ct474JW2x1s7q9 sVAfxb8NUq8Ssq8gv+Gcv2ZQT4QGNmJJLRGH/6kxS2axF6m8j+c57Fgv9Uq42e9LQMH7 ki05s23wr1geQCI7FThE9NfIyx1SrdB5Ui1dHStI/ae3irNODUnqqej/aXE/GDNzJQgI Rl1A== X-Gm-Message-State: AO0yUKVTSUxuvPabSZuwte/MTcwTQdX50oW1SFipPL79Q/gdqwURxAL8 32+9MK10Y8yvdYCBq4CozYKYe2rM8pcPmj/2pDU= X-Google-Smtp-Source: AK7set9dugOF7OBy9fNPB5tfle2sPONfKs8LQv+BJIA7m1JncrKFKVF/VvjNdeQv7IjfoLQqa+Ef9Em58oBBFHsLzRY= X-Received: by 2002:a17:90b:3a84:b0:22c:7e3:6d9f with SMTP id om4-20020a17090b3a8400b0022c07e36d9fmr145456pjb.21.1676490614201; Wed, 15 Feb 2023 11:50:14 -0800 (PST) MIME-Version: 1.0 From: Andrew Pinski Date: Wed, 15 Feb 2023 11:50:02 -0800 Message-ID: Subject: get_range_query vs NULL argument To: Aldy Hernandez , Andrew MacLeod , GCC Mailing List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, While fixing PR 108354, I came across that ssa_name_has_boolean_range calls get_range_query with cfun as the argument but sometimes while in IPA passes cfun is currently nullptr. The question should we check the argument before calling get_range_query or is it a valid thing to call it with a nullptr (and have it return global_ranges in that case)? I committed the patch (for PR 108354) with the workaround around the issue via having the match.pd pattern which was calling ssa_name_has_boolean_range only be invoked from the gimple simplifiers. Below is the patch which undones the workaround: ``` diff --git a/gcc/match.pd b/gcc/match.pd index e7b700349a6..e352bd422f5 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -1732,7 +1732,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (!FIXED_POINT_TYPE_P (type)) (plus @0 (negate @1)))) -#if GIMPLE /* 1 - a is a ^ 1 if a had a bool range. */ /* This is only enabled for gimple as sometimes cfun is not set for the function which contains @@ -1743,7 +1742,6 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) (if (INTEGRAL_TYPE_P (type) && ssa_name_has_boolean_range (@1)) (bit_xor @1 @0))) -#endif /* Other simplifications of negation (c.f. fold_negate_expr_1). */ (simplify ``` Note I can only so far reproduce the call to ssa_name_has_boolean_range that causes an issue while building Ada tools (while bootstrapping) because the code that needs to hit this is related to variable sized type accesses. Thanks, Andrew Pinski