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.129.124]) by sourceware.org (Postfix) with ESMTPS id E83353858C2C for ; Tue, 21 Dec 2021 16:13:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org E83353858C2C Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-101-PO5exVTWMsujK3MnYIBIuA-1; Tue, 21 Dec 2021 11:13:12 -0500 X-MC-Unique: PO5exVTWMsujK3MnYIBIuA-1 Received: by mail-qv1-f70.google.com with SMTP id kk20-20020a056214509400b004110a8ba7beso10161180qvb.20 for ; Tue, 21 Dec 2021 08:13:12 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=olIhswftrXyx0NUvT3hP96GWhQuOT8DgAccvZ7yC2lQ=; b=qJOJdTTDHYnq6nY9EErUOXPRINDB5ICN/lBRM2LIcjNszlnl6sFVKE1L+9JNyrvUMo /uyd4+2GmIS+fUjsrob8lSHiAKpDJB4U4QakTB7Acr/QE73YIY0gOgBI6/dCZaIK9KDs b1CrRcWmUqZJdYdb0e2F3TWQx1DlTgoQyyf3S26Jw43MKdWlwWb68cGmxjiiJPk/nmGP K2SyDS58EZkJeMMnm2H5FIPgU1CBEtNT1IpQIUkM0CKuinnxNKKEmEVchR9Xjf9buh2b Q4DJ87WS2NVoq289YqWh/SoPpwylhRLfgiOeveb6eU52DLmQhqji9FVzBAOXx9+y9+x3 AIIw== X-Gm-Message-State: AOAM5302QOzmqFeJ6/50+2bvQheNOhFg6tLvMR4KkW9v3W7/tTzpMVYI FVTGoKf8pcAmWoxbfA7F0g3HnestPs98OEz9BOTkJ/Mq9yblw1xAfki3dJpNjK4Ugf3pRxvjByi LfQrLiE9oF+n7tg== X-Received: by 2002:a05:622a:307:: with SMTP id q7mr2850236qtw.330.1640103191957; Tue, 21 Dec 2021 08:13:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5UExUx3VhLXA8bfwaDZ5/U4zNgDNMOhBPTeOg/OFgWHml8AG0gf4ePhdsq/jtZZLpkGQ3bA== X-Received: by 2002:a05:622a:307:: with SMTP id q7mr2850200qtw.330.1640103191683; Tue, 21 Dec 2021 08:13:11 -0800 (PST) Received: from [192.168.0.129] ([81.0.47.68]) by smtp.gmail.com with ESMTPSA id z5sm15975515qti.57.2021.12.21.08.13.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 21 Dec 2021 08:13:11 -0800 (PST) Message-ID: <0210178a-c875-fcbd-009f-5f438a098709@redhat.com> Date: Tue, 21 Dec 2021 17:13:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.3.0 Subject: Re: broken code only when optimized "-O2" To: Stefan Ring Cc: gcc-help References: From: Adrian Moreno 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: 8bit X-Spam-Status: No, score=-4.1 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_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-help@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-help mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Dec 2021 16:13:14 -0000 Hi Stefan, On 12/21/21 17:05, Stefan Ring wrote: > On Tue, Dec 21, 2021 at 4:40 PM Adrian Moreno via Gcc-help > wrote: >> >> I'd really appreciate any hint or idea to try to understand this problem. > > I guess the compiler doesn't like the dereferencing of uninitialized > pointers (in the sizeof expressions). I am not 100% sure that this > counts as dereferencing, but I would assume so. Because of this the > compiler will be free to behave however it likes to. > I agree that doesn't look good. Replacing them by sizeof (struct ___) expressions does not change the behavior though. Thanks -- Adrián Moreno