public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall
@ 2023-01-25 18:28 dcb314 at hotmail dot com
  2023-01-25 18:40 ` [Bug tree-optimization/108547] " pinskia at gcc dot gnu.org
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: dcb314 at hotmail dot com @ 2023-01-25 18:28 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108547
           Summary: ice in decompose, at wide-int.h:984 for -O2 with -Wall
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

This legal C source code:

int li_4, li_5, us_8;
unsigned char func_7_ptr_13, func_7_uc_14;
void func_7_ptr_18() {
  if (li_5) {
    for (;;)
      ;
    short s_15;
    for (; func_7_uc_14;) {
      us_8 = 7;
      for (; us_8; us_8 += 1)
      lblD2AF1FAB:
        if (us_8)
          li_4 = 1;
      func_7_uc_14 += func_7_ptr_18;
      if (func_7_ptr_13 & 1 && (func_7_uc_14 &= func_7_ptr_13))
        s_15 %= func_7_uc_10li_19(s_15);
    }
  }
  goto lblD2AF1FAB;
}

when compiled with recent gcc trunk, does this:

$ ~/gcc/results//bin/gcc -c -O2 -Wall bug876.c 
bug876.c: In function ‘func_7_ptr_18’:
bug876.c:14:20: warning: assignment to ‘unsigned char’ from ‘void (*)()’ makes
integer from pointer without a cast [-Wint-conversion]
   14 |       func_7_uc_14 += func_7_ptr_18;
      |                    ^~
bug876.c:16:17: warning: implicit declaration of function ‘func_7_uc_10li_19’
[-Wimplicit-function-declaration]
   16 |         s_15 %= func_7_uc_10li_19(s_15);
      |                 ^~~~~~~~~~~~~~~~~
during GIMPLE pass: uninit
bug876.c:3:6: internal compiler error: in decompose, at wide-int.h:984
    3 | void func_7_ptr_18() {
      |      ^~~~~~~~~~~~~
0x1df0eb9 value_sat_pred_p(tree_node*, tree_node*, tree_code, bool)
        ../../trunk.d1/gcc/wide-int.h:0

The bug first seems to appear sometime before git hash g:9b111debbfb79a0a
dated 20221229.

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

* [Bug tree-optimization/108547] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
@ 2023-01-25 18:40 ` pinskia at gcc dot gnu.org
  2023-01-25 18:43 ` pinskia at gcc dot gnu.org
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25 18:40 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is the full backtrace:
0xc7c58b wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::decompose(long*, unsigned int, generic_wide_int<wide_int_ref_storage<false,
false> > const&)
        /home/apinski/src/upstream-gcc/gcc/gcc/wide-int.h:984
0xc7c7a4 wide_int_ref_storage<false,
false>::wide_int_ref_storage<generic_wide_int<wide_int_ref_storage<false,
false> > >(generic_wide_int<wide_int_ref_storage<false, false> > const&,
unsigned int)
        /home/apinski/src/upstream-gcc/gcc/gcc/wide-int.h:1034
0xc7bd5e generic_wide_int<wide_int_ref_storage<false, false>
>::generic_wide_int<generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&, unsigned int)
        /home/apinski/src/upstream-gcc/gcc/gcc/wide-int.h:790
0x1084abf wi::binary_traits<generic_wide_int<wide_int_ref_storage<false, false>
>, generic_wide_int<wide_int_ref_storage<false, false> >,
wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::precision_type, wi::int_traits<generic_wide_int<wide_int_ref_storage<false,
false> > >::precision_type>::result_type
wi::bit_and<generic_wide_int<wide_int_ref_storage<false, false> >,
generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&,
generic_wide_int<wide_int_ref_storage<false, false> > const&)
        /home/apinski/src/upstream-gcc/gcc/gcc/wide-int.h:2338
0x1081df1 wi::binary_traits<generic_wide_int<wide_int_ref_storage<false, false>
>, generic_wide_int<wide_int_ref_storage<false, false> >,
wi::int_traits<generic_wide_int<wide_int_ref_storage<false, false> >
>::precision_type, wi::int_traits<generic_wide_int<wide_int_ref_storage<false,
false> > >::precision_type>::operator_result
operator&<generic_wide_int<wide_int_ref_storage<false, false> >,
generic_wide_int<wide_int_ref_storage<false, false> >
>(generic_wide_int<wide_int_ref_storage<false, false> > const&,
generic_wide_int<wide_int_ref_storage<false, false> > const&)
        /home/apinski/src/upstream-gcc/gcc/gcc/wide-int.h:3309
0x2c9c925 value_sat_pred_p
        /home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:731
0x2c9ca99 subset_of
        /home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:765
0x2c9cb89 subset_of
        /home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:792
0x2c9cc09 predicate::includes(vec<pred_info, va_heap, vl_ptr> const&) const
        /home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:815
0x2c9cc71 predicate::superset_of(predicate const&) const
        /home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:834
0x2ca09e6 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int, hash_set<gphi*, false, default_hash_traits<gphi*> >*)
       
/home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:2250
0x2ca0a86 uninit_analysis::is_use_guarded(gimple*, basic_block_def*, gphi*,
unsigned int)
       
/home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:2263
0x19370ab find_uninit_use
        /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssa-uninit.cc:1234
0x193745f warn_uninitialized_phi
        /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssa-uninit.cc:1304
0x193791e execute_late_warn_uninitialized
        /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssa-uninit.cc:1425
0x19379f5 execute
        /home/apinski/src/upstream-gcc/gcc/gcc/tree-ssa-uninit.cc:1442
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.

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

* [Bug tree-optimization/108547] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
  2023-01-25 18:40 ` [Bug tree-optimization/108547] " pinskia at gcc dot gnu.org
