public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6
@ 2021-04-02 12:06 marxin at gcc dot gnu.org
  2021-04-02 12:06 ` [Bug tree-optimization/99882] " marxin at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-02 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 99882
           Summary: [11 Regression] ICE in bswap_view_convert, at
                    gimple-ssa-store-merging.c:988 since
                    r11-7946-g5b9a65ecbeb22ef6
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: jakub at gcc dot gnu.org
  Target Milestone: ---

The following is reduced from valgrind package:

$ cat libvex.i
void patchProfInc_AMD64(long *location_of_counter) {
  char *p;
  long imm64 = (long)location_of_counter;
  p[2] = (long)location_of_counter;
  imm64 >>= 8;
  p[3] = imm64;
  imm64 >>= 8;
  p[4] = imm64;
  imm64 >>= 8;
  p[5] = imm64;
  imm64 >>= 8;
  p[6] = imm64;
  imm64 >>= 8;
  p[7] = imm64;
  imm64 >>= 8;
  p[8] = imm64;
  imm64 >>= 8;
  p[9] = imm64;
}

$ gcc libvex.i -c -O3
during GIMPLE pass: store-merging
libvex.i: In function ‘patchProfInc_AMD64’:
libvex.i:1:6: internal compiler error: in bswap_view_convert, at
gimple-ssa-store-merging.c:988
    1 | void patchProfInc_AMD64(long *location_of_counter) {
      |      ^~~~~~~~~~~~~~~~~~
0x81c13b bswap_view_convert
        /home/marxin/Programming/gcc/gcc/gimple-ssa-store-merging.c:988
0x18a7cdb bswap_replace
        /home/marxin/Programming/gcc/gcc/gimple-ssa-store-merging.c:1166
0x18b259f maybe_optimize_vector_constructor
        /home/marxin/Programming/gcc/gcc/gimple-ssa-store-merging.c:1344
0x18b259f execute
        /home/marxin/Programming/gcc/gcc/gimple-ssa-store-merging.c:5368
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/99882] [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6
  2021-04-02 12:06 [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6 marxin at gcc dot gnu.org
@ 2021-04-02 12:06 ` marxin at gcc dot gnu.org
  2021-04-02 14:55 ` jakub at gcc dot gnu.org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-04-02 12:06 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |11.0
           Priority|P3                          |P1
     Ever confirmed|0                           |1
      Known to fail|                            |11.0
      Known to work|                            |10.2.0
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-04-02

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

* [Bug tree-optimization/99882] [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6
  2021-04-02 12:06 [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6 marxin at gcc dot gnu.org
  2021-04-02 12:06 ` [Bug tree-optimization/99882] " marxin at gcc dot gnu.org
@ 2021-04-02 14:55 ` jakub at gcc dot gnu.org
  2021-04-03  8:08 ` cvs-commit at gcc dot gnu.org
  2021-04-03  8:17 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-02 14:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Untested fix:
--- gcc/gimple-ssa-store-merging.c.jj   2021-04-01 10:50:56.238629197 +0200
+++ gcc/gimple-ssa-store-merging.c      2021-04-02 16:52:38.763803716 +0200
@@ -985,10 +985,19 @@ public:
 static tree
 bswap_view_convert (gimple_stmt_iterator *gsi, tree type, tree val)
 {
-  gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (val)));
+  gcc_assert (INTEGRAL_TYPE_P (TREE_TYPE (val))
+             || POINTER_TYPE_P (TREE_TYPE (val)));
   if (TYPE_SIZE (type) != TYPE_SIZE (TREE_TYPE (val)))
     {
       HOST_WIDE_INT prec = TREE_INT_CST_LOW (TYPE_SIZE (type));
+      if (POINTER_TYPE_P (TREE_TYPE (val)))
+       {
+         gimple *g
+           = gimple_build_assign (make_ssa_name (pointer_sized_int_node),
+                                  NOP_EXPR, val);
+         gsi_insert_before (gsi, g, GSI_SAME_STMT);
+         val = gimple_assign_lhs (g);
+       }
       tree itype = build_nonstandard_integer_type (prec, 1);
       gimple *g = gimple_build_assign (make_ssa_name (itype), NOP_EXPR, val);
       gsi_insert_before (gsi, g, GSI_SAME_STMT);

Slightly cleaned up testcase:
void
foo (char *p, void *q)
{
  __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q;
  p[2] = i;
  i >>= 8;
  p[3] = i;
  i >>= 8;
  p[4] = i;
  i >>= 8;
  p[5] = i;
  i >>= 8;
  p[6] = i;
  i >>= 8;
  p[7] = i;
  i >>= 8;
  p[8] = i;
  i >>= 8;
  p[9] = i;
}

void
bar (char *p, void *q)
{
  __INTPTR_TYPE__ i = (__INTPTR_TYPE__) q;
  p[2] = i;
  i >>= 8;
  p[3] = i;
  i >>= 8;
  p[4] = i;
  i >>= 8;
  p[5] = i;
}

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

* [Bug tree-optimization/99882] [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6
  2021-04-02 12:06 [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6 marxin at gcc dot gnu.org
  2021-04-02 12:06 ` [Bug tree-optimization/99882] " marxin at gcc dot gnu.org
  2021-04-02 14:55 ` jakub at gcc dot gnu.org
@ 2021-04-03  8:08 ` cvs-commit at gcc dot gnu.org
  2021-04-03  8:17 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-04-03  8:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:a40015780f8cc49476741b6914bd5ee97bd10f1d

commit r11-7971-ga40015780f8cc49476741b6914bd5ee97bd10f1d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 3 10:08:08 2021 +0200

    bswap: Fix up bswap_view_convert after the recent change [PR99882]

    Martin reported that my recent change to allow pointer types in bswap
    broke valgrind.  The bswap_view_convert function used for the
initialization
    of vector CONSTRUCTOR from the identity or byte-swapped pieces
unfortunately
    didn't handle pointer types.  The following patch handles it there.

    2021-04-03  Jakub Jelinek  <jakub@redhat.com>

            PR tree-optimization/99882
            * gimple-ssa-store-merging.c (bswap_view_convert): Handle val with
            pointer type.

            * gcc.dg/pr99882.c: New test.

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

* [Bug tree-optimization/99882] [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6
  2021-04-02 12:06 [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2021-04-03  8:08 ` cvs-commit at gcc dot gnu.org
@ 2021-04-03  8:17 ` jakub at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: jakub at gcc dot gnu.org @ 2021-04-03  8:17 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2021-04-03  8:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 12:06 [Bug tree-optimization/99882] New: [11 Regression] ICE in bswap_view_convert, at gimple-ssa-store-merging.c:988 since r11-7946-g5b9a65ecbeb22ef6 marxin at gcc dot gnu.org
2021-04-02 12:06 ` [Bug tree-optimization/99882] " marxin at gcc dot gnu.org
2021-04-02 14:55 ` jakub at gcc dot gnu.org
2021-04-03  8:08 ` cvs-commit at gcc dot gnu.org
2021-04-03  8:17 ` jakub 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).