From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 9717038618AB for ; Thu, 15 Feb 2024 15:31:15 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9717038618AB Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9717038618AB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::62a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708011077; cv=none; b=YQKpolf2ypDJqB0WOgkh555ryvcamsyR5ra4FzsLQbKiPlOo828GtMJOH27D1MgGoFbiS7XgGQ5ul6l3owPz/BGgLvkweUF3UmyITk6W426QsDSnXQdXApRL0HDBBQtz78ozSx/4QOox9m5VaCHssYZtlBYxe4mLvvnMOn4zA/g= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708011077; c=relaxed/simple; bh=fTEPqwJe+5CEprcM59nt5oDB2XJ7yk0mvq+pJk+TtTM=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=pd+N2hK0HQq8EKN9VcsD4qNhG5wNuk6Tv6f0d4Yuw8iDSh6EomDr/fegJVtpCDm3tHYJULsSgXearZxqYYyUs2riWbIFFBTewsGtW235W5RfMe0V5uW0L0X95sXM7BWKwcrLWl1GiSkQ6wtRuB/wlrFIrQVFJjC44ogm8BOLf8A= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-pl1-x62a.google.com with SMTP id d9443c01a7336-1d944e8f367so9222115ad.0 for ; Thu, 15 Feb 2024 07:31:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708011074; x=1708615874; darn=gcc.gnu.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=YcMRlLKHwuwLzdU0cH0B+EeWcUDURUrIkGvPKRNQPXM=; b=efEfnWWzhmZ8glhu8FJYgJRYb9yaE1pqTFZLrGZVxRG3Hxoh6czi1bObdkxQADAV60 5VBtFPFNsfIG2EfgI2fhzcMCKHh4mnhAUFP1VQqAz8zszAIBMPi4o5Ssv4SqCsLivDeW w6+3oEk6D/JMFGlDF/zAHhAb4qCMSG3dtMR9y25vUbghE2h3wBCNElptMoU2c8EnFxhS V071uipVmCOo5FpU92b3ZpfRsVdVQovTHyO2ePvD6eZuvuGoqaWVfAShNcDJgFZjPFS7 8Ozkd5OrgATkZYcSLwelh5VXEgYAHR8RkuLp3E3zl6S+XaIw+DTdWgK1172EzH6DHYGt gzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708011074; x=1708615874; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=YcMRlLKHwuwLzdU0cH0B+EeWcUDURUrIkGvPKRNQPXM=; b=FwB5W0oNWX8AYimWFa7OG8EANzs/AqOKZnYfbtuY6/RoehL51XZNUxJr7ZjoWu6AtS LBkqfFHn5WdHLjSzvPzYUTTIa4xpLAAHGokmrG4pkckd4ndVy2gPeJYyyRr8u8MlGI6K P2muJZPNku5Lx3Bs7y0N1XmfOgzG0pZkdHalCBIyiDnVxXipSarmIiDC9Rh10DeGPepE bN2wpMfqZ0dyn3I1DdbJxI6JZEbSy+Zl+QyZPIshiI0RUIpFhKjPtY2f0nfFqd+OPwAI iyYKI1s1yAv945vGxDaO/5+O+F3nvnl4+BdEHJRyNI8+jBTF53kqfkCWWxr+tdQIsoMl D1lg== X-Gm-Message-State: AOJu0YxZjLDg/BQgZTr20BNuchVDeLRVbCVY0eLeI6+rEC0/h/Epvlpd R+socKqZ72rmWd4cjvY86LiWx3eMiM+xyxwxqKbbmvBKxqkoJyZcwBJXXG4PoYghAWcj2bEiWL/ YF91GGtuiGAnGUquQyC7YtAPYTjYKRNwT X-Google-Smtp-Source: AGHT+IFBGObM8Cv3m+eq2Iyah6M87YGmKufW4LDJsA+0OWj3cn0VBnePMhF0t9hPiIuByLG6cjhBOe+0bO1ewQwJ2Cg= X-Received: by 2002:a17:90b:3685:b0:298:b86d:cca8 with SMTP id mj5-20020a17090b368500b00298b86dcca8mr1991544pjb.36.1708011074329; Thu, 15 Feb 2024 07:31:14 -0800 (PST) MIME-Version: 1.0 References: <20240214124123.GC19790@gate.crashing.org> In-Reply-To: <20240214124123.GC19790@gate.crashing.org> From: =?UTF-8?Q?J=C4=99drzej_Dudkiewicz?= Date: Thu, 15 Feb 2024 16:31:02 +0100 Message-ID: Subject: Re: Compiler message -Wunused confusion To: Segher Boessenkool Cc: gcc-help@gcc.gnu.org Content-Type: multipart/alternative; boundary="0000000000005ba22f06116d5194" X-Spam-Status: No, score=-0.2 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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: --0000000000005ba22f06116d5194 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 1:42=E2=80=AFPM Segher Boessenkool < segher@kernel.crashing.org> wrote: > On Wed, Feb 14, 2024 at 03:11:58AM -0800, A. Mc. via Gcc-help wrote: > > volatile bool foo; > > > > while (true) { > > if (foo =3D=3D true){ > > //do something > > foo =3D false;} > > else{ > > //do something else > > foo =3D true;} > > } > > > > Which never switches. What could be the cause of this? > > Your code assigns to foo, but never uses foo again. This is likely a > programming mistake, which is what the warning is for. > What do you mean by "never uses foo again"? In each iteration foo is compared to true and in each iteration it is flipped, so it should be true, false, true, false and so on. --=20 J=C4=99drzej Dudkiewicz I really hate this damn machine, I wish that they would sell it. It never does just what I want, but only what I tell it. --0000000000005ba22f06116d5194--