https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106157
Bug ID: 106157 Summary: ICE verify_ssa failed since r13-1268-g8c99e307b20c502e Product: gcc Version: 13.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: aldyh at redhat dot com, amacleod at redhat dot com Target Milestone: --- The following crashes: $ cat 1.ii namespace ffmpegthumbnailer { struct VideoFrame { unsigned lineSize; void *xxx; }; } // namespace ffmpegthumbnailer class QString; class QImage; namespace ffmpegthumbnailer { struct VideoThumbnailer { void generateThumbnail(const QString &, QImage &); int m_ThumbnailSize; bool m_MaintainAspectRatio; }; struct MovieDecoder { void getScaledVideoFrame(int, bool, VideoFrame &); }; void VideoThumbnailer::generateThumbnail(const QString &, QImage &) { MovieDecoder movieDecoder; VideoFrame videoFrame; movieDecoder.getScaledVideoFrame(m_ThumbnailSize, m_MaintainAspectRatio, videoFrame); } } // namespace ffmpegthumbnailer class QString; class QImage; namespace ffmpegthumbnailer { } // namespace ffmpegthumbnailer struct FFMpegThumbnailer { bool create(const QString &, QImage &); ffmpegthumbnailer::VideoThumbnailer m_Thumbnailer; }; __attribute__((visibility("default"))) bool FFMpegThumbnailer::create(const QString &path, QImage &img) { m_Thumbnailer.generateThumbnail(path, img); } $ cat 2.ii void __throw_length_error(char); struct __is_integer { enum { __value = 1 }; }; struct __is_integer_nonstrict : __is_integer { enum { __width = __value ? sizeof(long) * 8 : 0 }; }; struct __numeric_traits_integer { static const int __digits = __is_integer_nonstrict::__width - 1; static const long __max = 1 ? (((long)1 << __digits - 1) - 1 << 1) + 1 : 0; }; template <typename _FIte, typename _Tp> void __fill_a(_FIte __first, _FIte __last, _Tp &__value) { if (long __len = __last - __first) __builtin_memset(__first, __value, __len); } template <typename _OI, typename _Size, typename _Tp> void fill_n(_OI __first, _Size __n, _Tp __value) { __fill_a(__first, __first + __n, __value); } template <typename> struct allocator; template <typename> struct allocator_traits; template <typename _Tp> struct allocator_traits<allocator<_Tp>> { using pointer = _Tp *; }; struct __alloc_traits : allocator_traits<allocator<char>> {}; template <typename _ForwardIterator, typename _Size, typename _Tp> void __uninitialized_default_n_a(_ForwardIterator __first, _Size __n, _Tp) { typename __val = *++__first; fill_n(__first, __n - 1, __val); } struct _Vector_base { struct { __alloc_traits::pointer _M_start; __alloc_traits::pointer _M_finish; } _M_impl; __alloc_traits::pointer _M_allocate(long); }; template <typename> struct vector : _Vector_base { void resize(unsigned long __new_size) { long __trans_tmp_5, __trans_tmp_4(_M_impl._M_finish - _M_impl._M_start); if (__new_size > __trans_tmp_4) { __trans_tmp_5 = _M_impl._M_finish - _M_impl._M_start; _M_default_append(__new_size - __trans_tmp_5); } } void clear() { __alloc_traits::pointer __pos = _M_impl._M_start; if (_M_impl._M_finish - _M_impl._M_start) _M_impl._M_finish = __pos; } void _M_default_append(unsigned long); }; template <typename _Tp> void vector<_Tp>::_M_default_append(unsigned long __n) { long __trans_tmp_12, __trans_tmp_9(_M_impl._M_finish - _M_impl._M_start), __navail; unsigned long __diffmax = __numeric_traits_integer::__max; if (__trans_tmp_9 > __diffmax - __trans_tmp_9) ; if (__navail) { long __trans_tmp_8(_M_impl._M_finish - _M_impl._M_start); if (__diffmax - __trans_tmp_8 < __n) __throw_length_error(0); __alloc_traits::pointer __new_start(_M_allocate(__trans_tmp_12)); char __trans_tmp_2; __uninitialized_default_n_a(__new_start, __n, __trans_tmp_2); } } namespace ffmpegthumbnailer { struct VideoFrame { unsigned lineSize; vector<char> frameData; }; struct MovieDecoder { void getScaledVideoFrame(int, bool, VideoFrame &); }; void MovieDecoder::getScaledVideoFrame(int, bool, VideoFrame &videoFrame) { videoFrame.frameData.clear(); videoFrame.frameData.resize(videoFrame.lineSize); } } // namespace ffmpegthumbnailer $ g++ -flto=auto -O2 -shared 1.ii 2.ii -fPIC -fvisibility=hidden -w 1.ii: In member function ‘create’: 1.ii:39:1: error: definition in block 5 does not dominate use in block 6 39 | FFMpegThumbnailer::create(const QString &path, QImage &img) { | ^ for SSA_NAME: _31 in statement: _12 = _31; during GIMPLE pass: dom 1.ii:39:1: internal compiler error: verify_ssa failed 0x106cfdd verify_ssa(bool, bool) /home/marxin/Programming/gcc/gcc/tree-ssa.cc:1211 0xd29c58 execute_function_todo /home/marxin/Programming/gcc/gcc/passes.cc:2098 0xd2a0ba execute_todo /home/marxin/Programming/gcc/gcc/passes.cc:2145 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. make: *** [/tmp/ccXPfUiR.mk:2: /tmp/ccMES7RX.ltrans0.ltrans.o] Error 1 lto-wrapper: fatal error: make returned 2 exit status compilation terminated. mold: lto-wrapper failed