@ 2023-01-25 18:43 ` pinskia at gcc dot gnu.org
  2023-01-25 18:46 ` pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2023-01-25
             Status|UNCONFIRMED                 |NEW

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
#7  0x0000000002c9c926 in value_sat_pred_p (val=0x7ffff7265138,
boundary=0x7ffff73f7a80, cmpc=BIT_AND_EXPR, exact_p=false) at
/home/apinski/src/upstream-gcc/gcc/gcc/gimple-predicate-analysis.cc:731
731       wide_int andw = wi::to_wide (val) & wi::to_wide (boundary);
(gdb) p debug_tree(val)
 <integer_cst 0x7ffff7265138 type <integer_type 0x7ffff72615e8 int> constant 0>
$7 = void
(gdb) p debug_tree(boundary)
 <integer_cst 0x7ffff73f7a80 type <integer_type 0x7ffff7261348 unsigned char>
constant 1>
$8 = void

Confirmed.

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

* [Bug tree-optimization/108547] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
  2023-01-25 18:40 ` [Bug tree-optimization/108547] " pinskia at gcc dot gnu.org
  2023-01-25 18:43 ` pinskia at gcc dot gnu.org
@ 2023-01-25 18:46 ` pinskia at gcc dot gnu.org
  2023-01-25 18:48 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25 18:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Here is a slightly better testcase that does not depend on implicit conversion
from a function pointer to an integer.

int li_4, li_5, us_8;
unsigned char func_7_ptr_13, func_7_uc_14;
long t;
int func_7_uc_10li_19(int);
void func_7_ptr_18() {
  if (li_5) {
    for (;;)
      ;
    short s_15;
    for (; func_7_uc_14;) {
      us_8 = 7;
      for (; us_8; us_8 += 1)
      lblD2AF1FAB:
        if (us_8)
          li_4 = 1;
      func_7_uc_14 += t;
      if (func_7_ptr_13 & 1 && (func_7_uc_14 &= func_7_ptr_13))
        s_15 %= func_7_uc_10li_19(s_15);
    }
  }
  goto lblD2AF1FAB;
}

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

* [Bug tree-optimization/108547] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2023-01-25 18:46 ` pinskia at gcc dot gnu.org
@ 2023-01-25 18:48 ` pinskia at gcc dot gnu.org
  2023-01-25 19:49 ` [Bug tree-optimization/108547] [13 Regression] " pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I suspect it is trying to simplifying:
        ((NOT (us_8.1_2 != 0)))
        OR ((func_7_ptr_13.8_9 != 0) AND (_8 != 0) AND (func_7_ptr_13.8_9 & 1)
AND (NOT (_49 != 0)) AND (NOT (prephitmp_37 != 0)))
        OR ((func_7_ptr_13.8_9 & 1) AND (NOT (_49 != 0)) AND (NOT (_11 != 0)))
        OR ((NOT (_30 != 0)) AND (NOT (_49 != 0)) AND (NOT (prephitmp_37 !=
0)))

