public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475
@ 2020-07-04  9:16 marxin at gcc dot gnu.org
  2020-07-04  9:19 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-04  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96058
           Summary: ICE in c_getstr at gcc/fold-const.c:15475
           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: msebor at gcc dot gnu.org
  Target Milestone: ---

I see the ICE in a LTRANS when using LTO on chrome. So it's unlikely I can
create a reduced-test case:

I'm using GCC 10.1 release:

gcc --version
gcc (SUSE Linux) 10.1.1 20200625 [revision
c91e43e9363bd119a695d64505f96539fa451bf2]
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ /usr/lib64/gcc/x86_64-suse-linux/10/lto1 -fltrans chrome.ltrans81.o -quiet
during GIMPLE pass: strlen
../../chrome/browser/ui/views/sharing/sharing_icon_view.cc: In member function
‘GetVectorIconBadge’:
../../chrome/browser/ui/views/sharing/sharing_icon_view.cc:146: internal
compiler error: in tree_to_uhwi, at tree.h:4519
0x666aa8 tree_to_uhwi(tree_node const*)
        ../../gcc/tree.h:4519
0x666aa8 c_getstr(tree_node*, unsigned long*)
        ../../gcc/fold-const.c:15475
0xf54bf2 get_stridx
        ../../gcc/tree-ssa-strlen.c:537
0xde690d strlen_dom_walker::before_dom_children(basic_block_def*)
        ../../gcc/tree-ssa-strlen.c:5832
0xde5e63 dom_walker::walk(basic_block_def*)
        ../../gcc/domwalk.c:309
0x1134468 printf_strlen_execute
        ../../gcc/tree-ssa-strlen.c:5922
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://bugs.opensuse.org/> for instructions.

(gdb) bt
#0  c_getstr (src=0x7fffeffb0e28, strlen=0x0) at ../../gcc/fold-const.c:15475
#1  0x0000000000f54bf3 in get_stridx (exp=0x7fffeffa6480, offrng=0x0,
rvals=0x0) at ../../gcc/tree-ssa-strlen.c:537
#2  0x0000000000de690e in strlen_dom_walker::before_dom_children
(this=0x7fffffffdfa0, bb=0x7fffeffb70d0) at ../../gcc/gimple.h:4539
#3  0x0000000000de5e64 in dom_walker::walk (this=0x7fffffffdfa0,
bb=0x7fffeffb70d0) at ../../gcc/domwalk.c:309
#4  0x0000000001134469 in (anonymous namespace)::printf_strlen_execute
(fun=0x7ffff0988bb0, warn_only=<optimized out>) at
../../gcc/tree-ssa-strlen.c:5922
#5  0x0000000000d49063 in execute_one_pass (pass=0x1d00a50) at
../../gcc/passes.c:2502
#6  0x0000000000d7e825 in execute_pass_list_1 (pass=0x1d00a50) at
../../gcc/passes.c:2590
#7  execute_pass_list_1 (pass=0x1cfe680) at ../../gcc/passes.c:2591
#8  execute_pass_list (fn=0x7ffff0988bb0, pass=<optimized out>) at
../../gcc/passes.c:2601
#9  0x000000000111bc42 in cgraph_node::expand (this=0x7ffff6fbee10) at
../../gcc/cgraphunit.c:2300
#10 0x000000000110f6a6 in expand_all_functions () at
../../gcc/cgraphunit.c:2471
#11 symbol_table::compile (this=0x7ffff7754100) at ../../gcc/cgraphunit.c:2822
#12 0x00000000010fdeab in lto_main () at ../../gcc/lto/lto.c:653
#13 0x00000000010fa1be in compile_file () at ../../gcc/toplev.c:458
#14 0x00000000010c7ffa in do_compile () at ../../gcc/toplev.c:2278
#15 toplev::main (this=this@entry=0x7fffffffe23e, argc=<optimized out>,
argv=<optimized out>) at ../../gcc/toplev.c:2417
#16 0x00000000010c73cc in main (argc=<optimized out>, argv=<optimized out>) at
../../gcc/main.c:39
(gdb) p debug_tree(exp)
No symbol "exp" in current context.
(gdb) p debug_tree(src)
 <string_cst 0x7fffeffb0e28
    type <array_type 0x7fffeff55888
        type <record_type 0x7ffff7701e70 VectorIcon readonly cxx-odr-p VOID
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4460000 context <namespace_decl 0x7ffff7581390 gfx>
            pointer_to_this <pointer_type 0x7ffff7701f18> reference_to_this
