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

            Bug ID: 105437
           Summary: ICE on GIMPLE pass slp when vectorizer is enabled
           Product: gcc
           Version: 11.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giuliano.belinassi at gmail dot com
  Target Milestone: ---

Given the following C++ input:
```
struct ControlClass
{
    virtual ~ControlClass();

    int Width;
    int Height;
    unsigned IsToRepaint : 1;
};

struct SelectClass : ControlClass
{
    SelectClass(void);
};

int Non_Folded_Value();

SelectClass::SelectClass(void)
{
    int factor = Non_Folded_Value();
    Width = 32 << factor;
    Height = 24 << factor;
}
```

saved as bug.cpp, and compiling with:

> g++-11 -O2 -ftree-vectorize -S bug.cpp

results in the following ICE:
```
during GIMPLE pass: ehcleanup
bug.cpp: In constructor ‘SelectClass::SelectClass()’:
bug.cpp:17:1: internal compiler error: in mark_reachable_handlers, at
tree->eh.c:4036
   17 | SelectClass::SelectClass(void)
      | ^~~~~~~~~~~
0x7f03bd2cd2bc __libc_start_main
        ???:0
```

This bug is still present on trunk. It happens even without -ftree-vectorize,
but the output is:
```
bug.cpp: In constructor ‘SelectClass::SelectClass()’:
bug.cpp:17:1: error: statement marked for throw in middle of block
   17 | SelectClass::SelectClass(void)
      | ^~~~~~~~~~~
# .MEM_8 = VDEF <.MEM_7>
_9 = Non_Folded_Value ();
during GIMPLE pass: slp
bug.cpp:17:1: internal compiler error: verify_gimple failed
0x112f364 verify_gimple_in_cfg(function*, bool)
        ../../gcc/gcc/tree-cfg.cc:5561
0xfd5eae execute_function_todo
        ../../gcc/gcc/passes.cc:2085
0xfd6932 execute_todo
        ../../gcc/gcc/passes.cc:2139

```

I tracked this issue back to commit 9e5508c2d006f2d4f8670e6c3fed770ac1c85e64:
"refactor SLP constant insertion and provde entry insert helper", but simple
`git revert` doesn't work as one of the files seems to have been deleted/moved.

GCC-10 and older are unaffected. (tested until gcc 7.5.0)

Reply via email to