public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/102988] New: ice during GIMPLE pass: hardcbr
@ 2021-10-28 16:05 dcb314 at hotmail dot com
  2021-10-28 16:48 ` [Bug c++/102988] " dcb314 at hotmail dot com
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2021-10-28 16:05 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102988
           Summary: ice during GIMPLE pass: hardcbr
           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: ---

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

The attached C++ code, with compiler flags -c -w -std=c++14 -w -O1
-fharden-conditional-branches, does this:

/home/dcb35/rpmbuild/BUILD/ucommon-7.0.0/commoncpp/persist.cpp:254:19: error:
RESULT_DECL should be read only when DECL_BY_REFERENCE is set
  254 | const std::string PersistEngine::readClass() throw(PersistException)
      |                   ^~~~~~~~~~~~~
while verifying SSA_NAME className_96 in statement
__asm__("" : "=g" className_96 : "0" className_14(D));
during GIMPLE pass: hardcbr
/home/dcb35/rpmbuild/BUILD/ucommon-7.0.0/commoncpp/persist.cpp:254:19: internal
compiler error: verify_ssa failed

I will have my usual go at reducing the code.

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

* [Bug c++/102988] ice during GIMPLE pass: hardcbr
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
@ 2021-10-28 16:48 ` dcb314 at hotmail dot com
  2021-10-31  0:35 ` [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value pinskia at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: dcb314 at hotmail dot com @ 2021-10-28 16:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from David Binderman <dcb314 at hotmail dot com> ---
Reduced C++ code is:

inline namespace __cxx11 {}
template <typename _Tp> _Tp *__addressof(_Tp);
namespace __cxx11 {
class basic_string {
  void _M_set_length();

public:
  ~basic_string();
  void operator=(basic_string __str) {
    if (this != __addressof(__str))
      _M_set_length();
  }
};
} // namespace __cxx11
class vector {
public:
  basic_string operator[](long);
};
class PersistException {};
class PersistEngine {
  const basic_string readClass() throw(PersistException);
  vector myClassVector;
};
const basic_string PersistEngine::readClass() throw(PersistException) {
  basic_string className;
  className = myClassVector[0];
  return className;
}

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
  2021-10-28 16:48 ` [Bug c++/102988] " dcb314 at hotmail dot com
@ 2021-10-31  0:35 ` pinskia at gcc dot gnu.org
  2021-11-03 17:19 ` pinskia at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-10-31  0:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-10-31
     Ever confirmed|0                           |1

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed, reduced testcase the most I could do:
void ll();
struct k {
  ~k();
};
k ice(k *a)
{
  k v;
  if (&v!= a)
    ll();
  return v;
}

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
  2021-10-28 16:48 ` [Bug c++/102988] " dcb314 at hotmail dot com
  2021-10-31  0:35 ` [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value pinskia at gcc dot gnu.org
@ 2021-11-03 17:19 ` pinskia at gcc dot gnu.org
  2021-11-19  9:43 ` aoliva at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-11-03 17:19 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |zsojka at seznam dot cz

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 103064 has been marked as a duplicate of this bug. ***

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
                   ` (2 preceding siblings ...)
  2021-11-03 17:19 ` pinskia at gcc dot gnu.org
@ 2021-11-19  9:43 ` aoliva at gcc dot gnu.org
  2021-11-19 11:16 ` aoliva at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-11-19  9:43 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED

--- Comment #4 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Mine

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
                   ` (3 preceding siblings ...)
  2021-11-19  9:43 ` aoliva at gcc dot gnu.org
@ 2021-11-19 11:16 ` aoliva at gcc dot gnu.org
  2021-11-20  5:54 ` cvs-commit at gcc dot gnu.org
  2021-11-20  5:57 ` aoliva at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-11-19 11:16 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Created attachment 51837
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51837&action=edit
candidate patch under test

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
                   ` (4 preceding siblings ...)
  2021-11-19 11:16 ` aoliva at gcc dot gnu.org
@ 2021-11-20  5:54 ` cvs-commit at gcc dot gnu.org
  2021-11-20  5:57 ` aoliva at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-11-20  5:54 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:38e4a361e79a459947540920db645f3d7fa7221a

commit r12-5429-g38e4a361e79a459947540920db645f3d7fa7221a
Author: Alexandre Oliva <oliva@adacore.com>
Date:   Sat Nov 20 02:51:27 2021 -0300

    harden conds: detach without decls

    When we create copies of SSA_NAMEs to hold "detached" copies of the
    values for the hardening tests, we end up with assignments to
    SSA_NAMEs that refer to the same decls.  That would be generally
    desirable, since it enables the variable to be recognized in dumps,
    and makes coalescing more likely if the original variable dies at that
    point.  When the decl is a DECL_BY_REFERENCE, the SSA_NAME holds the
    address of a parm or result, and it's read-only, so we shouldn't
    create assignments to it.  Gimple checkers flag at least the case of
    results.

    This patch arranges for us to avoid referencing the same decls, which
    cures the problem, but retaining the visible association between the
    SSA_NAMEs, by using the same identifier for the copy.


    for  gcc/ChangeLog

            PR tree-optimization/102988
            * gimple-harden-conditionals.cc (detach_value): Copy SSA_NAME
            without decl sharing.

    for  gcc/testsuite/ChangeLog

            PR tree-optimization/102988
            * g++.dg/pr102988.C: New.

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

* [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value
  2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
                   ` (5 preceding siblings ...)
  2021-11-20  5:54 ` cvs-commit at gcc dot gnu.org
@ 2021-11-20  5:57 ` aoliva at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: aoliva at gcc dot gnu.org @ 2021-11-20  5:57 UTC (permalink / raw)
  To: gcc-bugs

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

Alexandre Oliva <aoliva at gcc dot gnu.org> changed:

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

--- Comment #7 from Alexandre Oliva <aoliva at gcc dot gnu.org> ---
Fixed

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

end of thread, other threads:[~2021-11-20  5:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-28 16:05 [Bug c++/102988] New: ice during GIMPLE pass: hardcbr dcb314 at hotmail dot com
2021-10-28 16:48 ` [Bug c++/102988] " dcb314 at hotmail dot com
2021-10-31  0:35 ` [Bug tree-optimization/102988] ICE with -fharden-conditional-branches and C++ and pass by reference return value pinskia at gcc dot gnu.org
2021-11-03 17:19 ` pinskia at gcc dot gnu.org
2021-11-19  9:43 ` aoliva at gcc dot gnu.org
2021-11-19 11:16 ` aoliva at gcc dot gnu.org
2021-11-20  5:54 ` cvs-commit at gcc dot gnu.org
2021-11-20  5:57 ` aoliva 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).