Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2019 16:05:26 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        "Conrad E. Meyer" <cem@freebsd.org>
Cc:        "Bjoern A. Zeeb" <bz@freebsd.org>, Li-Wen Hsu <lwhsu@freebsd.org>, John Baldwin <jhb@freebsd.org>,  src-committers <src-committers@freebsd.org>, svn-src-all <svn-src-all@freebsd.org>,  svn-src-head <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r351364 - in head/sys: crypto/blowfish crypto/chacha20 crypto/des opencrypto
Message-ID:  <CANCZdfrDQ7bEW1UYsxnOzn49SW28tEbixs7hEFsuwuA_ZL2FOA@mail.gmail.com>
In-Reply-To: <CAG6CVpVoJ_SLJy%2BMKB84fokuj89mfYDMLZJC7vZuK2efTyEXhw@mail.gmail.com>
References:  <201908220002.x7M028Jh070116@repo.freebsd.org> <DC49D260-C049-47F3-ADFA-76D793212E16@FreeBSD.org> <0b9d1aa1-d328-30bc-b939-f1407e236855@FreeBSD.org> <CANCZdfq7FOsQNkpRgHZP3yzxhfcGv5gLOzco7tGttTVSrETOfQ@mail.gmail.com> <3EE09B22-254B-4415-8865-D9542122ACA5@FreeBSD.org> <CANCZdfq6CRQcZuMr6X%2BTyFwCZm2FFx7qSbZcq%2BD4sUsbE7x3pg@mail.gmail.com> <D9BE08F9-7513-43E7-91D9-27814115BE43@FreeBSD.org> <CAG6CVpVoJ_SLJy%2BMKB84fokuj89mfYDMLZJC7vZuK2efTyEXhw@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Aug 23, 2019 at 12:26 PM Conrad Meyer <cem@freebsd.org> wrote:

> 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.
>

Yea. I'm unsure. It's an odd warning, and an odd way to get around it. In
general, nobody cares about gcc 4.2.1, so pinning implementing that belief
to this specific bug may have been unwise. I just assumed newer versions
wouldn't warn on this, but I saw on IRC that the types are stupidly
different...


> @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.


Ha! No comment :)

Warner


> Best,
> Conrad
>
>
> On Fri, Aug 23, 2019 at 9:59 AM Bjoern A. Zeeb <bz@freebsd.org> 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 bui=
ld
> > > for
> > > gcc 4.2.1 today, so we see the warnings but aren't stopped by them. M=
y
> > > 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 h=
elp 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=
 done
> > 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
> >
>



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrDQ7bEW1UYsxnOzn49SW28tEbixs7hEFsuwuA_ZL2FOA>