Note the & 1 there .... That seems like the issue, trying to simplify:
(func_7_ptr_13.8_9 != 0) AND (func_7_ptr_13.8_9 & 1)

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

* [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2023-01-25 18:48 ` pinskia at gcc dot gnu.org
@ 2023-01-25 19:49 ` pinskia at gcc dot gnu.org
  2023-01-26  7:45 ` rguenth at gcc dot gnu.org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-01-25 19:49 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |13.0
            Summary|ice in decompose, at        |[13 Regression] ice in
                   |wide-int.h:984 for -O2 with |decompose, at
                   |-Wall                       |wide-int.h:984 for -O2 with
                   |                            |-Wall

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
My bet this was introduced by r13-4408-gb628cad9e093f7 or
r13-4406-g9500877d05c56c.

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

* [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2023-01-25 19:49 ` [Bug tree-optimization/108547] [13 Regression] " pinskia at gcc dot gnu.org
@ 2023-01-26  7:45 ` rguenth at gcc dot gnu.org
  2023-01-26  9:45 ` [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7 marxin at gcc dot gnu.org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26  7:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
I will have a look.

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

* [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2023-01-26  7:45 ` rguenth at gcc dot gnu.org
@ 2023-01-26  9:45 ` marxin at gcc dot gnu.org
  2023-01-26 12:49 ` cvs-commit at gcc dot gnu.org
  2023-01-26 12:50 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: marxin at gcc dot gnu.org @ 2023-01-26  9:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[13 Regression] ice in      |[13 Regression] ice in
                   |decompose, at               |decompose, at
                   |wide-int.h:984 for -O2 with |wide-int.h:984 for -O2 with
                   |-Wall                       |-Wall since
                   |                            |r13-2500-g0a4a2667dc115ca7
                 CC|                            |marxin at gcc dot gnu.org

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
Btw. started with r13-2500-g0a4a2667dc115ca7.

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

* [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2023-01-26  9:45 ` [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7 marxin at gcc dot gnu.org
@ 2023-01-26 12:49 ` cvs-commit at gcc dot gnu.org
  2023-01-26 12:50 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-01-26 12:49 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 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:c71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d

commit r13-5383-gc71a128a3e1ff6ee5274fc2df49ea650bc9e6c2d
Author: Richard Biener <rguenther@suse.de>
Date:   Thu Jan 26 08:59:20 2023 +0100

    tree-optimization/108547 - robustify uninit predicate analysis

    Predicate analysis, when looking through casts doesn't bother to
    convert boundary constants to the type of the bounded variables.
    The following robustifies value_sat_pred_p to use widest_ints
    to deal with this, like other code in predicate analysis.

            PR tree-optimization/108547
            * gimple-predicate-analysis.cc (value_sat_pred_p):
            Use widest_int.

            * gcc.dg/uninit-pr108547.c: New testcase.

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

* [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7
  2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2023-01-26 12:49 ` cvs-commit at gcc dot gnu.org
@ 2023-01-26 12:50 ` rguenth at gcc dot gnu.org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu.org @ 2023-01-26 12:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|2023-01-25 00:00:00         |2023-1-26
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed (possibly latent).

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

end of thread, other threads:[~2023-01-26 12:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25 18:28 [Bug c/108547] New: ice in decompose, at wide-int.h:984 for -O2 with -Wall dcb314 at hotmail dot com
2023-01-25 18:40 ` [Bug tree-optimization/108547] " pinskia at gcc dot gnu.org
2023-01-25 18:43 ` pinskia at gcc dot gnu.org
2023-01-25 18:46 ` pinskia at gcc dot gnu.org
2023-01-25 18:48 ` pinskia at gcc dot gnu.org
2023-01-25 19:49 ` [Bug tree-optimization/108547] [13 Regression] " pinskia at gcc dot gnu.org
2023-01-26  7:45 ` rguenth at gcc dot gnu.org
2023-01-26  9:45 ` [Bug tree-optimization/108547] [13 Regression] ice in decompose, at wide-int.h:984 for -O2 with -Wall since r13-2500-g0a4a2667dc115ca7 marxin at gcc dot gnu.org
2023-01-26 12:49 ` cvs-commit at gcc dot gnu.org
2023-01-26 12:50 ` 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).