public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
@ 2021-10-27 12:47 pnarsing at mathworks dot com
  2021-10-27 15:50 ` [Bug tree-optimization/102960] [10/11/12 Regression] " msebor at gcc dot gnu.org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: pnarsing at mathworks dot com @ 2021-10-27 12:47 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102960
           Summary: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pnarsing at mathworks dot com
  Target Milestone: ---

Created attachment 51675
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51675&action=edit
preprocessed output of cpp file causing ice

On compiling cpp file with -Og flag I'm getting ICE coming from wide-int.h 

Attaching preprocessed file with this bug report .

To reproduce the issue 
g++ -c RangeDisplay.cpp -Og 


Stack for ICE :
 internal compiler error: in sign_mask, at wide-int.h:855
   89 | char const* RangeDisplay::toString(StringBuffer& aStringBuffer) const {
      |             ^~~~~~~~~~~~
0x5ea99c generic_wide_int<wide_int_ref_storage<true, false> >::sign_mask()
const
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/wide-int.h:855
0x6488cd generic_wide_int<wide_int_ref_storage<true, false> >::sign_mask()
const
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/wide-int.h:1898
0x6488cd bool wi::neg_p<generic_wide_int<wide_int_ref_storage<true, false> >
>(generic_wide_int<wide_int_ref_storage<true, false> > const&, signop)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/wide-int.h:1836
0x6488cd bool wi::lts_p<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/wide-int.h:1914
0xdda1ad wi::binary_traits<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >,
wi::int_traits<generic_wide_int<wi::extended_tree<192> > >::precision_type,
wi::int_traits<generic_wide_int<wi::extended_tree<192> >
>::precision_type>::signed_predicate_result operator<
<generic_wide_int<wi::extended_tree<192> >,
generic_wide_int<wi::extended_tree<192> >
>(generic_wide_int<wi::extended_tree<192> > const&,
generic_wide_int<wi::extended_tree<192> > const&)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/wide-int.h:3248
0xdda1ad tree_int_cst_lt(tree_node const*, tree_node const*)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree.h:6105
0xdda1ad get_range_strlen_dynamic
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:1067
0xdda591 get_range_strlen_dynamic(tree_node*, c_strlen_data*, vr_values const*)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:1211
0x1447d13 get_string_length
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/gimple-ssa-sprintf.c:2029
0x1447d13 format_string
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/gimple-ssa-sprintf.c:2466
0x1449a98 format_directive
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/gimple-ssa-sprintf.c:3059
0x1449a98 compute_format_length
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/gimple-ssa-sprintf.c:4002
0x1449a98 handle_printf_call(gimple_stmt_iterator*, vr_values const*)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/gimple-ssa-sprintf.c:4683
0xde0fab strlen_check_and_optimize_call
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:5463
0xde0fab check_and_optimize_stmt
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:5631
0xde0fab strlen_dom_walker::before_dom_children(basic_block_def*)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:5864
0x140c237 dom_walker::walk(basic_block_def*)
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/domwalk.c:309
0xdd7e2e printf_strlen_execute
       
/mathworks/devel/sandbox/pnarsing/3p-internal-AH3/3p/sources/gcc-10.3/gcc/tree-ssa-strlen.c:5930
Please submit a full bug report,
with preprocessed source if appropriate.

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
@ 2021-10-27 15:50 ` msebor at gcc dot gnu.org
  2021-10-27 21:21 ` pinskia at gcc dot gnu.org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-27 15:50 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
      Known to fail|                            |10.3.0, 11.2.0, 12.0
            Summary|ICE: in sign_mask, at       |[10/11/12 Regression] ICE:
                   |wide-int.h:855 in GCC       |in sign_mask, at
                   |10.3.0                      |wide-int.h:855 in GCC
                   |                            |10.3.0
   Last reconfirmed|                            |2021-10-27
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed with 10 and above.  The code below expects minlen to be constant but
it's actually a COND_EXPR.

                      /* Adjust the minimum and maximum length determined
                         so far and the upper bound on the array size.  */
                      if (!pdata->minlen
                          || tree_int_cst_lt (argdata.minlen, pdata->minlen))
                        pdata->minlen = argdata.minlen;

The length is computed from the variable below:

 <ssa_name 0x7fffea150f30
    type <pointer_type 0x7fffea8215e8
        type <integer_type 0x7fffea821540 char readonly public type_6 QI
            size <integer_cst 0x7fffea817048 constant 8>
            unit-size <integer_cst 0x7fffea817060 constant 1>
            align:8 warn_if_not_align:0 symtab:0 alias-set -1 canonical-type
0x7fffea821540 precision:8 min <integer_cst 0x7fffea817090 -128> max
<integer_cst 0x7fffea8170c0 127>
            pointer_to_this <pointer_type 0x7fffea8215e8> reference_to_this
<reference_type 0x7fffe9d8b1f8>>
        sizes-gimplified public unsigned type_6 DI
        size <integer_cst 0x7fffea7f5f48 constant 64>
        unit-size <integer_cst 0x7fffea7f5f60 constant 8>
        align:64 warn_if_not_align:0 symtab:0 alias-set 3 canonical-type
0x7fffea8215e8
        pointer_to_this <pointer_type 0x7fffea9d5540>>
    visited var <var_decl 0x7fffe912f900 sNaN>
    def_stmt sNaN_8 = &", NaN"[commaAdjust_2];
    version:8>

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
  2021-10-27 15:50 ` [Bug tree-optimization/102960] [10/11/12 Regression] " msebor at gcc dot gnu.org
