From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id 25C123858D39 for ; Tue, 28 Mar 2023 11:42:01 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 25C123858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680003720; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UbEDRe851CCQLfSDYV5zLXkykXC47f6N5lIjfMbeNNc=; b=ZelHc6n6dnV1kVx2vqTxi+6wNQvHGeSIYnfYG1vOsG17iEeUfzbtt3MxuqmaoV5NSlAnmW KGGSFUl6GSOIGYcbwM3j8REqant0rdELRAHitrcsNfOp9DCz4geK+AIi7M+/ZylyCjDMSr 5e/LH6gsXQ+OOC5gmJAN4iKF48L3HbY= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-642-PMGxljqvNgqt3qlKpVsFNg-1; Tue, 28 Mar 2023 07:41:59 -0400 X-MC-Unique: PMGxljqvNgqt3qlKpVsFNg-1 Received: by mail-qk1-f200.google.com with SMTP id ou5-20020a05620a620500b007423e532628so5461196qkn.5 for ; Tue, 28 Mar 2023 04:41:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680003718; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=UbEDRe851CCQLfSDYV5zLXkykXC47f6N5lIjfMbeNNc=; b=wed5Rrv8brwTeaO/OWj5he5PEHnhQpPj132MWShtRGMGTO6141yxhbOGDK1Njb+ABQ QydsUAzJR4erIEcA+qhjbXmhrViNLo5gGy3a141ebai08628lvlzvTSpd4d3PNu8nLz/ IHCiOo98L6KR6qrnVAQeMPI+5t1vg/XN8SRnNLItV0d6PCLYUbm4kqmsJTQNBXvG70Fi Y4TcRmoZ/y2UAFjWEYmpwuW8Ngymakq7eQvXJn1x4dUyrdbOdpRh5OOfUzgHGxKVjzmd QKODL75j4pHsPgpeA6DcU9zC1Dbkxq4SLGxKsKzN9Bl/H6zAeHXHvBnq7kv5aBEb8/bL rihg== X-Gm-Message-State: AO0yUKWIEk+NAg98QuE9xe4uVtpUROSolRIqjiYe11xdMmasFtjtAXIr DIZj4rMwWIEWIuZYebXZjO25288TP73NaXKipIGLLw1OyB8FYLXIrvRnnJKCOgrCatpzggA24CE Sg0oVXfhKlElcsMphxNQ4eOS5v/cnSJZYtI//stZ71AboKM0Bd9DeX3ZUeuPUnh3/c5Y= X-Received: by 2002:a05:622a:204:b0:3dc:ac3b:ca6c with SMTP id b4-20020a05622a020400b003dcac3bca6cmr36958780qtx.6.1680003718706; Tue, 28 Mar 2023 04:41:58 -0700 (PDT) X-Google-Smtp-Source: AK7set+bilgm8BNTvvFrhcN0iYlAlppv0okG56Wu98ko1GGSeRKFRbIwZjcCckqyOiQ7bXeFALOkKA== X-Received: by 2002:a05:622a:204:b0:3dc:ac3b:ca6c with SMTP id b4-20020a05622a020400b003dcac3bca6cmr36958745qtx.6.1680003718251; Tue, 28 Mar 2023 04:41:58 -0700 (PDT) Received: from [10.0.0.8] (cpc108963-cmbg20-2-0-cust520.5-4.cable.virginm.net. [80.5.214.9]) by smtp.gmail.com with ESMTPSA id o10-20020a05620a0d4a00b0074281812276sm11103153qkl.97.2023.03.28.04.41.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Mar 2023 04:41:57 -0700 (PDT) Message-ID: <56c2aabe-dbac-60b1-1531-e1e222036633@redhat.com> Date: Tue, 28 Mar 2023 12:41:56 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 To: gcc-help@gcc.gnu.org References: From: Andrew Haley Subject: Re: Problem understand optimization with inline asm In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE,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: On 3/28/23 12:15, Kalamatee via Gcc-help wrote: > Now, I can work around this by using "+" (even though I don't read the > variable), or initializing the value a second time in the asm block - but > should I have to? Yes. > This sounds like the compiler is doing the wrong thing > based on the assertion/assumption "=" means I will 100% change some > variable, That's what you've told GCC you will do. GCC doesn't look inside the asm statement to see if you really do it. > and worse after optimizing the code and creating a case where I > now have an uninitialized variable being used - does not warn me this is > happening? You've told GCC that you initialized the variable, and GCC believes you. If you lie to the compiler, it will get its revenge. > Would it not be better to interpret "=" to mean "may" change the value, > which would prevent it incorrectly optimizing the initialization away, or > if it does warn that the value may be used uninitialized? If we did that we'd have to add another pattern which means "definitely initialized". That would greatly complicate data flow analysis, for no very good reason. -- Andrew Haley (he/him) Java Platform Lead Engineer Red Hat UK Ltd. https://keybase.io/andrewhaley EAC8 43EB D3EF DB98 CC77 2FAD A5CD 6035 332F A671