public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735
@ 2020-04-03 11:14 dcb314 at hotmail dot com
  2020-04-03 11:38 ` [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a marxin at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2020-04-03 11:14 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94468
           Summary: ice in remove_useless_values, at cselib.c:735
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: dcb314 at hotmail dot com
  Target Milestone: ---

Created attachment 48181
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48181&action=edit
gzipped C++ source code

For the attached gzipped C++ code, recent gcc trunk does this:

/home/dcb/gcc/results.20200331/bin/g++
/home/dcb/gcc/results.20200402/bin/g++
during RTL pass: postreload
/home/dcb30/rpmbuild/BUILD/desktop-2.6.4/src/gui/creds/shibboleth/shibbolethwebview.cpp:
In constructor ‘OCC::ShibbolethWebView::ShibbolethWebView(OCC::AccountPtr,
QWidget*)’:
/home/dcb30/rpmbuild/BUILD/desktop-2.6.4/src/gui/creds/shibboleth/shibbolethwebview.cpp:108:1:
internal compiler error: in remove_useless_values, at cselib.c:735
  108 | }
      | ^
0xa40c7b remove_useless_values()
        ../../trunk.git/gcc/cselib.c:735
0xa437d4 cselib_process_insn(rtx_insn*)
        ../../trunk.git/gcc/cselib.c:3018
0xe5fd1c reload_cse_regs_1()
        ../../trunk.git/gcc/postreload.c:220
0xe5ea99 reload_cse_regs(rtx_insn*)
        ../../trunk.git/gcc/postreload.c:65

The bug first seems to occur sometime between 20200331 and 20200402.

Compiler flags are  -O2 -march=native -fPIC. Native is AMD FX-8350,
which has piledriver microarchitecture. 

I'll have my usual go at reducing the code.

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

* [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
@ 2020-04-03 11:38 ` marxin at gcc dot gnu.org
  2020-04-03 12:45 ` marxin at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 11:38 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Priority|P3                          |P1
   Target Milestone|---                         |10.0
      Known to work|                            |9.3.0
            Summary|ice in                      |[10 Regression] ICE in
                   |remove_useless_values, at   |remove_useless_values, at
                   |cselib.c:735                |cselib.c:735 since
                   |                            |r10-7515-g2c0fa3ecf70d199a
      Known to fail|                            |10.0
           Keywords|                            |needs-reduction
             Status|UNCONFIRMED                 |NEW
                 CC|                            |jakub at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
   Last reconfirmed|                            |2020-04-03

--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
Confirmed, started with r10-7515-g2c0fa3ecf70d199a.

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

* [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
  2020-04-03 11:38 ` [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a marxin at gcc dot gnu.org
@ 2020-04-03 12:45 ` marxin at gcc dot gnu.org
  2020-04-03 12:46 ` marxin at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 12:45 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|needs-reduction             |

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
I reduced a test-case:

$ cat pr94468.cc
bool a();
enum b {};
class c;
template <typename> struct d;
template <class e, typename g, typename... h> struct d<g (e::*)(h...)> {
  typedef e i;
};
class j {
public:
  j(void(int, j *, c *, void **, bool *)) {}
};
template <typename l> class m : public j {
  l ab;
  static void ac(int, j *, c *, void **, bool *);

public:
  m(l f) : j(ac), ab(f) {}
};
b ad;
class c {
public:
  template <typename n, typename o>
  void ae(typename d<n>::i *p, n af, typename d<o>::i *ag, o ah) {
    ai(p, &af, ag, &ah, new m<o>(ah), ad, &d<n>::i::aj);
  }
  void ai(c *, void *, c *, void *, j *, b, int *);
};
class r : public c {
public:
  static int aj;
  void t();
};
class al : public c {
public:
  static int aj;
  void am();
  void ao();
  void ap();
};
class aq {
public:
  aq(const int &, const int & = int());
};
class ar : public c {
public:
  ~ar();
};
class as : public ar {
  as();
  void at();
  void au();
  void av();
};
class u : public c {
public:
  void ax();
};
class ay {
public:
  int az();
};
class ba : public c {
public:
  static int aj;
  void bb();
};
class bc : public al {
public:
  bc() {
    if (a())
      am();
  }
};
as::as() {
  al *bd = new bc;
  ae(bd, &al::ao, this, &as::au);
  ae(bd, &al::ap, this, &as::av);
  r be;
  u bf;
  ae(&be, &r::t, &bf, &u::ax);
  c bg = *bd;
  ae(static_cast<ba *>(&bg), &ba::bb, this, &as::at);
  ay bh;
  aq am(bh.az());
}

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

* [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
  2020-04-03 11:38 ` [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a marxin at gcc dot gnu.org
  2020-04-03 12:45 ` marxin at gcc dot gnu.org
@ 2020-04-03 12:46 ` marxin at gcc dot gnu.org
  2020-04-03 15:21 ` [Bug rtl-optimization/94468] " jakub at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-04-03 12:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Martin Liška <marxin at gcc dot gnu.org> ---
Minimal command line options:
$ g++ pr94468.cc -O2 -c -fPIC

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

* [Bug rtl-optimization/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2020-04-03 12:46 ` marxin at gcc dot gnu.org
@ 2020-04-03 15:21 ` jakub at gcc dot gnu.org
  2020-04-03 16:06 ` dcb314 at hotmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-03 15:21 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Created attachment 48189
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=48189&action=edit
gcc10-pr94468.patch

Untested fix.

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

* [Bug rtl-optimization/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2020-04-03 15:21 ` [Bug rtl-optimization/94468] " jakub at gcc dot gnu.org
@ 2020-04-03 16:06 ` dcb314 at hotmail dot com
  2020-04-04  8:33 ` cvs-commit at gcc dot gnu.org
  2020-04-04  8:34 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2020-04-03 16:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from David Binderman <dcb314 at hotmail dot com> ---
I had a quick look at the untested fix and there seemed to be
about six copies of pretty much the same expression.

Would it be worthwhile to invent a new macro or small function
and call it from six different places ?

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

* [Bug rtl-optimization/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2020-04-03 16:06 ` dcb314 at hotmail dot com
@ 2020-04-04  8:33 ` cvs-commit at gcc dot gnu.org
  2020-04-04  8:34 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-04-04  8:33 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <jakub@gcc.gnu.org>:

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

commit r10-7551-gbab8d9625f4cdeaf9bb45e28ab62abe47c3827f9
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Sat Apr 4 10:32:41 2020 +0200

    cselib: Don't consider SP_DERIVED_VALUE_P values as useless [PR94468]

    The following testcase ICEs, because at one point we see the
    SP_DERIVED_VALUE_P VALUE as useless (not PRESERVED_VALUE_P and no locs)
    and so expect it to be discarded as useless.  But, later on we
    are adding some new VALUE that is equivalent to it, and when adding
    the equivalency that that new VALUE is equal to this SP_DERIVED_VALUE_P,
    new_elt_loc_list has code for VALUE canonicalization and reverses addition
    if uid is smaller, and at that point a new loc is added to the
    SP_DERIVED_VALUE_P VALUE and it isn't discarded as useless anymore.
    Now, I think we don't want to discard the SP_DERIVED_VALUE_P values
    even if they have no locs, because they still have the special behaviour
    that they then force other new VALUEs to be canonicalized against them,
    which is what this patch implements.  I've not set PRESERVED_VALUE_P
    on the SP_DERIVED_VALUE_P at the creation time, because whether a VALUE
    is preserved or not is something that affects var-tracking decisions quite
a
    lot and we shouldn't set it blindly on other VALUEs.

    Or, to avoid the repetitive code, should I introduce
    static bool
    cselib_useless_value_p (cselib_val *v)
    {
      return (v->locs == 0
              && !PRESERVED_VALUE_P (v->val_rtx)
              && !SP_DERIVED_VALUE_P (v->val_rtx)));
    }
    predicate and use it in those 6 spots?

    2020-04-04  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/94468
            * cselib.c (references_value_p): Formatting fix.
            (cselib_useless_value_p): New function.
            (discard_useless_locs, discard_useless_values,
            cselib_invalidate_regno_val, cselib_invalidate_mem,
            cselib_record_set): Use it instead of
            v->locs == 0 && !PRESERVED_VALUE_P (v->val_rtx).

            * g++.dg/opt/pr94468.C: New test.

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

* [Bug rtl-optimization/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a
  2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2020-04-04  8:33 ` cvs-commit at gcc dot gnu.org
@ 2020-04-04  8:34 ` jakub at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2020-04-04  8:34 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Fixed.

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

end of thread, other threads:[~2020-04-04  8:34 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-03 11:14 [Bug c++/94468] New: ice in remove_useless_values, at cselib.c:735 dcb314 at hotmail dot com
2020-04-03 11:38 ` [Bug c++/94468] [10 Regression] ICE in remove_useless_values, at cselib.c:735 since r10-7515-g2c0fa3ecf70d199a marxin at gcc dot gnu.org
2020-04-03 12:45 ` marxin at gcc dot gnu.org
2020-04-03 12:46 ` marxin at gcc dot gnu.org
2020-04-03 15:21 ` [Bug rtl-optimization/94468] " jakub at gcc dot gnu.org
2020-04-03 16:06 ` dcb314 at hotmail dot com
2020-04-04  8:33 ` cvs-commit at gcc dot gnu.org
2020-04-04  8:34 ` jakub 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).