Am Dienstag, 17. März 2026, 00:26:14 Mitteleuropäische Normalzeit schrieb
David Malcolm:
> > > diff --git a/gcc/analyzer/region-model.cc b/gcc/analyzer/region-
> > > model.cc
> > > index 4a6f5b4800c..1935b3a45fa 100644
> > > --- a/gcc/analyzer/region-model.cc
> > > +++ b/gcc/analyzer/region-model.cc
> > > @@ -4116,6 +4116,11 @@ static bool
> > >
> > > struct_or_union_with_inheritance_p (tree struc)
> > > {
[...]
> > > + while (iter && TREE_CODE (iter) == TYPE_DECL)
> >
> > Let's make this != FIELD_DECL, since that's what the function is
> > looking
> > for. Does that sound right to you, David?
>
> I think this is missing an update to the existing "while" loop in
> struct_or_union_with_inheritance_p. If there are non-field decls
> appearing after a trailing array, that could cause false negatives.
> If I'm understanding the rest of the patch correctly, I think we want
> to update the assignment to last_field in the existing while loop so
> that it's only set when iter is a FIELD_DECL.
I am not sure if this should be addressed by this patch.
As the only thing changes is, that now TYPE_DECLs could appear in
"random" places within the list, while they were all confined to the end of
the list before, the relative order of the non-TYPE_DECLS to each
other did not change.
Therefore, if this code would deliver false positives if
- the first non-TYPE_DECL member is not a FIELD_DECL
- TYPE_FIELDS has TYPE_DECLS after data members
then the code failed before, and this may introduce a change
in behaviour i am not confident to deal with.
I may be wrong though, and if the consens is, that this should
be part of this series, I'll include the proposed changes.
Thomas
signature.asc
Description: This is a digitally signed message part.