@ 2021-10-27 21:21 ` pinskia at gcc dot gnu.org
  2021-10-28 10:08 ` acoplan at gcc dot gnu.org
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-27 21:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
   Target Milestone|---                         |10.4

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
  2021-10-27 15:50 ` [Bug tree-optimization/102960] [10/11/12 Regression] " msebor at gcc dot gnu.org
  2021-10-27 21:21 ` pinskia at gcc dot gnu.org
@ 2021-10-28 10:08 ` acoplan at gcc dot gnu.org
  2021-10-28 11:39 ` acoplan at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-10-28 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |acoplan at gcc dot gnu.org
           Keywords|needs-reduction             |

--- Comment #2 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Reduced testcase:

long l;
int f();
void g(void) {
  const char *s;
  if (f())
    s = &", NaN"[l];
  __builtin_printf("%s", s);
}

also confirmed on aarch64-linux-gnu.

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (2 preceding siblings ...)
  2021-10-28 10:08 ` acoplan at gcc dot gnu.org
@ 2021-10-28 11:39 ` acoplan at gcc dot gnu.org
  2021-10-28 15:37 ` msebor at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: acoplan at gcc dot gnu.org @ 2021-10-28 11:39 UTC (permalink / raw)
  To: gcc-bugs

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

Alex Coplan <acoplan at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-bisection             |

--- Comment #3 from Alex Coplan <acoplan at gcc dot gnu.org> ---
Looks like it started with r10-2814-g22fca489eaf98f2691772b51773a1e4eb7bb4ef2
FWIW:

commit 22fca489eaf98f2691772b51773a1e4eb7bb4ef2
Author: Martin Sebor <msebor@redhat.com>
Date:   Mon Aug 26 19:29:45 2019

    PR tree-optimization/83431 - -Wformat-truncation may incorrectly report
truncation

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (3 preceding siblings ...)
  2021-10-28 11:39 ` acoplan at gcc dot gnu.org
@ 2021-10-28 15:37 ` msebor at gcc dot gnu.org
  2021-11-05 13:43 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-10-28 15:37 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

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

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (4 preceding siblings ...)
  2021-10-28 15:37 ` msebor at gcc dot gnu.org
@ 2021-11-05 13:43 ` rguenth at gcc dot gnu.org
  2021-11-16 16:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2021-11-05 13:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug tree-optimization/102960] [10/11/12 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (5 preceding siblings ...)
  2021-11-05 13:43 ` rguenth at gcc dot gnu.org