<reference_type 0x7ffff5ddfb28>>
        BLK
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality
        domain <integer_type 0x7fffeff55738 type <integer_type 0x7ffff7766000
sizetype>
            DI
            size <integer_cst 0x7ffff7751bb8 constant 64>
            unit-size <integer_cst 0x7ffff7751bd0 constant 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffeff55738 precision:64 min <integer_cst 0x7ffff7751be8 0> max <integer_cst
0x7ffff76ba498 23>>>
    readonly constant static "\000">
$1 = void

(gdb) p debug_tree(elttype)
No symbol "elttype" in current context.
(gdb) p debug_tree(eltype)
 <record_type 0x7ffff7701e70 VectorIcon readonly cxx-odr-p VOID
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4460000 context <namespace_decl 0x7ffff7581390 gfx>
    pointer_to_this <pointer_type 0x7ffff7701f18> reference_to_this
<reference_type 0x7ffff5ddfb28>>
$2 = void

(gdb) p debug_generic_expr (exp)
&kNoneIcon
(gdb) p debug_function(current_function_decl, 0)
GetVectorIconBadge (const struct SharingIconView * const this)
{
  bool _1;
  const struct VectorIcon * _2;

  <bb 2> [local count: 1073741824]:
  _1 = this_4(D)->should_show_error_;
  if (_1 != 0)
    goto <bb 3>; [50.00%]
  else
    goto <bb 4>; [50.00%]

  <bb 3> [local count: 536870912]:

  <bb 4> [local count: 1073741824]:
  # _2 = PHI <&kNoneIcon(2), &kBlockedBadgeIcon(3)>
  return _2;

}

Will you be Martin able to fix it with the provided info?

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
@ 2020-07-04  9:19 ` marxin at gcc dot gnu.org
  2020-07-04 14:09 ` pinskia at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-04  9:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2020-07-04
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
There's a ltrans file:
https://drive.google.com/file/d/1cddbnb886aVn1vfpJMLIRc1Ue3dyBuTy/view?usp=sharing

The ICE happens with c91e43e9363bd119a695d64505f96539fa451bf2 revision (one
needs zstd compression enabled).

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
  2020-07-04  9:19 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
