public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
@ 2020-11-05  8:45 zhendong.su at inf dot ethz.ch
  2020-11-05 10:19 ` [Bug tree-optimization/97725] [11 Regression] " rguenth at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: zhendong.su at inf dot ethz.ch @ 2020-11-05  8:45 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97725
           Summary: ICE at -Os and above: tree check: expected class
                    ‘type’, have ‘exceptional’ (error_mark) in
                    useless_type_conversion_p, at gimple-expr.c:87
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: zhendong.su at inf dot ethz.ch
  Target Milestone: ---

[555] % gcctk -v
Using built-in specs.
COLLECT_GCC=gcctk
COLLECT_LTO_WRAPPER=/local/suz-local/software/local/gcc-trunk/libexec/gcc/x86_64-pc-linux-gnu/11.0.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: ../gcc-trunk/configure --disable-bootstrap
--prefix=/local/suz-local/software/local/gcc-trunk --enable-languages=c,c++
--disable-werror --enable-multilib --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib
gcc version 11.0.0 20201105 (experimental) [master revision
8f565d255a3:fff11f1136a:35c125cb6ac47fa97aa5ee22f987a38e63adad08] (GCC)
[556] %
[556] % gcctk -O1 -c small.c
[557] %
[557] % gcctk -Os -c small.c
during GIMPLE pass: evrp
small.c: In function ‘main’:
small.c:25:1: internal compiler error: tree check: expected class ‘type’, have
‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
   25 | }
      | ^
0x5fdbc9 tree_class_check_failed(tree_node const*, tree_code_class, char
const*, int, char const*)
        ../../gcc-trunk/gcc/tree.c:9802
0x9bb5c3 tree_class_check(tree_node*, tree_code_class, char const*, int, char
const*)
        ../../gcc-trunk/gcc/tree.h:3436
0x9bb5c3 useless_type_conversion_p(tree_node*, tree_node*)
        ../../gcc-trunk/gcc/gimple-expr.c:87
0xd514f0 verify_gimple_phi
        ../../gcc-trunk/gcc/tree-cfg.c:5013
0xd514f0 verify_gimple_in_cfg(function*, bool)
        ../../gcc-trunk/gcc/tree-cfg.c:5342
0xc0102e execute_function_todo
        ../../gcc-trunk/gcc/passes.c:2039
0xc01f12 execute_todo
        ../../gcc-trunk/gcc/passes.c:2093
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
[558] %
[558] % cat small.c
int a;
unsigned b;

int main() {
  if (a) {
    goto L1;
    while (1)
      while (1) {
        long e = -1L, g;
        int f, h, i;
      L1:
        a = f;
      L2:
        g = e;
        f = h || g;
        e = ~(f & b);
        if (i || g < -1L) {
          ~(g || 0);
          break;
        }
        goto L2;
      }
  }
  return 0;
}

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

* [Bug tree-optimization/97725] [11 Regression] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87
  2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
@ 2020-11-05 10:19 ` rguenth at gcc dot gnu.org
  2020-11-05 10:21 ` [Bug tree-optimization/97725] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671 marxin at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-11-05 10:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE at -Os and above: tree  |[11 Regression] ICE at -Os
                   |check: expected class       |and above: tree check:
                   |‘type’, have ‘exceptional’  |expected class ‘type’, have
                   |(error_mark) in             |‘exceptional’ (error_mark)
                   |useless_type_conversion_p,  |in
                   |at gimple-expr.c:87         |useless_type_conversion_p,
                   |                            |at gimple-expr.c:87
   Target Milestone|---                         |11.0
           Priority|P3                          |P1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
It means we end up with a used but released SSA name.  Oops.

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

* [Bug tree-optimization/97725] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671
  2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
  2020-11-05 10:19 ` [Bug tree-optimization/97725] [11 Regression] " rguenth at gcc dot gnu.org
@ 2020-11-05 10:21 ` marxin at gcc dot gnu.org
  2020-11-05 18:48 ` [Bug tree-optimization/97725] [11 Regression] " amacleod at redhat dot com
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-11-05 10:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-11-05
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
      Known to fail|                            |11.0
      Known to work|                            |10.2.0
            Summary|[11 Regression] ICE at -Os  |ICE at -Os and above: tree
                   |and above: tree check:      |check: expected class
                   |expected class ‘type’, have |‘type’, have ‘exceptional’
                   |‘exceptional’ (error_mark)  |(error_mark) in
                   |in                          |useless_type_conversion_p,
                   |useless_type_conversion_p,  |at gimple-expr.c:87 since
                   |at gimple-expr.c:87         |r11-4724-ge86fd6a17cdb2671

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Nice report, started with r11-4724-ge86fd6a17cdb2671.

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

