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 ESMTP id 1130C3858402 for ; Fri, 24 Sep 2021 09:35:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 1130C3858402 Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-474-e8ZMLDc8MHuDxjpe8Juaug-1; Fri, 24 Sep 2021 05:35:08 -0400 X-MC-Unique: e8ZMLDc8MHuDxjpe8Juaug-1 Received: by mail-wr1-f69.google.com with SMTP id r15-20020adfce8f000000b0015df1098ccbso7585826wrn.4 for ; Fri, 24 Sep 2021 02:35:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fnrt2/tDuuuH9lWDwZKMmCenyNfIa4O6Qe890HtYoMQ=; b=Ns8qV95b5WR+AC7+ZAKyIO0G+Y9lG7JwNWfW7z17+5el4cRkIhGmJYfhkAF0Dudym5 qUkcTs1b/jFthTGGu8LwXqH7+lwdoh5XinOWkXY7z9LC0CInUCsqsmCv9pIkch5YUUAc E/iBtzNmyTSlTk5w7dgnrlk+1x8siwpf4k1SUCGRE9VXBAZzfeQTI1xVcGnL88TiUOlP g4bjUGcDxOT36CajJHofk4N8rdv04tEIqgQHz6sO7SbCjMT8IazWpKV1JEOlApO3vMFd KA6JTddYZx02LTtPdJ/zQ7iQbVvl+Pk5sLw+v/Ngv9tcEdvE3L5A665yPsA5K/x45c+8 7RHg== X-Gm-Message-State: AOAM530zpnJlGri6YWGhi4PrXAvdZMC4Xv5BbI74an9uoJnCi5jAqAkX gSgEhfWmG3qTklJR5fx6zDCgn8TaFyuVQ2oQIR8FIjy1KkIUXIT0ZFPHqUGTMQOC19Fs2oFuonp A3PBKNAQcBgnRWQhi1UbOOViwdKU+hQN5lxRLaZ68zRxMSPd3fmz4c6s= X-Received: by 2002:a7b:c459:: with SMTP id l25mr1058500wmi.60.1632476107175; Fri, 24 Sep 2021 02:35:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzBdlTNYllu9xwFvycb1Xj5b8iGLBr+PAdFLBX5VSB/YBiBreESk9FGoGoHpQ1M22I1CdneVg== X-Received: by 2002:a7b:c459:: with SMTP id l25mr1058470wmi.60.1632476106912; Fri, 24 Sep 2021 02:35:06 -0700 (PDT) Received: from abulafia.quesejoda.com ([139.47.33.227]) by smtp.gmail.com with ESMTPSA id j19sm7570589wra.92.2021.09.24.02.35.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 24 Sep 2021 02:35:06 -0700 (PDT) Subject: Re: Can gcc.dg/torture/pr67828.c be an infinite loop? To: Andrew Pinski Cc: GCC Mailing List References: <88e1b98b-083b-4e2f-01ba-895dae16c58e@redhat.com> From: Aldy Hernandez Message-ID: Date: Fri, 24 Sep 2021 11:35:05 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.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_LOW, RCVD_IN_MSPIKE_H2, 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@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Sep 2021 09:35:12 -0000 On 9/24/21 11:29 AM, Andrew Pinski wrote: > On Fri, Sep 24, 2021 at 1:05 AM Aldy Hernandez via Gcc wrote: >> >> Hi folks. >> >> My upcoming threading improvements turn the test below into an infinite >> runtime loop: >> >> int a, b; >> short c; >> >> int >> main () >> { >> int j, d = 1; >> for (; c >= 0; c++) >> { >> BODY: >> a = d; >> d = 0; >> if (b) >> { >> xprintf (0); >> if (j) >> xprintf (0); >> } >> } >> xprintf (d); >> exit (0); >> } >> >> On the false edge out of if(b) we thread directly to BODY, eliding the >> loop conditional, because we know that c>=0 because it could never overflow. > > Huh about c>=0 being always true? the expression, "c++" is really c= > (short)(((int)c)+1). So it will definitely wrap over when c is > SHRT_MAX. I see. Is this only for C++ or does it affect C as well? Aldy