@ 2020-07-04 14:09 ` pinskia at gcc dot gnu.org
  2020-07-04 16:33 ` marxin at gcc dot gnu.org
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: pinskia at gcc dot gnu.org @ 2020-07-04 14:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Multi delta should be able to reduce this. Normally reduce which .o files are
needed and then reduce the .ii files that needed to produce the .o files is the
way to reduce this ...

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
  2020-07-04  9:19 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
  2020-07-04 14:09 ` pinskia at gcc dot gnu.org
@ 2020-07-04 16:33 ` marxin at gcc dot gnu.org
  2020-07-06  7:19 ` rguenth at gcc dot gnu.org
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-04 16:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #2)
> Multi delta should be able to reduce this. Normally reduce which .o files
> are needed and then reduce the .ii files that needed to produce the .o files
> is the way to reduce this ...

I know how to make a reduction of a LTO test-case, but WPA and LTRANS
compilation takes 1 hour. It's waste of time doing such a reduction.

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  2020-07-04 16:33 ` marxin at gcc dot gnu.org
@ 2020-07-06  7:19 ` rguenth at gcc dot gnu.org
  2020-07-07 11:51 ` marxin at gcc dot gnu.org
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-06  7:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
We have an array type of an incomplete type which should be impossible.
Likewise a STRING_CST of array-of-struct type shouldn't exist either.  You
could instrument the LTO out-streaming code to detect this case and thus
identify the problematic source TU.

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  2020-07-06  7:19 ` rguenth at gcc dot gnu.org
@ 2020-07-07 11:51 ` marxin at gcc dot gnu.org
  2020-07-07 17:59 ` msebor at gcc dot gnu.org
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-07 11:51 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Martin Liška <marxin at gcc dot gnu.org> ---
So the corrupted STRING_CST is created in LTRANS here:

gcc/expr.c:

   │11714         if (TREE_CODE (init) == CONSTRUCTOR && initializer_zerop
(init))  
   │11715           {                                                           
   │11716             /* Fold an empty/zero constructor for an implicitly
initialized 
   │11717                object or subobject into the empty string.  */         
   │11718                                                                       
   │11719             /* Determine the character type from that of the original 
   │11720                expression.  */  
B+ │11721             tree chartype = argtype;
   │11722             if (POINTER_TYPE_P (chartype))
   │11723               chartype = TREE_TYPE (chartype);
   │11724             while (TREE_CODE (chartype) == ARRAY_TYPE)
   │11725               chartype = TREE_TYPE (chartype);
   │11726             /* Convert a char array to an empty STRING_CST having an
array

(gdb) p debug_tree(init)
 <constructor 0x7ffff0185120
    type <record_type 0x7ffff4514000 VectorIcon addressable cxx-odr-p BLK
        size <integer_cst 0x7ffff7824078 constant 192>
        unit-size <integer_cst 0x7ffff7824048 constant 24>
        align:64 warn_if_not_align:0 symtab:0 alias-set 407 canonical-type
0x7ffff4514000
        fields <field_decl 0x7ffff450ebe0 reps type <pointer_type
0x7ffff450df18>
            readonly unsigned nonlocal DI
../../ui/gfx/vector_icon_types.h:102:0
            size <integer_cst 0x7ffff7806bb8 constant 64>
            unit-size <integer_cst 0x7ffff7806bd0 constant 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff7806be8 constant 0>
            bit-offset <integer_cst 0x7ffff7806c30 constant 0> context
<record_type 0x7ffff4514000 VectorIcon> chain <field_decl 0x7ffff450eb48
reps_size>> context <namespace_decl 0x7ffff7635390 gfx>
        pointer_to_this <pointer_type 0x7ffff0114150>>
    constant length:3
    idx <field_decl 0x7ffff450ebe0 reps
        type <pointer_type 0x7ffff450df18 type <record_type 0x7ffff450ddc8
VectorIconRep>
            readonly unsigned DI size <integer_cst 0x7ffff7806bb8 64> unit-size
<integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1
structural-equality>
        readonly unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:102:0
size <integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806c30 0> context
<record_type 0x7ffff4514000 VectorIcon>
        chain <field_decl 0x7ffff450eb48 reps_size type <integer_type
0x7ffff760c150 size_t>
            unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806bb8 64> context
<record_type 0x7ffff4514000 VectorIcon> chain <field_decl 0x7ffff450eab0
name>>>
    val <integer_cst 0x7ffff1f36fc0 type <pointer_type 0x7ffff437ec78> constant
0>
    idx <field_decl 0x7ffff450eb48 reps_size
        type <integer_type 0x7ffff760c150 size_t public unsigned DI size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff781b738 precision:64 min <integer_cst 0x7ffff7806e88 0> max <integer_cst
0x7ffff7807500 18446744073709551615>
            pointer_to_this <pointer_type 0x7ffff61c8498> reference_to_this
<reference_type 0x7ffff31cc3f0>>
        unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:103:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806be8 0> bit-offset <integer_cst 0x7ffff7806bb8 64> context
<record_type 0x7ffff4514000 VectorIcon>
        chain <field_decl 0x7ffff450eab0 name type <pointer_type
0x7ffff76b2dc8>
            unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 offset_align 128
            offset <integer_cst 0x7ffff7806c18 constant 16> bit-offset
<integer_cst 0x7ffff7806c30 0> context <record_type 0x7ffff4514000
VectorIcon>>>
    val <integer_cst 0x7ffff29b9f30 type <integer_type 0x7ffff760c150 size_t>
constant 0>
    idx <field_decl 0x7ffff450eab0 name
        type <pointer_type 0x7ffff76b2dc8 type <integer_type 0x7ffff76402a0
char>
            public unsigned DI size <integer_cst 0x7ffff7806bb8 64> unit-size
<integer_cst 0x7ffff7806bd0 8>
            align:64 warn_if_not_align:0 symtab:0 alias-set 409
structural-equality
            pointer_to_this <pointer_type 0x7ffff522adc8> reference_to_this
<reference_type 0x7ffff3176f18>>
        unsigned nonlocal DI ../../ui/gfx/vector_icon_types.h:108:0 size
<integer_cst 0x7ffff7806bb8 64> unit-size <integer_cst 0x7ffff7806bd0 8>
        align:64 warn_if_not_align:0 offset_align 128 offset <integer_cst
0x7ffff7806c18 16> bit-offset <integer_cst 0x7ffff7806c30 0> context
<record_type 0x7ffff4514000 VectorIcon>>
    val <integer_cst 0x7ffff29b9e40 type <pointer_type 0x7ffff76b2dc8> constant
0>>
$18 = void

(gdb) p debug_tree(argtype)
 <pointer_type 0x7ffff77b5f18
    type <record_type 0x7ffff77b5e70 VectorIcon readonly cxx-odr-p VOID
        align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4514000 context <namespace_decl 0x7ffff7635390 gfx>
        pointer_to_this <pointer_type 0x7ffff77b5f18> reference_to_this
<reference_type 0x7ffff5e93b28>>
    public unsigned DI
    size <integer_cst 0x7ffff7806bb8 type <integer_type 0x7ffff781b0a8
bitsizetype> constant 64>
    unit-size <integer_cst 0x7ffff7806bd0 type <integer_type 0x7ffff781b000
sizetype> constant 8>
    align:64 warn_if_not_align:0 symtab:0 alias-set 1025 structural-equality>

(gdb) p debug_tree(chartype)
 <record_type 0x7ffff77b5e70 VectorIcon readonly cxx-odr-p VOID
    align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7ffff4514000 context <namespace_decl 0x7ffff7635390 gfx>
    pointer_to_this <pointer_type 0x7ffff77b5f18> reference_to_this
<reference_type 0x7ffff5e93b28>>
$21 = void

@Martin: Can you please take a look?

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  2020-07-07 11:51 ` marxin at gcc dot gnu.org
@ 2020-07-07 17:59 ` msebor at gcc dot gnu.org
  2020-07-07 19:02 ` jakub at gcc dot gnu.org
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: msebor at gcc dot gnu.org @ 2020-07-07 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Martin Sebor <msebor at gcc dot gnu.org> ---
The stack trace in comment #0:

