https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102228

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
For the PR101555 testcase if you can trust callgrind we get 4000 times
into build_class_member_access_expr and recurse 3000 times which means
on average we have two nested anon aggregates.  But then the
lookup_anon_field calls end up recursing 49000 times on the toplevel
and nearly 3 million times from recursive invocations.

So something is clearly at odds here and maybe the issue in the description
is not the one at hand for the testcase but it should be possible to
write a testcase with a deep nesting of anon aggregates running into the
issue in the description.

The following illustrates it:

struct X {
    struct {
        struct {
            struct {
                struct {
                    struct {
                        struct {
                            struct {
                                int i;
                            };
                        };
                    };
                };
            };
        };
    };
};

int foo (struct X *p)
{
  return p->i;
}

The testcase in PR101555 has

class Vara___024root {
...
    struct {
        struct {
             ... 60 members ...
        };
        struct {
             ... 60 members ...
        };
... repeat 100 times ...
    };
... repeat 100 times ...
};

so two levels deep but at each depth 100 anon aggregates :/  (most of
the actual members are never used)

Reply via email to