From owner-svn-src-head@freebsd.org Fri Aug 23 18:26:21 2019 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D437ACB48B; Fri, 23 Aug 2019 18:26:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-io1-f66.google.com (mail-io1-f66.google.com [209.85.166.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46FVGP4tS9z43Z7; Fri, 23 Aug 2019 18:26:21 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-io1-f66.google.com with SMTP id j5so22193312ioj.8; Fri, 23 Aug 2019 11:26:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc:content-transfer-encoding; bh=E1Yqkly/AW5C/cUEgM3+cPpBdRAikXNNitRGsxCpkHg=; b=qlaLPOYR6Fd5yHUHAF791d1bYksk0kB0HguiXjWrihn2+4hE3JnO+qyYmzAgseWSpy WJ2D1YsE3OCiNpW/4OJipbuBFscVxqvdLx/UVkVJTeNCEfDSVHkzCWCA7hubgEDRhed9 SDGHZQToY4RXZRGZZXhsL8Pt6+SCeU0UjAUKP7Rhul7D1j4mRKNeNvJgzUr6+zmbOi7O MNbs3bB/Q/36Ls1pzdmk8R4zhkmAlcdhZoct7yuEy166scq99zBIP2nyQxC3qiyl3WoB AxfI6GJsCp2VGC/HYtXYWTWFDg6Lknp8NJZR71H69E+Sk+ArIbZMg0OdNJ5l3iUFFuQI A+7g== X-Gm-Message-State: APjAAAV+YajyaZPtm3nGHiajvexBOwcT73Q7d8Ze9giMYDyXSEaEziIi 6bMiGY2zt2paOVZx62eeuor5GGOl X-Google-Smtp-Source: APXvYqxBPcS4+GuoCyKA8Psn+K4fuExNqWgPHagzyE2s6qkSJNlDjHInNNLwhEadwW8y0aF6Dvr48Q== X-Received: by 2002:a6b:f910:: with SMTP id j16mr7868234iog.305.1566584779691; Fri, 23 Aug 2019 11:26:19 -0700 (PDT) Received: from mail-io1-f48.google.com (mail-io1-f48.google.com. [209.85.166.48]) by smtp.gmail.com with ESMTPSA id a7sm2691088iok.41.2019.08.23.11.26.19 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 23 Aug 2019 11:26:19 -0700 (PDT) Received: by mail-io1-f48.google.com with SMTP id z3so22287609iog.0; Fri, 23 Aug 2019 11:26:19 -0700 (PDT) X-Received: by 2002:a5e:c101:: with SMTP id v1mr7462317iol.231.1566584778871; Fri, 23 Aug 2019 11:26:18 -0700 (PDT) MIME-Version: 1.0 References: <201908220002.x7M028Jh070116@repo.freebsd.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Fri, 23 Aug 2019 11:26:07 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto To: "Bjoern A. Zeeb" Cc: Warner Losh , Li-Wen Hsu , John Baldwin , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 46FVGP4tS9z43Z7 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.97 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; NEURAL_HAM_SHORT(-0.97)[-0.973,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Aug 2019 18:26:21 -0000 At expected peril of wading into a thread >4 emails deep, @Warner, modern GCC reports a similar warning; it just doesn't become an error (at least in CI?). I'm not sure of the mechanism. Maybe CI-specific? Old GCC didn't have a -Wno-error for -Wcast-qual, so -Wcast-qual + -Werror there produced an error; that's why $NO_WCAST_QUAL in conf/kern.mk is defined to -Wno-cast-qual for old GCC but -Wno-error=3Dcast-qual for newer compilers. That said, this file does not appear to be compiled with ${NO_WCAST_QUAL} either way. @Bjoern, So... why does GCC warn about this? key is const uint8_t*. The cast is to const des_cblock *. I think the problem is that des_cblock is defined as 'unsigned char [8]', so a 'const des cblock *' is actually a 'const unsigned char**'? So... I think basically the entire des subsystem may be accidentally using the wrong pointer level throughout? The constify change just exposes that because correct const-preserving cast of 'const foo*' to 'foo**' would be 'foo * const *' (if I'm understanding this correctly). Maybe one more reason to excise des from the tree. Best, Conrad On Fri, Aug 23, 2019 at 9:59 AM Bjoern A. Zeeb wrote: > > On 23 Aug 2019, at 16:48, Warner Losh wrote: > > There's a lot of -Wno-error and -Wno-error=3DXXX sprinkled in our build > > for > > gcc 4.2.1 today, so we see the warnings but aren't stopped by them. My > > changes take a big hammer and add a global -Wno-error to CFLAGS last > > to > > make this the behavior on gcc 4.2.1 platforms. > > > Yes, but that didn=E2=80=99t answer my questions. It doesn=E2=80=99t hel= p to try to > avoid undefined C behaviour. > > That jenkins build seems to use the toolchain from ports and with that > gcc 6.4.0. > > We see the same warning but it didn=E2=80=99t error as it seems to have d= one > for other architectures with the in-tree gcc with the same warnings: > > In file included from /workspace/src/sys/opencrypto/xform.c:94:0: > /workspace/src/sys/opencrypto/xform_des1.c: In function 'des1_setkey': > /workspace/src/sys/opencrypto/xform_des1.c:102:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *) key, p[0]); > ^ > In file included from /workspace/src/sys/opencrypto/xform.c:95:0: > /workspace/src/sys/opencrypto/xform_des3.c: In function 'des3_setkey': > /workspace/src/sys/opencrypto/xform_des3.c:103:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 0), p[0]); > ^ > /workspace/src/sys/opencrypto/xform_des3.c:104:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 8), p[1]); > ^ > /workspace/src/sys/opencrypto/xform_des3.c:105:15: warning: cast > discards 'const' qualifier from pointer target type [-Wcast-qual] > des_set_key((const des_cblock *)(key + 16), p[2]); > ^ > -- > > > > To me this means that we treat different versions of compilers (in-tree > and out-of-tree, gcc vs. clang) too different. > > If two versions of gcc (before your commit) gave the same warning I > would have expected them to equally fail and not one fail and one pass? > > My question was: why was that the case? > > /bz >