during GIMPLE pass: strlen
../../chrome/browser/ui/views/sharing/sharing_icon_view.cc: In member function
‘GetVectorIconBadge’:
../../chrome/browser/ui/views/sharing/sharing_icon_view.cc:146: internal
compiler error: in tree_to_uhwi, at tree.h:4519
0x666aa8 tree_to_uhwi(tree_node const*)
        ../../gcc/tree.h:4519
0x666aa8 c_getstr(tree_node*, unsigned long*)
        ../../gcc/fold-const.c:15475

indicates that tree_to_uhwi() ICEs after a successful call to
tree_fits_uhwi_p():

  if (!tree_fits_uhwi_p (mem_size))
    return NULL;

  /* STRING_LENGTH is the size of the string literal, including any
     embedded NULs.  STRING_SIZE is the size of the array the string
     literal is stored in.  */
  unsigned HOST_WIDE_INT string_length = TREE_STRING_LENGTH (src);
  unsigned HOST_WIDE_INT string_size = tree_to_uhwi (mem_size);

I don't see how that can ever happen.  Am I misreading it?  What's mem_size?

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2020-07-07 17:59 ` msebor at gcc dot gnu.org
@ 2020-07-07 19:02 ` jakub at gcc dot gnu.org
  2020-07-08  7:04 ` marxin at gcc dot gnu.org
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-07-07 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #6)
> Am I misreading it?  What's mem_size?

Yes.  See Martin L.'s comment, it is 10.1 release, so the line numbers are
slightly different from trunk or current 10 branch.
Obviously the two tree_to_uhwi calls guarded with tree_fits_uhwi_p can't be it,
but it is the third one.
      tree eltype = TREE_TYPE (TREE_TYPE (src));
      /* Support only properly NUL-terminated single byte strings.  */
      if (tree_to_uhwi (TYPE_SIZE_UNIT (eltype)) != 1)
        return NULL;
And see #c5 on what it happens.
The string_constant code added in g:14b7950f126f doesn't try to verify that
chartype is some character or even integral type, nor whether it is a complete
type.
It actually doesn't seem correct even for wchar_t/char16_t/char32_t etc.,
because initsize is size in bytes.  Nothing tries to verify tree_fits_uhwi_p
(initsize) and calls build_string_literal with the chartype and initsize
converted to uhwi.
Now, if initsize is HOST_WIDE_INT_M1U, it will do something different, and even
if not, build_string_literal assumes that the string has type chartype[size],
so whenever chartype is not a byte type, but 2/4/8 byte integer, the string
literal will have size that is twice/4/8 times larger type than desired.

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (6 preceding siblings ...)
  2020-07-07 19:02 ` jakub at gcc dot gnu.org
