public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061
@ 2021-06-05 17:48 dcb314 at hotmail dot com
  2021-06-05 18:29 ` [Bug c++/100925] " dcb314 at hotmail dot com
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-06-05 17:48 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 100925
           Summary: tree check fail in make_range_step, at
                    fold-const.c:5061
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

For this C++ code:

struct QScopedPointerDeleter {
  static void cleanup(int *);
};
class QScopedPointer {
  typedef int *QScopedPointer::*RestrictedBool;

public:
  operator RestrictedBool() { return d ? nullptr : &QScopedPointer::d; }
  void reset() {
    if (d)
      QScopedPointerDeleter::cleanup(d);
  }
  int *d;
};
class DOpenGLPaintDevicePrivate {
public:
  QScopedPointer fbo;
} DOpenGLPaintDeviceresize_d;
void DOpenGLPaintDeviceresize() {
  if (DOpenGLPaintDeviceresize_d.fbo)
    DOpenGLPaintDeviceresize_d.fbo.reset();
}

compiled with recent gcc trunk, does this:

$ /home/dcb/gcc/results.20210605//bin/g++ -c -w -O1 bug722.cc 2>&1 | more
during GIMPLE pass: reassoc
bug722.cc: In function ‘void DOpenGLPaintDeviceresize()’:
bug722.cc:19:6: internal compiler error: tree check: expected boolean_type or 
enumeral_type or integer_type, have offset_type in make_range_step, at fold-co
nst.c:5061
   19 | void DOpenGLPaintDeviceresize() {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~
0x8a9565 tree_check_failed(tree_node const*, char const*, int, char const*, ..
.)
        ../../trunk.git/gcc/tree.c:8684
0x7a0a73 any_integral_type_check(tree_node*, char const*, int, char const*)
        ../../trunk.git/gcc/tree.h:3617
0x7ad465 any_integral_type_check(tree_node*, char const*, int, char const*)
        ../../trunk.git/gcc/tree.h:3485
0x7ad465 make_range_step(unsigned int, tree_code, tree_node*, tree_node*, tree
_node*, tree_node**, tree_node**, int*, bool*)
        ../../trunk.git/gcc/fold-const.c:5061

The problem first seems to occur sometime between date 20210527 and 20210604.
Git hashes 6c67afaf524a5e0e and ad3f0ad4bafe3770.

I will have my usual go at refining the range of the git hashes.

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

* [Bug c++/100925] tree check fail in make_range_step, at fold-const.c:5061
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
@ 2021-06-05 18:29 ` dcb314 at hotmail dot com
  2021-06-05 19:12 ` dcb314 at hotmail dot com
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-06-05 18:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Seems ok at ea418485c700494c. Trying 7ed1cd9665d8ca0f

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

* [Bug c++/100925] tree check fail in make_range_step, at fold-const.c:5061
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
  2021-06-05 18:29 ` [Bug c++/100925] " dcb314 at hotmail dot com
@ 2021-06-05 19:12 ` dcb314 at hotmail dot com
  2021-06-05 19:36 ` dcb314 at hotmail dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-06-05 19:12 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from David Binderman <dcb314 at hotmail dot com> ---
