public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104
@ 2022-06-14 10:26 gscfq@t-online.de
  2022-06-15  8:55 ` [Bug tree-optimization/105971] " rguenth at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: gscfq@t-online.de @ 2022-06-14 10:26 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 105971
           Summary: [12/13 Regression] ICE in bitmap_check_index, at
                    sbitmap.h:104
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: gscfq@t-online.de
  Target Milestone: ---

Started between 20211121 and 20211128, at -O1+ :
(gcc configured with --enable-checking=yes)


$ cat z1.c
void a()
{
  int b;
  int c;
  int d = a;
  _Complex float *e = a;
  for (;;) {
    (*e += d) / b ?: 0;
  }
}


$ gcc-13-20220612 -c z1.c -O2
z1.c: In function 'a':
z1.c:5:11: warning: initialization of 'int' from 'void (*)()' makes integer
from pointer without a cast [-Wint-conversion]
    5 |   int d = a;
      |           ^
z1.c:6:23: warning: initialization of '_Complex float *' from incompatible
pointer type 'void (*)()' [-Wincompatible-pointer-types]
    6 |   _Complex float *e = a;
      |                       ^
during GIMPLE pass: dse
z1.c:10:1: internal compiler error: in bitmap_check_index, at sbitmap.h:104
   10 | }
      | ^
0x1e915d1 bitmap_check_index
        ../../gcc/sbitmap.h:104
0x1e915d1 bitmap_bit_in_range_p(simple_bitmap_def const*, unsigned int,
unsigned int)
        ../../gcc/sbitmap.cc:336
0xf7f37c live_bytes_read
        ../../gcc/tree-ssa-dse.cc:786
0xf7f37c dse_classify_store(ao_ref*, gimple*, bool, simple_bitmap_def*, bool*,
tree_node*)
        ../../gcc/tree-ssa-dse.cc:1007
0xf827f8 dse_optimize_stmt
        ../../gcc/tree-ssa-dse.cc:1421
0xf827f8 execute
        ../../gcc/tree-ssa-dse.cc:1527

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

* [Bug tree-optimization/105971] [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
@ 2022-06-15  8:55 ` rguenth at gcc dot gnu.org
  2022-06-15  9:27 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-15  8:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |needs-bisection
          Component|c                           |tree-optimization
   Target Milestone|---                         |12.2

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