@ 2020-07-08  7:04 ` marxin at gcc dot gnu.org
  2020-07-15  6:54 ` [Bug tree-optimization/96058] [10/11 Regression] " rguenth at gcc dot gnu.org
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-08  7:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. one can debug that with the current releases/gcc-10 branch locally in
order to get proper locations.
Thanks Jakub for the analysis.

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

* [Bug tree-optimization/96058] [10/11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (7 preceding siblings ...)
  2020-07-08  7:04 ` marxin at gcc dot gnu.org
@ 2020-07-15  6:54 ` rguenth at gcc dot gnu.org
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-15  6:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.1.0
   Target Milestone|---                         |10.2
           Priority|P3                          |P2

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

* [Bug tree-optimization/96058] [10/11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (8 preceding siblings ...)
  2020-07-15  6:54 ` [Bug tree-optimization/96058] [10/11 Regression] " rguenth at gcc dot gnu.org
@ 2020-07-23  6:51 ` rguenth at gcc dot gnu.org
  2020-07-23 13:41 ` marxin at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-07-23  6:51 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|10.2                        |10.3

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
GCC 10.2 is released, adjusting target milestone.

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

* [Bug tree-optimization/96058] [10/11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (9 preceding siblings ...)
  2020-07-23  6:51 ` rguenth at gcc dot gnu.org
@ 2020-07-23 13:41 ` marxin at gcc dot gnu.org
  2020-07-27 10:30 ` marxin at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-23 13:41 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from Martin Liška <marxin at gcc dot gnu.org> ---
@Martin: Can you please take a look?

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

* [Bug tree-optimization/96058] [10/11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (10 preceding siblings ...)
  2020-07-23 13:41 ` marxin at gcc dot gnu.org
@ 2020-07-27 10:30 ` marxin at gcc dot gnu.org
  2020-07-27 14:18 ` cvs-commit at gcc dot gnu.org
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-27 10:30 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #11 from Martin Liška <marxin at gcc dot gnu.org> ---
Working on that.

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

* [Bug tree-optimization/96058] [10/11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (11 preceding siblings ...)
  2020-07-27 10:30 ` marxin at gcc dot gnu.org
@ 2020-07-27 14:18 ` cvs-commit at gcc dot gnu.org
  2020-07-27 14:22 ` [Bug tree-optimization/96058] [11 " marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-27 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #12 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Martin Liska <marxin@gcc.gnu.org>:

https://gcc.gnu.org/g:7355a9408b990cdd20db91e2e1ba0b03e801d6a6

commit r11-2364-g7355a9408b990cdd20db91e2e1ba0b03e801d6a6
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jul 27 12:30:24 2020 +0200

    expr: build string_constant only for a char type

    gcc/ChangeLog:

            PR tree-optimization/96058
            * expr.c (string_constant): Build string_constant only
            for a type that has same precision as char_type_node
            and is an integral type.

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

* [Bug tree-optimization/96058] [11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (12 preceding siblings ...)
  2020-07-27 14:18 ` cvs-commit at gcc dot gnu.org
@ 2020-07-27 14:22 ` marxin at gcc dot gnu.org
  2020-07-28 10:37 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-27 14:22 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11 Regression] ICE in   |[11 Regression] ICE in
                   |c_getstr at                 |c_getstr at
                   |gcc/fold-const.c:15475      |gcc/fold-const.c:15475
      Known to work|                            |11.0

--- Comment #13 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on master so far.

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

* [Bug tree-optimization/96058] [11 Regression] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (13 preceding siblings ...)
  2020-07-27 14:22 ` [Bug tree-optimization/96058] [11 " marxin at gcc dot gnu.org
@ 2020-07-28 10:37 ` cvs-commit at gcc dot gnu.org
  2020-07-28 10:39 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-28 10:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #14 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Martin Liska
<marxin@gcc.gnu.org>:

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

commit r10-8542-gc0438ced53bcf57e4ebb1c38c226e41571aca892
Author: Martin Liska <mliska@suse.cz>
Date:   Mon Jul 27 12:30:24 2020 +0200

    expr: build string_constant only for a char type

    gcc/ChangeLog:

            PR tree-optimization/96058
            * expr.c (string_constant): Build string_constant only
            for a type that has same precision as char_type_node
            and is an integral type.

    (cherry picked from commit 7355a9408b990cdd20db91e2e1ba0b03e801d6a6)

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (14 preceding siblings ...)
  2020-07-28 10:37 ` cvs-commit at gcc dot gnu.org
@ 2020-07-28 10:39 ` marxin at gcc dot gnu.org
  2020-08-18  6:47 ` asolokha at gmx dot com
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-07-28 10:39 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |10.2.1
            Summary|[11 Regression] ICE in      |ICE in c_getstr at
                   |c_getstr at                 |gcc/fold-const.c:15475
                   |gcc/fold-const.c:15475      |
      Known to fail|10.1.0                      |

--- Comment #15 from Martin Liška <marxin at gcc dot gnu.org> ---
Fixed on GCC 10 as well.

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (15 preceding siblings ...)
  2020-07-28 10:39 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
@ 2020-08-18  6:47 ` asolokha at gmx dot com
  2020-08-18  7:21 ` marxin at gcc dot gnu.org
  2020-08-18  7:21 ` marxin at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: asolokha at gmx dot com @ 2020-08-18  6:47 UTC (permalink / raw)
  To: gcc-bugs

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

Arseny Solokha <asolokha at gmx dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |asolokha at gmx dot com

--- Comment #16 from Arseny Solokha <asolokha at gmx dot com> ---
Is there any work pending?

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (16 preceding siblings ...)
  2020-08-18  6:47 ` asolokha at gmx dot com
@ 2020-08-18  7:21 ` marxin at gcc dot gnu.org
  2020-08-18  7:21 ` marxin at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-18  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #17 from Martin Liška <marxin at gcc dot gnu.org> ---
(In reply to Arseny Solokha from comment #16)
> Is there any work pending?

No, that's for reminder.

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

* [Bug tree-optimization/96058] ICE in c_getstr at gcc/fold-const.c:15475
  2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
                   ` (17 preceding siblings ...)
  2020-08-18  7:21 ` marxin at gcc dot gnu.org
@ 2020-08-18  7:21 ` marxin at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-08-18  7:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #18 from Martin Liška <marxin at gcc dot gnu.org> ---
*thanks for reminder

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

end of thread, other threads:[~2020-08-18  7:21 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-04  9:16 [Bug tree-optimization/96058] New: ICE in c_getstr at gcc/fold-const.c:15475 marxin at gcc dot gnu.org
2020-07-04  9:19 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
2020-07-04 14:09 ` pinskia at gcc dot gnu.org
2020-07-04 16:33 ` marxin at gcc dot gnu.org
2020-07-06  7:19 ` rguenth at gcc dot gnu.org
2020-07-07 11:51 ` marxin at gcc dot gnu.org
2020-07-07 17:59 ` msebor at gcc dot gnu.org
2020-07-07 19:02 ` jakub at gcc dot gnu.org
2020-07-08  7:04 ` marxin at gcc dot gnu.org
2020-07-15  6:54 ` [Bug tree-optimization/96058] [10/11 Regression] " rguenth at gcc dot gnu.org
2020-07-23  6:51 ` rguenth at gcc dot gnu.org
2020-07-23 13:41 ` marxin at gcc dot gnu.org
2020-07-27 10:30 ` marxin at gcc dot gnu.org
2020-07-27 14:18 ` cvs-commit at gcc dot gnu.org
2020-07-27 14:22 ` [Bug tree-optimization/96058] [11 " marxin at gcc dot gnu.org
2020-07-28 10:37 ` cvs-commit at gcc dot gnu.org
2020-07-28 10:39 ` [Bug tree-optimization/96058] " marxin at gcc dot gnu.org
2020-08-18  6:47 ` asolokha at gmx dot com
2020-08-18  7:21 ` marxin at gcc dot gnu.org
2020-08-18  7:21 ` 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).