public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671
@ 2020-03-13  6:40 v.barinov at samsung dot com
  2020-03-13  7:09 ` [Bug tree-optimization/94163] [8/9 Regression] " pinskia at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: v.barinov at samsung dot com @ 2020-03-13  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94163
           Summary: internal compiler error: in set_ptr_info_alignment, at
                    tree-ssanames.c:671
           Product: gcc
           Version: 9.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: v.barinov at samsung dot com
  Target Milestone: ---

Created attachment 48025
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48025&action=edit
reduced reprocase

g++ -c -O2 builtins-string.ii

during GIMPLE pass: pre
builtins-string.ii: In function ‘void as()’:
builtins-string.ii:100:6: internal compiler error: in set_ptr_info_alignment,
at tree-ssanames.c:671
  100 | void as() { al j(&h); }
      |      ^~
0xbd95d1 set_ptr_info_alignment(ptr_info_def*, unsigned int, unsigned int)
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssanames.c:671
0xba3b58 create_expression_by_pieces
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:2814
0x15f8b50 do_hoist_insertion
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:3577
0x15f8b50 insert_aux
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:3652
0x15f826f insert_aux
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:3659
0x191d160 insert
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:3682
0x191d160 execute
        /usr/src/debug/sys-devel/gcc-9.2.0-r4/gcc-9.2.0/gcc/tree-ssa-pre.c:4220

Reproduced on 8.3.0, 8.4.0, 9.2.0
Can't reproduce on 7.3.0, 7.4.0, 10.0

-O1 is okay; -O2 causes crash.
Source is reduced from chromium-81/v8/src/builtins/builtins-string.cc

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

* [Bug tree-optimization/94163] [8/9 Regression] internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
@ 2020-03-13  7:09 ` pinskia at gcc dot gnu.org
  2020-03-13  7:28 ` [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned rguenth at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-03-13  7:09 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |8.5
            Summary|internal compiler error: in |[8/9 Regression] internal
                   |set_ptr_info_alignment, at  |compiler error: in
                   |tree-ssanames.c:671         |set_ptr_info_alignment, at
                   |                            |tree-ssanames.c:671
      Known to work|                            |10.0, 7.3.0, 7.4.0
      Known to fail|                            |8.3.0, 8.4.0, 9.2.0

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I wonder if this is a latent bug in GCC 10.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
  2020-03-13  7:09 ` [Bug tree-optimization/94163] [8/9 Regression] " pinskia at gcc dot gnu.org
@ 2020-03-13  7:28 ` rguenth at gcc dot gnu.org
  2020-03-13  7:30 ` rguenth at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-13  7:28 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org
           Priority|P3                          |P2
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2020-03-13