* [Bug tree-optimization/97725] [11 Regression] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671
  2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
  2020-11-05 10:19 ` [Bug tree-optimization/97725] [11 Regression] " rguenth at gcc dot gnu.org
  2020-11-05 10:21 ` [Bug tree-optimization/97725] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671 marxin at gcc dot gnu.org
@ 2020-11-05 18:48 ` amacleod at redhat dot com
  2020-11-05 20:32 ` cvs-commit at gcc dot gnu.org
  2020-11-05 20:33 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amacleod at redhat dot com @ 2020-11-05 18:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Macleod <amacleod at redhat dot com> ---
Created attachment 49512
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=49512&action=edit
Use a multirange value in value_query::value_of_*

This was triggered by a new call into range_of_stmt to reevaluate

_3 = e_15 != 0;

we already knew it was [1,1], and had folded some stuff away.  however, e_15
had been further refined so _3 was out of date.

mostly harmless, except e_15 now has a range of
long int [-1, -1][4294967294, 4294967295]

obviously that will still evaluate to [1,1]... except it didn't :-P  it came
back VARYING.

!= checks if the intersection of the 2 operands is empty... which it should be, 
but the code reuses the result range passed in as the temporary.. and that
turns out of be a value_range.  so when we copy  [-1, -1][4294967294,
4294967295] into the value_range, it cant be fully represented, and we end up
with
 long int [-1, 4294967295]
and can no longer tell it is not equal to [0,0].

doh.

First, the range-ops code for not_equal and equal should be adjusted to not use
the range passed in as a temporary.. the consumer may well know this is a
boolean and only pass in an int_range<1> on purpose.

second, the true root is that the 3 value_of_* routines actually pass in a 
value_range rather than a multirange... Original thinking was we are looking
for a single value result.  But there are other range_ops routines that build
into the value passed, like multiply and others, so its better to simple pass
in an int_range_max or something similar could happen elsewhere.

testing the attached patch

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

* [Bug tree-optimization/97725] [11 Regression] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671
  2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
                   ` (2 preceding siblings ...)
  2020-11-05 18:48 ` [Bug tree-optimization/97725] [11 Regression] " amacleod at redhat dot com
@ 2020-11-05 20:32 ` cvs-commit at gcc dot gnu.org
  2020-11-05 20:33 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-11-05 20:32 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:22984f3f090921b5ac80ec0057f6754ec458e97e

commit r11-4755-g22984f3f090921b5ac80ec0057f6754ec458e97e
Author: Andrew MacLeod <amacleod@redhat.com>
Date:   Thu Nov 5 13:59:45 2020 -0500

    Pass multi-range from range_query::value_*  routines

    fix range-ops equal/not_equal to not reuse the result range as
intermediary.
    value_query::value routines should pasa multi-range in as some other
rangeop
    routines build into this result, so we may need better precision.

            gcc/
            PR tree-optimization/97725
            * range-op.cc (operator_equal::fold_range): Use new tmp value.
            (operator_not_equal::fold_range): Ditto.
            * value-query.cc (range_query::value_of_expr): Use int_range_max
            not a value_range.
            (range_query::value_on_edge): Ditto.
            (range_query::value_of_stmt): Ditto.
            gcc/testsuite/
            * gcc.dg/pr97725.c: New.

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

* [Bug tree-optimization/97725] [11 Regression] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671
  2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
                   ` (3 preceding siblings ...)
  2020-11-05 20:32 ` cvs-commit at gcc dot gnu.org
@ 2020-11-05 20:33 ` amacleod at redhat dot com
  4 siblings, 0 replies; 6+ messages in thread
From: amacleod at redhat dot com @ 2020-11-05 20:33 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Macleod <amacleod at redhat dot com> changed:

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

--- Comment #5 from Andrew Macleod <amacleod at redhat dot com> ---
fixed.

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

end of thread, other threads:[~2020-11-05 20:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-05  8:45 [Bug tree-optimization/97725] New: ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 zhendong.su at inf dot ethz.ch
2020-11-05 10:19 ` [Bug tree-optimization/97725] [11 Regression] " rguenth at gcc dot gnu.org
2020-11-05 10:21 ` [Bug tree-optimization/97725] ICE at -Os and above: tree check: expected class ‘type’, have ‘exceptional’ (error_mark) in useless_type_conversion_p, at gimple-expr.c:87 since r11-4724-ge86fd6a17cdb2671 marxin at gcc dot gnu.org
2020-11-05 18:48 ` [Bug tree-optimization/97725] [11 Regression] " amacleod at redhat dot com
2020-11-05 20:32 ` cvs-commit at gcc dot gnu.org
2020-11-05 20:33 ` amacleod at redhat dot com

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).