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

--- Comment #13 from Siddhesh Poyarekar <siddhesh at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #12)
> (In reply to Siddhesh Poyarekar from comment #11)
> > OK, so we don't really need a FAM based reproducer either, here's one
> > without it.  FAM just makes this case more likely because due to it, __bdos
> > succeeds more often in the kernel code:
> 
> And the problem with that is what?
> Using warning attribute with __bdos based guards makes no sense.
> __bdos is intentionally dynamic, so often it doesn't yield a constant, e.g.
> can result in minimum of a constant and some variable.
> With warning attribute you get a warning whenever it doesn't fold into a
> constant.

Ahh sorry, I should have clarified, the kernel code is not exactly that, it is
of the form:

  if ((__builtin_constant_p (__builtin_dynamic_object_size(sdata->mcast_rate,
1) 
       < sizeof (sdata->mcast_rate)))
      && (__builtin_dynamic_object_size(sdata->mcast_rate, 1) 
          < sizeof (sdata->mcast_rate)))
    __warn ();

I'll fix it up with the test case.

Reply via email to