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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Keywords|                            |diagnostic
             Blocks|                            |56456
   Last reconfirmed|                            |2022-04-29
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC threads the Initialize_type check and effectively sees

  if (Initialize_type)
    {
      if (virt_core >= 0)
        return;
      int phys_core = VirtualToPhysicalCoreMap[virt_core]; // virt_core is
negative
      if (phys_core)
        external();
    }
  else
    {
       int phys_core = VirtualToPhysicalCoreMap[virt_core];
       if (phys_core && Initialize_type == Kernel)
         external();
    }

it should probably warn that virt_core is negative, not that it is literally -1
here.

I agree the diagnostic can be improved, but telling the user the execution
path considered is probably difficult (at best we might somehow be able to
emit a maybe warning).

Still there's an obvious defect in your program that's worth fixing, possibly
by refactoring of this code.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56456
[Bug 56456] [meta-bug] bogus/missing -Warray-bounds

Reply via email to