(In reply to David Binderman from comment #1)
> Seems ok at ea418485c700494c. Trying 7ed1cd9665d8ca0f

Tried it and it seems bad. Range seems to be (ea418485c700494c,
7ed1cd9665d8ca0f).
Trying d2d74c9fc0cf46f6.

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

* [Bug c++/100925] tree check fail in make_range_step, at fold-const.c:5061
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
  2021-06-05 18:29 ` [Bug c++/100925] " dcb314 at hotmail dot com
  2021-06-05 19:12 ` dcb314 at hotmail dot com
@ 2021-06-05 19:36 ` dcb314 at hotmail dot com
  2021-06-05 19:59 ` [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc pinskia at gcc dot gnu.org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: dcb314 at hotmail dot com @ 2021-06-05 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from David Binderman <dcb314 at hotmail dot com> ---
That one seems bad, so current range is (ea418485c700494c..d2d74c9fc0cf46f6),
so 15 revisions left.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-06-05 19:36 ` dcb314 at hotmail dot com
@ 2021-06-05 19:59 ` pinskia at gcc dot gnu.org
  2021-06-05 20:06 ` pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-05 19:59 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2021-06-05
                 CC|                            |pinskia at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
It was exposed by r12-1152.

Phi-opt produces this now:
  _9 = _3 != 0B;
  _10 = (<<< Unknown tree: offset_type >>>) _9;
  _11 = -_10;
/// The above is new

  _6 = _3 != 0B;
  _7 = _11 != -1;
  _8 = _6 & _7;

----- CUT ----
before reassoc we have:
  _9 = _3 != 0B;
  _10 = (<<< Unknown tree: offset_type >>>) _9;
  _11 = -_10;
  _7 = _11 != -1;
  _8 = _7 & _9;
---- CUT ---

But _9 and _7 will always have the same value even.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-06-05 19:59 ` [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc pinskia at gcc dot gnu.org
@ 2021-06-05 20:06 ` pinskia at gcc dot gnu.org
  2021-06-06  0:21 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-05 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
   Target Milestone|---                         |12.0
           Assignee|unassigned at gcc dot gnu.org      |pinskia at gcc dot gnu.org

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Andrew Pinski from comment #4)
> It was exposed by r12-1152.
> 
> Phi-opt produces this now:
>   _9 = _3 != 0B;
>   _10 = (<<< Unknown tree: offset_type >>>) _9;
>   _11 = -_10;
> /// The above is new
> 
>   _6 = _3 != 0B;
>   _7 = _11 != -1;
>   _8 = _6 & _7;
> 
> ----- CUT ----
> before reassoc we have:
>   _9 = _3 != 0B;
>   _10 = (<<< Unknown tree: offset_type >>>) _9;
>   _11 = -_10;
>   _7 = _11 != -1;
>   _8 = _7 & _9;
> ---- CUT ---
> 
> But _9 and _7 will always have the same value even.

The problem is r12-1055 really which causes the offset type to used here.  
I need a check for INTEGRAL_TYPE_P to avoid this.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2021-06-05 20:06 ` pinskia at gcc dot gnu.org
@ 2021-06-06  0:21 ` pinskia at gcc dot gnu.org
  2021-06-09  1:36 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-06  0:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=53336

--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Related to the older PR 53336 bug.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2021-06-06  0:21 ` pinskia at gcc dot gnu.org
@ 2021-06-09  1:36 ` pinskia at gcc dot gnu.org
  2021-06-09 19:20 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-09  1:36 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                URL|                            |https://gcc.gnu.org/piperma
                   |                            |il/gcc-patches/2021-June/57
                   |                            |2317.html
           Keywords|                            |patch

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Patch submitted:
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572317.html

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (6 preceding siblings ...)
  2021-06-09  1:36 ` pinskia at gcc dot gnu.org
@ 2021-06-09 19:20 ` cvs-commit at gcc dot gnu.org
  2021-06-09 19:20 ` pinskia at gcc dot gnu.org
  2021-06-18  8:24 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-09 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r12-1349-gd4faa36e7540c573c5dc17850bcd938d0900b2e9
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sat Jun 5 21:25:58 2021 -0700

    Fix PR 100925: Limit some a?CST1:CST2 optimizations to intergal types only

    The problem here is with offset (and pointer) types is we produce
    a negative expression when this optimization hits.
    It is easier to disable this optimization for all non-integeral types
    instead of finding an integer type which is the same precission as the
    type to do the negative expression on it.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    gcc/ChangeLog:

            PR tree-optimization/100925
            * match.pd (a ? CST1 : CST2): Limit transformations
            that would produce a negative to integeral types only.
            Change !POINTER_TYPE_P to INTEGRAL_TYPE_P also.

    gcc/testsuite/ChangeLog:

            * g++.dg/torture/pr100925.C: New test.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (7 preceding siblings ...)
  2021-06-09 19:20 ` cvs-commit at gcc dot gnu.org
@ 2021-06-09 19:20 ` pinskia at gcc dot gnu.org
  2021-06-18  8:24 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-06-09 19:20 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #9 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Fixed.

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

* [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc
  2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
                   ` (8 preceding siblings ...)
  2021-06-09 19:20 ` pinskia at gcc dot gnu.org
@ 2021-06-18  8:24 ` cvs-commit at gcc dot gnu.org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-18  8:24 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:2f1686ff70b25fceb04ca2ffc0a450fb682913ef

commit r12-1608-g2f1686ff70b25fceb04ca2ffc0a450fb682913ef
Author: Andrew Pinski <apinski@marvell.com>
Date:   Sat Jun 5 19:03:06 2021 -0700

    Disallow pointer and offset types on some gimple

    While debugging PR 100925, I found that the gimple verifiers
    don't reject NEGATE on pointer or offset type.
    This patch adds the check on some unary and binary gimple which
    should not have operated on pointer/offset types.

    OK? Bootstrapped and tested on x86_64-linux-gnu with no regressions.

    Thanks,
    Andrew Pinski

    gcc/ChangeLog:

            * tree-cfg.c (verify_gimple_assign_unary): Reject point and offset
            types on NEGATE_EXPR, ABS_EXPR, BIT_NOT_EXPR, PAREN_EXPR and
CNONJ_EXPR.
            (verify_gimple_assign_binary): Reject point and offset types on
            MULT_EXPR, MULT_HIGHPART_EXPR, TRUNC_DIV_EXPR, CEIL_DIV_EXPR,
            FLOOR_DIV_EXPR, ROUND_DIV_EXPR, TRUNC_MOD_EXPR, CEIL_MOD_EXPR,
            FLOOR_MOD_EXPR, ROUND_MOD_EXPR, RDIV_EXPR, and EXACT_DIV_EXPR.

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

end of thread, other threads:[~2021-06-18  8:24 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-05 17:48 [Bug c++/100925] New: tree check fail in make_range_step, at fold-const.c:5061 dcb314 at hotmail dot com
2021-06-05 18:29 ` [Bug c++/100925] " dcb314 at hotmail dot com
2021-06-05 19:12 ` dcb314 at hotmail dot com
2021-06-05 19:36 ` dcb314 at hotmail dot com
2021-06-05 19:59 ` [Bug tree-optimization/100925] [12 Regression] tree check fail in make_range_step with -O1 in reassoc pinskia at gcc dot gnu.org
2021-06-05 20:06 ` pinskia at gcc dot gnu.org
2021-06-06  0:21 ` pinskia at gcc dot gnu.org
2021-06-09  1:36 ` pinskia at gcc dot gnu.org
2021-06-09 19:20 ` cvs-commit at gcc dot gnu.org
2021-06-09 19:20 ` pinskia at gcc dot gnu.org
2021-06-18  8:24 ` cvs-commit 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).