--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> ---
Likely - mine.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
  2020-03-13  7:09 ` [Bug tree-optimization/94163] [8/9 Regression] " pinskia at gcc dot gnu.org
  2020-03-13  7:28 ` [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned rguenth at gcc dot gnu.org
@ 2020-03-13  7:30 ` rguenth at gcc dot gnu.org
  2020-03-13  8:43 ` jakub at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-13  7:30 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
From

          /* There's no CCP pass after PRE which would re-compute alignment
             information so make sure we re-materialize this here.  */
          if (gimple_call_builtin_p (call, BUILT_IN_ASSUME_ALIGNED)
              && args.length () - 2 <= 1
              && tree_fits_uhwi_p (args[1])
              && (args.length () != 3 || tree_fits_uhwi_p (args[2])))
            {
              unsigned HOST_WIDE_INT halign = tree_to_uhwi (args[1]);
              unsigned HOST_WIDE_INT hmisalign
                = args.length () == 3 ? tree_to_uhwi (args[2]) : 0;
              if ((halign & (halign - 1)) == 0
                  && (hmisalign & ~(halign - 1)) == 0)
                set_ptr_info_alignment (get_ptr_info (forcedname),
                                        halign, hmisalign);
            }

where set_ptr_info_alignment ICEs for align == 0.  set_ptr_info_alignment
takes unsigned int args but the above computes HWI quantities that get
truncated here.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (2 preceding siblings ...)
  2020-03-13  7:30 ` rguenth at gcc dot gnu.org
@ 2020-03-13  8:43 ` jakub at gcc dot gnu.org
  2020-03-13  8:51 ` jakub at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-13  8:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, either we can set the alignment to (unsigned) INT_MAX + 1 in that case, or
throw the info away.  Doesn't seem to be useful to enlarge ptr_info_def because
of this.  Perhaps the set_ptr_info_alignment could take unsigned HOST_WIDE_INT
argument and do this saturation inside of it.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (3 preceding siblings ...)
  2020-03-13  8:43 ` jakub at gcc dot gnu.org
@ 2020-03-13  8:51 ` jakub at gcc dot gnu.org
  2020-03-13  9:13 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-03-13  8:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
E.g. in tree-ssa-ccp.c, we drop very large alignments on the floor.
          /* Trailing mask bits specify the alignment, trailing value
             bits the misalignment.  */
          tem = val->mask.to_uhwi ();
          align = least_bit_hwi (tem);
int *
foo (int *p)
{
  p = (int *) ((__UINTPTR_TYPE__) p & 0xfffffff000000000ULL);
  (*p)++;
  return p;
}
because tem is unsigned int and so will be 0, align 0 too and so align > 1 will
not be true.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (4 preceding siblings ...)
  2020-03-13  8:51 ` jakub at gcc dot gnu.org
@ 2020-03-13  9:13 ` rguenth at gcc dot gnu.org
  2020-03-13 13:00 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-13  9:13 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
The patch in testing does the same as CCP.  I agree that we possibly want
saturation behavior but that can be done separately for GCC 11.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (5 preceding siblings ...)
  2020-03-13  9:13 ` rguenth at gcc dot gnu.org
@ 2020-03-13 13:00 ` rguenth at gcc dot gnu.org
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-03-13 13:00 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (6 preceding siblings ...)
  2020-03-13 13:00 ` rguenth at gcc dot gnu.org
@ 2020-03-13 14:07 ` marxin at gcc dot gnu.org
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-13 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r8-10122-g8c55e44368d639849b28484f2c7842f4265b33c8
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Mar 13 13:56:26 2020 +0100

    tree-optimization/94163 constrain alignment set by PRE

    This avoids HWI -> unsigned truncation to end up with zero alignment
    which set_ptr_info_alignment ICEs on.

    2020-03-13  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/94163
            * tree-ssa-pre.c (create_expression_by_pieces): Check
            whether alignment would be zero.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (7 preceding siblings ...)
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
@ 2020-03-13 14:07 ` marxin at gcc dot gnu.org
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-13 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #9 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r9-8373-gdb3584552871c8caccdc22e97ea1573da9458253
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Mar 13 13:56:26 2020 +0100

    tree-optimization/94163 constrain alignment set by PRE

    This avoids HWI -> unsigned truncation to end up with zero alignment
    which set_ptr_info_alignment ICEs on.

    2020-03-13  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/94163
            * tree-ssa-pre.c (create_expression_by_pieces): Check
            whether alignment would be zero.

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

* [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned
  2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
                   ` (8 preceding siblings ...)
  2020-03-13 14:07 ` marxin at gcc dot gnu.org
@ 2020-03-13 14:07 ` marxin at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-03-13 14:07 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
commit r10-7158-g3604480a6fe493c51d6ebd53d9b1abeebbbb828f
Author: Richard Biener <rguenther@suse.de>
Date:   Fri Mar 13 13:56:26 2020 +0100

    tree-optimization/94163 constrain alignment set by PRE

    This avoids HWI -> unsigned truncation to end up with zero alignment
    which set_ptr_info_alignment ICEs on.

    2020-03-13  Richard Biener  <rguenther@suse.de>

            PR tree-optimization/94163
            * tree-ssa-pre.c (create_expression_by_pieces): Check
            whether alignment would be zero.

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

end of thread, other threads:[~2020-03-13 14:07 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-13  6:40 [Bug tree-optimization/94163] New: internal compiler error: in set_ptr_info_alignment, at tree-ssanames.c:671 v.barinov at samsung dot com
2020-03-13  7:09 ` [Bug tree-optimization/94163] [8/9 Regression] " pinskia at gcc dot gnu.org
2020-03-13  7:28 ` [Bug tree-optimization/94163] [8/9 Regression] ICE in set_ptr_info_alignment with -O2 and __builtin_assume_aligned rguenth at gcc dot gnu.org
2020-03-13  7:30 ` rguenth at gcc dot gnu.org
2020-03-13  8:43 ` jakub at gcc dot gnu.org
2020-03-13  8:51 ` jakub at gcc dot gnu.org
2020-03-13  9:13 ` rguenth at gcc dot gnu.org
2020-03-13 13:00 ` rguenth at gcc dot gnu.org
2020-03-13 14:07 ` marxin at gcc dot gnu.org
2020-03-13 14:07 ` marxin at gcc dot gnu.org
2020-03-13 14:07 ` marxin 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).