From owner-freebsd-ppc@freebsd.org Fri Dec 16 04:42:40 2016 Return-Path: Delivered-To: freebsd-ppc@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D4B9CC76AAE for ; Fri, 16 Dec 2016 04:42:40 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-io0-x234.google.com (mail-io0-x234.google.com [IPv6:2607:f8b0:4001:c06::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9BB681612; Fri, 16 Dec 2016 04:42:40 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-io0-x234.google.com with SMTP id d9so88488206ioe.0; Thu, 15 Dec 2016 20:42:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:cc:message-id:from:to:in-reply-to:content-transfer-encoding :mime-version:subject:date:references; bh=kYao2+tZ7hamxShl13x7kBxY6EItCejzcwWYxG0J0KE=; b=s/Io4WkRMdQGw8G0A7NElf5WDiq0cH0my9yfXvQUNDXNwWjDFXqhqc0FkklWxVQhFz P803iqm+gTcd3V+320eFCK5jTJDRH6iK8v8bdPw7t2KajkXqODtEOKJMqtOL/Zpl8uNr zNuwh9yaTEV27+NPamuoNz7yrvgNERpD3ZDbWzY5b8cEDNIufROMTi0hwuYAsfzRY8po 2jMx6r4h6Fhupc6Njdc+RhisVuOoofW0nT1hWNI+52qResDaju7psLp6ruBGb3FAEWrD Z2XIXYeB0FSgTpjfD/e/4Xkr9IqYE2HpSmdAgLqsGz24+1YbCQIGW+U2lDU+xJ7IXrn0 /F4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:cc:message-id:from:to:in-reply-to :content-transfer-encoding:mime-version:subject:date:references; bh=kYao2+tZ7hamxShl13x7kBxY6EItCejzcwWYxG0J0KE=; b=JqRcZDTdSqx3URmSKXZQBfruXenJeahT6lOL2DPbiIMx/rhcCTOS5BtkUR1FWa4K4g p1Fp/J3xklIag7NtWx3CX9tBoypEjiGS3nV0oiMjXboaLyZmfgaeypQUXBlraG0R2Ac3 fixTRlarituts6YpLIUDSGgT1HpgQIaR7fKp5Ph49Ul40oBgCL3z+V9deifdgeTA+oO+ 8z9tsCmaJV8FiagzBZCflA55/DQDTf7DjiqEVWnDYGr52jQUJ9Z4AZO0g3+nWhagPNTz azERtwoNkPW2z9WkoIXCcyhLU6Wo3gWOsxY5sS+K4KA3R0NYol7Y6SoCVuZ9+6/ETXXh ZtOA== X-Gm-Message-State: AIkVDXI7OP11q2c4gRwQGxI+BXCPslVCj/q4uBJSq24y7MC7ZaejrQ7OPuw8+/ojRv+o4A== X-Received: by 10.107.198.21 with SMTP id w21mr1207817iof.111.1481863358849; Thu, 15 Dec 2016 20:42:38 -0800 (PST) Received: from blackstar.knownspace (50-80-150-234.client.mchsi.com. [50.80.150.234]) by smtp.gmail.com with ESMTPSA id l79sm770137itb.1.2016.12.15.20.42.37 (version=TLS1 cipher=AES128-SHA bits=128/128); Thu, 15 Dec 2016 20:42:38 -0800 (PST) Sender: Justin Hibbits Cc: Nathan Whitehorn , FreeBSD PowerPC ML Message-Id: <96CACD85-DED4-46C6-BBE3-53B4DEFF89DD@FreeBSD.org> From: Justin Hibbits To: Mark Millard In-Reply-To: <0661C9A5-5D4C-4F00-9B0C-F80688BED8A4@dsl-only.net> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Mime-Version: 1.0 (Apple Message framework v936) Subject: Re: sys/powerpc/powerpc/trap.c has messed up masking operation?: use of || for bit field masling Date: Thu, 15 Dec 2016 22:42:36 -0600 References: <0661C9A5-5D4C-4F00-9B0C-F80688BED8A4@dsl-only.net> X-Mailer: Apple Mail (2.936) X-BeenThere: freebsd-ppc@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Porting FreeBSD to the PowerPC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 16 Dec 2016 04:42:40 -0000 Hi Mark, On Dec 13, 2016, at 10:41 PM, Mark Millard wrote: > clang 3.9.0 is complaining about: > > --- trap.o --- > /usr/src/sys/powerpc/powerpc/trap.c:283:42: warning: use of logical > '||' with constant operand [-Wconstant-logical-operand] > frame->cpu.booke.dbcr0 &= ~(DBCR0_IDM || > DBCR0_IC); > ^ > ~~~~~~~~ > /usr/src/sys/powerpc/powerpc/trap.c:283:42: note: use '|' for a > bitwise operation > frame->cpu.booke.dbcr0 &= ~(DBCR0_IDM || > DBCR0_IC); > ^~ > | > Looking around: > > > # grep DBCR0_ /usr/src/sys/powerpc/include/spr.h > . . . > #define DBCR0_IDM 0x40000000 /* Internal Debug Mode */ > . . . > #define DBCR0_IC 0x08000000 /* Instruction > Completion debug event */ > . . . > > || use seems unlikely to be correct for the context. > Good find. Fixed in r310146, to be merged to stable/11 in a couple weeks. > > There is also this that I happened to notice sys/powerpc/powerpc/ > intr_machdep.c : > > --- intr_machdep.o --- > /usr/src/sys/powerpc/powerpc/intr_machdep.c:454:15: warning: > comparison of constant -1 with expression of type 'enum > intr_trigger' is always false [-Wtautological-constant-out-of-range- > compare] > if (i->trig == -1) > ~~~~~~~ ^ ~~ > /usr/src/sys/powerpc/powerpc/intr_machdep.c:500:16: warning: > comparison of constant -1 with expression of type 'enum > intr_trigger' is always false [-Wtautological-constant-out-of-range- > compare] > if (i->trig == -1) > ~~~~~~~ ^ ~~ This may or may not be a problem, depending on optimization settings. Can you file a bug for this so it doesn't get lost? > > There are other comparisons around with a constant > result at compile time. But they tend to be in less > central areas like zfs. Similarly for some other > types of compiler reports. > > === > Mark Millard > markmi at dsl-only.net > Thanks for the clang and external toolchain testing. Lots of good finds. - Justin