From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oa1-x34.google.com (mail-oa1-x34.google.com [IPv6:2001:4860:4864:20::34]) by sourceware.org (Postfix) with ESMTPS id 6F4BB3858CD1 for ; Sat, 9 Dec 2023 02:09:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 6F4BB3858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 6F4BB3858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2001:4860:4864:20::34 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702087747; cv=none; b=xeK4Iepw307MAVPVorCbE9hXxj0ENQnsIWN79iKir6nQjYNtcbOGusAyR/3wRH8BUuXbBMSrtyWZqWJJxZ66DwYOmUbXjxsWUeCsYJMDKaDG1wjhyP+k0DqBHYoQSCLJfDYqEzM/aJCJwSoHo9JFpwesZ7rQMECVM/rTtKtgc1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1702087747; c=relaxed/simple; bh=0su0mA8UavajOuakVsT2sghq/H+Z4sF3HZW9FZCj7M4=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=YfcHz+UDN2AdrNbUxdu4hn77VSfirGJXA6MjZdJqJpfhnJDtCh+PvYtQpo//i3AUAjbTJ/il75Q2lI4FxdN+/wxiFcli61fS6X/wP0d2SALvVGG2KmhleTpBtsKvwUcZjerrcbwgLqfuEbsnlvizc/qXv0iGbXOgu1O51+9H1G0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-oa1-x34.google.com with SMTP id 586e51a60fabf-1fb33059466so1561317fac.2 for ; Fri, 08 Dec 2023 18:09:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1702087743; x=1702692543; darn=gcc.gnu.org; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:from:to:cc:subject:date:message-id :reply-to; bh=mgSqgjhwDIyxEE2ZuE8mOKFAiuvsxwLZ2/qRZ5n6y/E=; b=FybPUs5ZQbBpu+igC69/o0qg3ar43vwyhKkqoXW34IoV3mSrU39XE/MCCBnIuilJiE Hw5TwJFNhjPvmLjV5XEx8VGvG3iQs9cY8J6/WnxGUBrBJeKqW2aaoH7pbFwgdysZooOE VSc9RWOzh/FxSmSWoWWnbB9f5EBl3VpDDlPiuJB6XV0imHZ3tw6L/65RtYDYcxXEdtEr 8qLP9Lr7iBza6xKLkp2nTfcbZUh/eYf72YdVZEVeiQmANgaxN9HzHM7JmRoIx29YaXxU EIqcawQ50JwBZzdB66/fKGy5bo4VLTJyJK2k3sxkiI//OhR1fTba6aP8Uew4JDu1PwUI tUGA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702087743; x=1702692543; h=mime-version:user-agent:message-id:in-reply-to:date:references :organization:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mgSqgjhwDIyxEE2ZuE8mOKFAiuvsxwLZ2/qRZ5n6y/E=; b=BSAHIQNIg6VZkjdOXoNEh6nKKezgZlp2/ZgQV7ALLkYu6jWNu9vUHygQtzflN+yqYN B5KJ0NAUb3rViM+R4U5I+nLmH9139AhmcnM7WNOg6k50NhE2wMSkH2NA+5dbHt9m6pdI sCO5Amg2g/Igm4kIIfFrPzPUg9Qmcltt3/v5vgPYTzGfSI69xN9A7f/ty/HtifKRuNzT nJ7uwXQdx1hxOxkJBAHilN0xk03lH6mBxI6LYNC1KCFdAuqhNQYVTio830OEGSb4p+CP 9l9adgB+YDtmLdafHtw6GwfgaG1lVitsBRI+shkXxkbkmtD+Y7WqdmqE1XGqrYeovTU9 ZHKQ== X-Gm-Message-State: AOJu0Yz53cNRzBuv6NvHmke3A/Tk+j+c1m/s9UIgIuADiVE2Y0hHMMGa qM/lHfyjTla5ebRa1NwBXdktsw== X-Google-Smtp-Source: AGHT+IGBLaVZphHess/ZGZ/LHlzRGplWz07XwD6BUCq/cuWmu79nrRL3kWSOGrn5Hc0bAJdBbspwXQ== X-Received: by 2002:a05:6870:80ce:b0:1fb:75a:6d4e with SMTP id r14-20020a05687080ce00b001fb075a6d4emr1217156oab.117.1702087743645; Fri, 08 Dec 2023 18:09:03 -0800 (PST) Received: from free.home ([2804:7f1:2080:b40a:22de:62ca:39d7:fbd4]) by smtp.gmail.com with ESMTPSA id h66-20020a636c45000000b005b9288d51f0sm2201570pgc.48.2023.12.08.18.09.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 08 Dec 2023 18:09:03 -0800 (PST) Received: from livre (livre.home [172.31.160.2]) by free.home (8.15.2/8.15.2) with ESMTPS id 3B928ncC317324 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT); Fri, 8 Dec 2023 23:08:50 -0300 From: Alexandre Oliva To: Jan Hubicka Cc: Richard Biener , gcc-patches@gcc.gnu.org, Jeremy Bennett , Craig Blackmore , Graham Markall , Martin Jambor , Jim Wilson , Jeff Law , Jakub Jelinek Subject: [PATCH] strub: add note on attribute access Organization: Free thinker, does not speak for AdaCore References: Date: Fri, 08 Dec 2023 23:08:49 -0300 In-Reply-To: (Alexandre Oliva's message of "Thu, 07 Dec 2023 18:39:58 -0300") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Scanned-By: MIMEDefang 2.84 X-Spam-Status: No, score=-12.3 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,WEIRD_QUOTING 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: On Dec 7, 2023, Alexandre Oliva wrote: > Thanks for raising the issue. Maybe there should be at least a comment > there, and perhaps some asserts to check that pointer and reference > types don't make to indirect_parms. Document why attribute access doesn't need the same treatment as fn spec, and check that the assumption behind it holds. Regstrapped on x86_64-linux-gnu. Ok to install? for gcc/ChangeLog * ipa-strub.cc (pass_ipa_strub::execute): Check that we don't add indirection to pointer parameters, and document attribute access non-interactions. --- gcc/ipa-strub.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/gcc/ipa-strub.cc b/gcc/ipa-strub.cc index 2afb7a455751d..8ec6824e8a802 100644 --- a/gcc/ipa-strub.cc +++ b/gcc/ipa-strub.cc @@ -2889,6 +2889,13 @@ pass_ipa_strub::execute (function *) && (tree_to_uhwi (TYPE_SIZE_UNIT (TREE_TYPE (nparm))) <= 4 * UNITS_PER_WORD)))) { + /* No point in indirecting pointer types. Presumably they + won't ever pass the size-based test above, but check the + assumption here, because getting this wrong would mess + with attribute access and possibly others. We deal with + fn spec below. */ + gcc_checking_assert (!POINTER_TYPE_P (TREE_TYPE (nparm))); + indirect_nparms.add (nparm); /* ??? Is there any case in which it is not safe to suggest the parms @@ -2976,7 +2983,9 @@ pass_ipa_strub::execute (function *) } } - /* ??? Maybe we could adjust it instead. */ + /* ??? Maybe we could adjust it instead. Note we don't need + to mess with attribute access: pointer-typed parameters are + not modified, so they can remain unchanged. */ if (drop_fnspec) remove_named_attribute_unsharing ("fn spec", &TYPE_ATTRIBUTES (nftype)); -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer More tolerance and less prejudice are key for inclusion and diversity Excluding neuro-others for not behaving ""normal"" is *not* inclusive