public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107476] New: Spurious stringop-overflow warning
@ 2022-10-31 17:10 pkoning at gcc dot gnu.org
  2022-10-31 17:11 ` [Bug c/107476] " pkoning at gcc dot gnu.org
  2023-05-19  3:21 ` [Bug tree-optimization/107476] " pinskia at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: pkoning at gcc dot gnu.org @ 2022-10-31 17:10 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 107476
           Summary: Spurious stringop-overflow warning
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pkoning at gcc dot gnu.org
  Target Milestone: ---

Created attachment 53803
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53803&action=edit
Reproducer.  Compile with -O3

The attached code produces a stringop-overflow warning complaining that the
code is writing into offset 1 of a one entry array (ttix_buf, reference in
ttix_svc).  In fact it does not, since the index is the control variable in a
for loop that ends on a < one check.

Curiously, if I increase the size of the ttix_buf array, I still see the error
at size 2 or 3, but no complaints at size 4 or above.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/107476] Spurious stringop-overflow warning
  2022-10-31 17:10 [Bug c/107476] New: Spurious stringop-overflow warning pkoning at gcc dot gnu.org
@ 2022-10-31 17:11 ` pkoning at gcc dot gnu.org
  2023-05-19  3:21 ` [Bug tree-optimization/107476] " pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pkoning at gcc dot gnu.org @ 2022-10-31 17:11 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from pkoning at gcc dot gnu.org ---
I should mention that I reproduced this (a) on an M1 Mac running gcc (GCC)
13.0.0 20220827 (experimental), and also on an x86 Linux running gcc (GCC)
12.2.0.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug tree-optimization/107476] Spurious stringop-overflow warning
  2022-10-31 17:10 [Bug c/107476] New: Spurious stringop-overflow warning pkoning at gcc dot gnu.org
  2022-10-31 17:11 ` [Bug c/107476] " pkoning at gcc dot gnu.org
@ 2023-05-19  3:21 ` pinskia at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-05-19  3:21 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
      Known to fail|                            |13.1.0

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
So it looks like there was some jump threading that happened here:
  if (one.0_59 > 1)
    goto <bb 12>; [50.00%]
  else
    goto <bb 18>; [50.00%]

  <bb 12> [local count: 131211251]:
  ivtmp.16_58 = (unsigned long) &MEM <struct TMLN[1]> [(void *)&ttx_ldsc +
520B];

  <bb 13> [local count: 131211252]:
  # ivtmp.14_38 = PHI <ivtmp.14_5(17), 1(12)>
  # ivtmp.16_18 = PHI <ivtmp.16_42(17), ivtmp.16_58(12)>
  _9 = (struct TMLN *) ivtmp.16_18;
  temp_10 = tmxr_getc_ln (_9);
  if (temp_10 != 0)
    goto <bb 14>; [50.00%]
  else
    goto <bb 17>; [50.00%]

But for some reason the trunk does not do that any more. Would be interesting
to see when the warning disappeared from the trunk.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-05-19  3:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-31 17:10 [Bug c/107476] New: Spurious stringop-overflow warning pkoning at gcc dot gnu.org
2022-10-31 17:11 ` [Bug c/107476] " pkoning at gcc dot gnu.org
2023-05-19  3:21 ` [Bug tree-optimization/107476] " pinskia at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).