[committed] analyzer: bitfield fixes [PR99212]

Christophe Lyon christophe.lyon@linaro.org
Thu Jun 17 12:52:56 GMT 2021


On Wed, 16 Jun 2021 at 00:03, David Malcolm <dmalcolm@redhat.com> wrote:
>
> On Wed, 2021-06-09 at 11:00 -0400, David Malcolm wrote:
> > On Wed, 2021-06-09 at 16:17 +0200, Christophe Lyon wrote:
> > > On Tue, 8 Jun 2021 at 21:34, David Malcolm via Gcc-patches
> > > <gcc-patches@gcc.gnu.org> wrote:
> > > >
> > > > This patch verifies the previous fix for bitfield sizes by
> > > > implementing
> > > > enough support for bitfields in the analyzer to get the test
> > > > cases
> > > > to pass.
> > > >
> > > > The patch implements support in the analyzer for reading from a
> > > > BIT_FIELD_REF, and support for folding BIT_AND_EXPR of a mask, to
> > > > handle
> > > > the cases generated in tests.
> > > >
> > > > The existing bitfields tests in data-model-1.c turned out to rely
> > > > on
> > > > undefined behavior, in that they were assigning values to a
> > > > signed
> > > > bitfield that were outside of the valid range of values.  I
> > > > believe
> > > > that
> > > > that's why we were seeing target-specific differences in the test
> > > > results (PR analyzer/99212).  The patch updates the test to
> > > > remove
> > > > the
> > > > undefined behaviors.
> > > >
> > > > Successfully bootstrapped & regrtested on x86_64-pc-linux-gnu.
> > > > Lightly tested with cris-elf.
> > > >
> > > > Pushed to trunk as r12-1303-
> > > > gd3b1ef7a83c0c0cd5b20a1dd1714b868f3d2b442.
>
> [...]
> > >
> > > This patch is causing regressions / new failures on armeb (and
> > > other
> > > targets according to gcc-testresults):
> > >
> > > FAIL: gcc.dg/analyzer/bitfields-1.c (test for excess errors)
> > > Excess errors:
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:24:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:26:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:29:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:31:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:36:3: warning: FALSE
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:41:3: warning: FALSE
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:81:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:83:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:85:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:87:3: warning: UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:92:3: warning: FALSE
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:94:3: warning: FALSE
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:96:3: warning: FALSE
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:113:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:115:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:117:3: warning:
>
>
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:119:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:121:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:123:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:125:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/bitfields-1.c:127:3: warning:
> > > UNKNOWN
> > >
> > > FAIL: gcc.dg/analyzer/data-model-1.c (test for excess errors)
> > > Excess errors:
> > > /gcc/testsuite/gcc.dg/analyzer/data-model-1.c:947:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/data-model-1.c:950:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/data-model-1.c:965:3: warning:
> > > UNKNOWN
> > > /gcc/testsuite/gcc.dg/analyzer/data-model-1.c:968:3: warning:
> > > UNKNOWN
> > >
> > > For instance with target armeb-none-linux-gnueabihf
> > >
> > > Can you check?
> >
> > Sorry about this; I can reproduce the behavior and am investigating.
> >
>
> These should be fixed by r12-1491-
> gec3fafa9ec7d16b9d89076efd3bac1d1af0502b8; see:
> https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572837.html
> (I forgot to set the reply-to to this when sending that, oops)
>
> Please let me know if either of these tests are still failing on any
> target.
>
> Sorry again about the breakage.

Fixed indeed, thanks

>
> Dave
>


More information about the Gcc-patches mailing list