public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable
       [not found] <bug-80776-4@http.gcc.gnu.org/bugzilla/>
@ 2023-06-21  4:28 ` pinskia at gcc dot gnu.org
  2023-06-21  4:28 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-21  4:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #7)
> Reconfirming that test case in comment #2 still triggers the warning in GCC
> 10.  The dump shows that the warning thinks the fifth directive (%02d)
> generates between 2 and 10 bytes of output.  The symptoms feel similar to
> pr94021 but I haven't looked into whether they underlying root causes are
> related.

That testcase looks to be fixed in GCC 13:
/app/example.cpp:13: __builtin_sprintf: objsize = 15, fmtstr =
"%04d%02d%02d%02d%02d%02d"
  Directive 1 at offset 0: "%04d"
    Result: 4, 4, 4, 4 (4, 4, 4, 4)
  Directive 2 at offset 4: "%02d"
    Result: 2, 2, 2, 2 (6, 6, 6, 6)
  Directive 3 at offset 8: "%02d"
    Result: 2, 2, 2, 2 (8, 8, 8, 8)
  Directive 4 at offset 12: "%02d"
    Result: 2, 2, 2, 2 (10, 10, 10, 10)
  Directive 5 at offset 16: "%02d"
    Result: 2, 2, 2, 2 (12, 12, 12, 12)
  Directive 6 at offset 20: "%02d"
    Result: 2, 2, 2, 2 (14, 14, 14, 14)
  Directive 7 at offset 24: "", length = 1
  Substituting 14 for return value.



GCC 13:
  # RANGE [irange] int [-999, 9999]
  intD.6 a_14(D) = aD.2739;
  # RANGE [irange] int [1, 12] NONZERO 0xf
  intD.6 b_15(D) = bD.2740;
  # RANGE [irange] int [1, 31] NONZERO 0x1f
  intD.6 c_16(D) = cD.2741;
  # RANGE [irange] int [0, 23] NONZERO 0x1f
  intD.6 d_17(D) = dD.2742;
  # RANGE [irange] int [0, 59] NONZERO 0x3f
  intD.6 e_18(D) = eD.2743;
  # RANGE [irange] int [0, 60] NONZERO 0x3f
  intD.6 f_19(D) = fD.2744;


GCC 12:

  # RANGE [-999, 9999]
  intD.6 a_14(D) = aD.1979;
  # RANGE [1, 12] NONZERO 15
  intD.6 b_15(D) = bD.1980;
  # RANGE [1, 31] NONZERO 31
  intD.6 c_16(D) = cD.1981;
  # RANGE [0, 23] NONZERO 31
  intD.6 d_17(D) = dD.1982;
  # RANGE [0, 2147483647] NONZERO 2147483647
  intD.6 e_18(D) = eD.1983;
  # RANGE [0, 2147483647] NONZERO 2147483647
  intD.6 f_19(D) = fD.1984;


So yes this has been fixed for GCC 13.

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

* [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable
       [not found] <bug-80776-4@http.gcc.gnu.org/bugzilla/>
  2023-06-21  4:28 ` [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable pinskia at gcc dot gnu.org
@ 2023-06-21  4:28 ` pinskia at gcc dot gnu.org
  2023-10-25  3:35 ` pinskia at gcc dot gnu.org
  2023-10-25  3:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-21  4:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
.

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

* [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable
       [not found] <bug-80776-4@http.gcc.gnu.org/bugzilla/>
  2023-06-21  4:28 ` [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable pinskia at gcc dot gnu.org
  2023-06-21  4:28 ` pinskia at gcc dot gnu.org
@ 2023-10-25  3:35 ` pinskia at gcc dot gnu.org
  2023-10-25  3:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-25  3:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |---
             Status|RESOLVED                    |NEW

--- Comment #10 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am going to reopen this because the VRP issue has not been solved.

You can reproduce the same issue adding -fno-tree-reassoc to the testcase.

It just happens reassociating combined with the find_duplicates part of the PRE
pass allows it to be optimized.

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

* [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable
       [not found] <bug-80776-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2023-10-25  3:35 ` pinskia at gcc dot gnu.org
@ 2023-10-25  3:36 ` pinskia at gcc dot gnu.org
  3 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-10-25  3:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|13.0                        |---

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

end of thread, other threads:[~2023-10-25  3:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-80776-4@http.gcc.gnu.org/bugzilla/>
2023-06-21  4:28 ` [Bug tree-optimization/80776] -Wformat-overflow false positive for %d on integer bounded by __builtin_unreachable pinskia at gcc dot gnu.org
2023-06-21  4:28 ` pinskia at gcc dot gnu.org
2023-10-25  3:35 ` pinskia at gcc dot gnu.org
2023-10-25  3:36 ` 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).