* [Bug tree-optimization/105971] [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
  2022-06-15  8:55 ` [Bug tree-optimization/105971] " rguenth at gcc dot gnu.org
@ 2022-06-15  9:27 ` rguenth at gcc dot gnu.org
  2022-06-15 11:15 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-15  9:27 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
   Last reconfirmed|                            |2022-06-15
           Priority|P3                          |P2
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |ASSIGNED
           Keywords|needs-bisection             |

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed.

#1  0x0000000002d39e66 in bitmap_check_index (map=0x44062b0, index=-1)
    at /space/rguenther/src/gcc/gcc/sbitmap.h:104
104       gcc_checking_assert (index >= 0);

get_byte_range returns true but a size of zero, it seems to be constrainted
on "COPY inside REF" but we have

(gdb) p *use_ref
$3 = {ref = <realpart_expr 0x7ffff6a0f920>, 
  base = <function_decl 0x7ffff6a00200 a>, 
  offset = {<poly_int_pod<1, long>> = {coeffs = {0}}, <No data fields>}, 
  size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  max_size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  ref_alias_set = -1, base_alias_set = -1, volatile_p = false}
(gdb) p *ref
$4 = {ref = <imagpart_expr 0x7ffff6a0f9a0>, 
  base = <function_decl 0x7ffff6a00200 a>, 
  offset = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  max_size = {<poly_int_pod<1, long>> = {coeffs = {32}}, <No data fields>}, 
  ref_alias_set = -1, base_alias_set = -1, volatile_p = false}

which means the refs do not overlap.  We have

(gdb) p debug_gimple_stmt (use_stmt)
# VUSE <.MEM_16>
_2 = REALPART_EXPR <MEM[(complex float *)a]>;
$5 = void
(gdb) p debug_gimple_stmt (stmt)
# .MEM_21 = VDEF <.MEM_18>
IMAGPART_EXPR <MEM[(complex float *)a]> = _5;

so we expected ref_maybe_used_by_stmt_p to return false but it does not
(because we reference a FUNCTION_DECL).   That's because of

  /* We can end up referring to code via function and label decls.
     As we likely do not properly track code aliases conservatively
     bail out.  */
  if (TREE_CODE (base1) == FUNCTION_DECL
      || TREE_CODE (base1) == LABEL_DECL
      || TREE_CODE (base2) == FUNCTION_DECL
      || TREE_CODE (base2) == LABEL_DECL)
    return true;

we can make this less restrictive for the case of two decls which is also
the case DSE is interested in here.

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

* [Bug tree-optimization/105971] [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
  2022-06-15  8:55 ` [Bug tree-optimization/105971] " rguenth at gcc dot gnu.org
  2022-06-15  9:27 ` rguenth at gcc dot gnu.org
@ 2022-06-15 11:15 ` cvs-commit at gcc dot gnu.org
  2022-06-15 11:16 ` [Bug tree-optimization/105971] [12 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-06-15 11:15 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:8c2733e16ec1c0cdda3db4cdc5ad158a96a658e8

commit r13-1106-g8c2733e16ec1c0cdda3db4cdc5ad158a96a658e8
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 15 11:27:31 2022 +0200

    tree-optimization/105971 - less surprising refs_may_alias_p_2

    When DSE asks whether __real a is using __imag a it gets a surprising
    result when a is a FUNCTION_DECL.  The following makes sure this case
    is less surprising to callers but keeping the bail-out for the
    non-decl case where it is true that PTA doesn't track aliases to code
    correctly.

    2022-06-15  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/105971
            * tree-ssa-alias.cc (refs_may_alias_p_2): Put bail-out for
            FUNCTION_DECL and LABEL_DECL refs after decl-decl disambiguation
            to leak less surprising alias results.

            * gcc.dg/torture/pr106971.c: New testcase.

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

* [Bug tree-optimization/105971] [12 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
                   ` (2 preceding siblings ...)
  2022-06-15 11:15 ` cvs-commit at gcc dot gnu.org
@ 2022-06-15 11:16 ` rguenth at gcc dot gnu.org
  2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
  2022-07-19 11:40 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-06-15 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[12/13 Regression] ICE in   |[12 Regression] ICE in
                   |bitmap_check_index, at      |bitmap_check_index, at
                   |sbitmap.h:104               |sbitmap.h:104
      Known to work|                            |13.0

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug tree-optimization/105971] [12 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
                   ` (3 preceding siblings ...)
  2022-06-15 11:16 ` [Bug tree-optimization/105971] [12 " rguenth at gcc dot gnu.org
@ 2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
  2022-07-19 11:40 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2022-07-19 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-12 branch has been updated by Richard Biener
<rguenth@gcc.gnu.org>:

https://gcc.gnu.org/g:8dd1c404ec77c6d2cdaaf93d219e3250081355c0

commit r12-8580-g8dd1c404ec77c6d2cdaaf93d219e3250081355c0
Author: Richard Biener <rguenther@suse.de>
Date:   Wed Jun 15 11:27:31 2022 +0200

    tree-optimization/105971 - less surprising refs_may_alias_p_2

    When DSE asks whether __real a is using __imag a it gets a surprising
    result when a is a FUNCTION_DECL.  The following makes sure this case
    is less surprising to callers but keeping the bail-out for the
    non-decl case where it is true that PTA doesn't track aliases to code
    correctly.

    2022-06-15  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/105971
            * tree-ssa-alias.cc (refs_may_alias_p_2): Put bail-out for
            FUNCTION_DECL and LABEL_DECL refs after decl-decl disambiguation
            to leak less surprising alias results.

            * gcc.dg/torture/pr106971.c: New testcase.

    (cherry picked from commit 8c2733e16ec1c0cdda3db4cdc5ad158a96a658e8)

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

* [Bug tree-optimization/105971] [12 Regression] ICE in bitmap_check_index, at sbitmap.h:104
  2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
                   ` (4 preceding siblings ...)
  2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
@ 2022-07-19 11:40 ` rguenth at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-07-19 11:40 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
      Known to fail|                            |12.1.0
         Resolution|---                         |FIXED
      Known to work|                            |12.1.1

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2022-07-19 11:40 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-14 10:26 [Bug c/105971] New: [12/13 Regression] ICE in bitmap_check_index, at sbitmap.h:104 gscfq@t-online.de
2022-06-15  8:55 ` [Bug tree-optimization/105971] " rguenth at gcc dot gnu.org
2022-06-15  9:27 ` rguenth at gcc dot gnu.org
2022-06-15 11:15 ` cvs-commit at gcc dot gnu.org
2022-06-15 11:16 ` [Bug tree-optimization/105971] [12 " rguenth at gcc dot gnu.org
2022-07-19 11:38 ` cvs-commit at gcc dot gnu.org
2022-07-19 11:40 ` 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).