@ 2021-11-16 16:23 ` cvs-commit at gcc dot gnu.org
  2021-11-16 16:24 ` [Bug tree-optimization/102960] [10/11 " msebor at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-16 16:23 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-5310-gba6e17e78db543b336c196b55fa6430e513f1941
Author: Martin Sebor <msebor@redhat.com>
Date:   Tue Nov 16 09:18:25 2021 -0700

    Avoid assuming maximum string length is constant [PR102960].

    Resolves:
    PR tree-optimization/102960 - ICE: in sign_mask, at wide-int.h:855 in GCC
10.3.0

    gcc/ChangeLog:

            PR tree-optimization/102960
            * gimple-fold.c (get_range_strlen): Take bitmap as an argument
rather
            than a pointer to it.
            (get_range_strlen_tree): Same.  Remove bitmap allocation.  Use
            an auto_bitmap.
            (get_maxval_strlen): Use an auto_bitmap.
            * tree-ssa-strlen.c (get_range_strlen_dynamic): Factor out PHI
            handling...
            (get_range_strlen_phi): ...into this function.
            Avoid assuming maximum string length is constant
            (printf_strlen_execute): Dump pointer query cache contents when
            details are requisted.

    gcc/testsuite/ChangeLog:

            PR tree-optimization/102960
            * gcc.dg/Wstringop-overflow-84.c: New test.

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

* [Bug tree-optimization/102960] [10/11 Regression] ICE: in sign_mask,  at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (6 preceding siblings ...)
  2021-11-16 16:23 ` cvs-commit at gcc dot gnu.org
@ 2021-11-16 16:24 ` msebor at gcc dot gnu.org
  2022-06-28 10:46 ` jakub at gcc dot gnu.org
  2023-07-07 10:41 ` [Bug tree-optimization/102960] [11 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: msebor at gcc dot gnu.org @ 2021-11-16 16:24 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|12.0                        |
      Known to work|                            |12.0
            Summary|[10/11/12 Regression] ICE:  |[10/11 Regression] ICE: in
                   |in sign_mask, at            |sign_mask, at
                   |wide-int.h:855 in GCC       |wide-int.h:855 in GCC
                   |10.3.0                      |10.3.0

--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> ---
Fixed in GCC 12.0.  Will backport.

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

* [Bug tree-optimization/102960] [10/11 Regression] ICE: in sign_mask,  at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (7 preceding siblings ...)
  2021-11-16 16:24 ` [Bug tree-optimization/102960] [10/11 " msebor at gcc dot gnu.org
@ 2022-06-28 10:46 ` jakub at gcc dot gnu.org
  2023-07-07 10:41 ` [Bug tree-optimization/102960] [11 " rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: jakub at gcc dot gnu.org @ 2022-06-28 10:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 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] 11+ messages in thread

* [Bug tree-optimization/102960] [11 Regression] ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0
  2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
                   ` (8 preceding siblings ...)
  2022-06-28 10:46 ` jakub at gcc dot gnu.org
@ 2023-07-07 10:41 ` rguenth at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-07-07 10:41 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

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

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

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-27 12:47 [Bug c++/102960] New: ICE: in sign_mask, at wide-int.h:855 in GCC 10.3.0 pnarsing at mathworks dot com
2021-10-27 15:50 ` [Bug tree-optimization/102960] [10/11/12 Regression] " msebor at gcc dot gnu.org
2021-10-27 21:21 ` pinskia at gcc dot gnu.org
2021-10-28 10:08 ` acoplan at gcc dot gnu.org
2021-10-28 11:39 ` acoplan at gcc dot gnu.org
2021-10-28 15:37 ` msebor at gcc dot gnu.org
2021-11-05 13:43 ` rguenth at gcc dot gnu.org
2021-11-16 16:23 ` cvs-commit at gcc dot gnu.org
2021-11-16 16:24 ` [Bug tree-optimization/102960] [10/11 " msebor at gcc dot gnu.org
2022-06-28 10:46 ` jakub at gcc dot gnu.org
2023-07-07 10:41 ` [Bug tree-optimization/102960] [11 " 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).