public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug sanitizer/81601] [8/9/10 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
@ 2020-03-09 14:42 ` law at redhat dot com
  2021-05-14  9:49 ` [Bug sanitizer/81601] [9/10/11/12 " jakub at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: law at redhat dot com @ 2020-03-09 14:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #27 from Jeffrey A. Law <law at redhat dot com> ---
So I just prototyped a bit of code that might help with this BZ.

This seems better suited for match.pd, except that match.pd doesn't seem to
want to handle BIT_FIELD_REF nodes.  So I did the prototype in forwprop.

Given a BIT_AND_EXPR which just masks off high bits that is fed by a
BIT_FIELD_REF, we can adjust the # of bits in the BIT_FIELD_REF and the type of
the reference.  The BIT_AND turns into a nop-conversion.

So the key blocks start like this:

;;   basic block 2, loop depth 0, maybe hot
;;    prev block 0, next block 3, flags: (NEW, VISITED)
;;    pred:       ENTRY (FALLTHRU,EXECUTABLE)
  _13 = __builtin_object_size (tp_11(D), 0);
  _14 = &tp_11(D)->D.2292;
  .UBSAN_OBJECT_SIZE (_14, 13, _13, 0);
  _1 = tp_11(D)->chrono_type;
  _2 = (int) _1;
  if (_1 == 0)
    goto <bb 3>; [INV]
  else
    goto <bb 5>; [INV]
;;    succ:       3 (TRUE_VALUE,EXECUTABLE)
;;                5 (FALSE_VALUE,EXECUTABLE)

;;   basic block 3, loop depth 0, maybe hot
;;    prev block 2, next block 4, flags: (NEW, VISITED)
;;    pred:       2 (TRUE_VALUE,EXECUTABLE)
  _3 = BIT_FIELD_REF <*tp_11(D), 8, 96>;
  _4 = _3 & 3;
  if (_4 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]
;;    succ:       4 (TRUE_VALUE,EXECUTABLE)
;;                5 (FALSE_VALUE,EXECUTABLE)

And the bits in block #3 turn into:

;;   basic block 3, loop depth 0, maybe hot
;;    prev block 2, next block 4, flags: (NEW, VISITED)
;;    pred:       2 (TRUE_VALUE,EXECUTABLE)
  _9 = BIT_FIELD_REF <*tp_11(D), 2, 96>;
  _4 = (unsigned char) _9;
  if (_9 != 0)
    goto <bb 4>; [INV]
  else
    goto <bb 5>; [INV]
;;    succ:       4 (TRUE_VALUE,EXECUTABLE)
;;                5 (FALSE_VALUE,EXECUTABLE)


That's good enough that FRE can see the redundancy between tp->chrono_type and
the BIT_FIELD_REF and all the right things just happen from that point onward.

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

* [Bug sanitizer/81601] [9/10/11/12 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 14:42 ` [Bug sanitizer/81601] [8/9/10 Regression] incorrect Warray-bounds warning with -fsanitize law at redhat dot com
@ 2021-05-14  9:49 ` jakub at gcc dot gnu.org
  2021-06-01  8:09 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-05-14  9:49 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|8.5                         |9.4

--- Comment #28 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 8 branch is being closed.

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

* [Bug sanitizer/81601] [9/10/11/12 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
  2020-03-09 14:42 ` [Bug sanitizer/81601] [8/9/10 Regression] incorrect Warray-bounds warning with -fsanitize law at redhat dot com
  2021-05-14  9:49 ` [Bug sanitizer/81601] [9/10/11/12 " jakub at gcc dot gnu.org
@ 2021-06-01  8:09 ` rguenth at gcc dot gnu.org
  2022-05-27  9:37 ` [Bug sanitizer/81601] [10/11/12/13 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-06-01  8:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.4                         |9.5

--- Comment #29 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9.4 is being released, retargeting bugs to GCC 9.5.

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

* [Bug sanitizer/81601] [10/11/12/13 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2021-06-01  8:09 ` rguenth at gcc dot gnu.org
@ 2022-05-27  9:37 ` rguenth at gcc dot gnu.org
  2022-06-28 10:33 ` jakub at gcc dot gnu.org
  2023-07-07 10:32 ` [Bug sanitizer/81601] [11/12/13/14 " rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-05-27  9:37 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|9.5                         |10.4

--- Comment #30 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 9 branch is being closed

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

* [Bug sanitizer/81601] [10/11/12/13 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2022-05-27  9:37 ` [Bug sanitizer/81601] [10/11/12/13 " rguenth at gcc dot gnu.org
@ 2022-06-28 10:33 ` jakub at gcc dot gnu.org
  2023-07-07 10:32 ` [Bug sanitizer/81601] [11/12/13/14 " rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.4                        |10.5

--- Comment #31 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
GCC 10.4 is being released, retargeting bugs to GCC 10.5.

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

* [Bug sanitizer/81601] [11/12/13/14 Regression] incorrect Warray-bounds warning with -fsanitize
       [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2022-06-28 10:33 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:32 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.5                        |11.5

--- Comment #32 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10 branch is being closed.

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

end of thread, other threads:[~2023-07-07 10:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-81601-4@http.gcc.gnu.org/bugzilla/>
2020-03-09 14:42 ` [Bug sanitizer/81601] [8/9/10 Regression] incorrect Warray-bounds warning with -fsanitize law at redhat dot com
2021-05-14  9:49 ` [Bug sanitizer/81601] [9/10/11/12 " jakub at gcc dot gnu.org
2021-06-01  8:09 ` rguenth at gcc dot gnu.org
2022-05-27  9:37 ` [Bug sanitizer/81601] [10/11/12/13 " rguenth at gcc dot gnu.org
2022-06-28 10:33 ` jakub at gcc dot gnu.org
2023-07-07 10:32 ` [Bug sanitizer/81601] [11/12/13/14 " rguenth 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).