https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101586
Bug ID: 101586 Summary: ICE:in clear_padding_type, at gimple-fold.c:4783 with call to __builtin_clear_padding for C++ Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: qinzhao at gcc dot gnu.org Target Milestone: --- gcc12 failed with the following small testing case: namespace std { inline namespace __cxx11 {} typedef char string; namespace __cxx11 { template <typename _CharT, typename = _CharT, typename = _CharT> class basic_stringstream; } typedef basic_stringstream<char> stringstream; template <typename _CharT, typename> class basic_ios { typedef _CharT char_type; char_type _M_fill; }; template <typename _CharT, typename _Traits> class basic_istream : virtual basic_ios<_CharT, _Traits> {}; template <typename _CharT, typename _Traits> class basic_iostream : basic_istream<_CharT, _Traits> {}; namespace __cxx11 { template <typename _CharT, typename _Traits, typename> class basic_stringstream : basic_iostream<_CharT, _Traits> {}; } // namespace __cxx11 } // namespace std class cMessage { std::string info() const; }; std::string cMessage::info() const { std::stringstream out; __builtin_clear_padding (&out); } compiled with g++ -std=c++03 -m64, and got: tf.c: In member function ‘std::string cMessage::info() const’: tf.c:29:1: warning: no return statement in function returning non-void [-Wreturn-type] 29 | } | ^ during GIMPLE pass: lower tf.c:25:13: internal compiler error: in clear_padding_type, at gimple-fold.c:4783 25 | std::string cMessage::info() const | ^~~~~~~~ 0x10e2037 clear_padding_type ../../latest-gcc-2/gcc/gimple-fold.c:4783 0x10e1fae clear_padding_type ../../latest-gcc-2/gcc/gimple-fold.c:4779 0x10e1fae clear_padding_type ../../latest-gcc-2/gcc/gimple-fold.c:4779 0x10e3216 gimple_fold_builtin_clear_padding ../../latest-gcc-2/gcc/gimple-fold.c:4981 0x10e39f5 gimple_fold_builtin ../../latest-gcc-2/gcc/gimple-fold.c:5155 0x10e5c95 gimple_fold_call ../../latest-gcc-2/gcc/gimple-fold.c:5563 0x10e916c fold_stmt_1 ../../latest-gcc-2/gcc/gimple-fold.c:6265 0x10e94eb fold_stmt(gimple_stmt_iterator*) ../../latest-gcc-2/gcc/gimple-fold.c:6361 0x253052f lower_stmt ../../latest-gcc-2/gcc/gimple-low.c:388 0x2530093 lower_sequence ../../latest-gcc-2/gcc/gimple-low.c:217 0x253025e lower_stmt ../../latest-gcc-2/gcc/gimple-low.c:286 0x2530093 lower_sequence ../../latest-gcc-2/gcc/gimple-low.c:217 0x25309b0 lower_gimple_bind ../../latest-gcc-2/gcc/gimple-low.c:473 0x252fc89 lower_function_body ../../latest-gcc-2/gcc/gimple-low.c:110 0x252ffdc execute ../../latest-gcc-2/gcc/gimple-low.c:195 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. ubuntu@qinzhao-ubuntu-x86:~/Bugs/uninit/bug_1$ This testing case is Reduced from CPU2017 benchmark and has been modified a little bit (by adding the call to __builtin_clear_padding).