public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/97347] New: [11 Regression] error: statement marked for throw in middle of block in botan
@ 2020-10-09  8:01 marxin at gcc dot gnu.org
  2020-10-09  8:01 ` [Bug tree-optimization/97347] " marxin at gcc dot gnu.org
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: marxin at gcc dot gnu.org @ 2020-10-09  8:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97347
           Summary: [11 Regression] error: statement marked for throw in
                    middle of block in botan
           Product: gcc
           Version: 10.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: marxin at gcc dot gnu.org
                CC: rguenth at gcc dot gnu.org
  Target Milestone: ---

The following fails:

$ cat botan.ii
inline namespace __cxx11 {}
typedef int size_t;
class MessageAuthenticationCode;
class __uniq_ptr_impl {
  struct _Ptr {
    using type = MessageAuthenticationCode *;
  };
public:
  using pointer = _Ptr::type;
};
class unique_ptr {
public:
  using pointer = __uniq_ptr_impl::pointer;
  unique_ptr(pointer);
};
namespace __cxx11 {
class basic_string {
public:
  basic_string(char *);
  ~basic_string();
};
} // namespace __cxx11
class MessageAuthenticationCode {};
class SCAN_Name {
public:
  SCAN_Name(basic_string);
  size_t arg_as_integer();
};
class SipHash : public MessageAuthenticationCode {
public:
  SipHash(size_t c, size_t d) : m_C(c), m_D(d) {}
  size_t m_C, m_D;
};
void create(basic_string algo_spec) {
  basic_string provider = "";
  SCAN_Name req(algo_spec);
  unique_ptr(new SipHash(req.arg_as_integer(), req.arg_as_integer()));
}

$ g++ -O3 botan.ii -c -fdump-tree-all
botan.ii: In function ‘void create(__cxx11::basic_string)’:
botan.ii:35:27: warning: ISO C++ forbids converting a string constant to
‘char*’ [-Wwrite-strings]
   35 |   basic_string provider = "";
      |                           ^~
botan.ii:34:6: error: statement marked for throw in middle of block
   34 | void create(basic_string algo_spec) {
      |      ^~~~~~
# .MEM_11 = VDEF <.MEM_9>
_12 = operator new (8);
during GIMPLE pass: slp
dump file: botan.ii.175t.slp2
botan.ii:34:6: internal compiler error: verify_gimple failed
0x1057d5a verify_gimple_in_cfg(function*, bool)
        /home/marxin/Programming/gcc/gcc/tree-cfg.c:5482
0xf3d36f execute_function_todo
        /home/marxin/Programming/gcc/gcc/passes.c:1992
0xf3e1bc do_per_function
        /home/marxin/Programming/gcc/gcc/passes.c:1640
0xf3e1bc execute_todo
        /home/marxin/Programming/gcc/gcc/passes.c:2046
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.

The insertion code mentions statements that can throw but does not handle it.

Patch candidate:

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 7e22506b49f..84bc8970f33 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -4148,13 +4148,22 @@ vect_create_constant_vectors (vec_info *vinfo, slp_tree
op_node)
                        gsi = gsi_for_stmt (insert_after->stmt);
                      else
                        {
-                         /* When we want to insert after a def where the
-                            defining stmt throws then insert on the fallthru
-                            edge.  */
                          edge e = find_fallthru_edge
                                     (gimple_bb (insert_after->stmt)->succs);
                          gcc_assert (single_pred_p (e->dest));
                          gsi = gsi_after_labels (e->dest);
+
+                         /* When we want to insert after a def where the
+                            defining stmt throws then insert on the fallthru
+                            edge.  */
+                         while (!gsi_end_p (gsi)
+                                && stmt_can_throw_internal (cfun, gsi_stmt
(gsi)))
+                           {
+                             e = find_fallthru_edge (e->dest->succs);
+                             gcc_assert (single_pred_p (e->dest));
+                             gsi = gsi_after_labels (e->dest);
+                           }
+
                        }
                      gsi_insert_seq_after (&gsi, ctor_seq,
                                            GSI_CONTINUE_LINKING);

What do you think Richi about the patch?

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

end of thread, other threads:[~2020-10-12 11:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-09  8:01 [Bug tree-optimization/97347] New: [11 Regression] error: statement marked for throw in middle of block in botan marxin at gcc dot gnu.org
2020-10-09  8:01 ` [Bug tree-optimization/97347] " marxin at gcc dot gnu.org
2020-10-09  8:08 ` marxin at gcc dot gnu.org
2020-10-09  8:13 ` rguenth at gcc dot gnu.org
2020-10-09  8:57 ` marxin at gcc dot gnu.org
2020-10-09  9:16 ` dcb314 at hotmail dot com
2020-10-09  9:28 ` cvs-commit at gcc dot gnu.org
2020-10-09  9:28 ` rguenth at gcc dot gnu.org
2020-10-12 11:13 ` 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).