https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82698
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- I believe this is a dupe of bug 80641. The invalid memset is introduced by the loop distribution pass. I would expect it to be possible to detect these cases and either avoid inserting such invalid calls or replace them with __builtin_unreachable. That should not only eliminate these false positives but also improve the quality of the generated code. foo (struct vector & bar) { int * __first; long unsigned int _1; int * _5; int * _6; long int _7; long int _8; long int _9; long int _10; long unsigned int _11; long unsigned int _20; int * _21; long int __pos.12_22; int * _23; long int _24; long int _27; <bb 2> [100.00%] [count: INV]: _5 = MEM[(int * *)bar_3(D)]; _6 = MEM[(int * *)bar_3(D) + 8B]; _7 = (long int) _6; _8 = (long int) _5; _9 = _7 - _8; _10 = _9 /[ex] 4; _11 = (long unsigned int) _10; _1 = _11 + 18446744073709551615; if (_1 > _11) goto <bb 3>; [33.00%] else goto <bb 6>; [67.00%] <bb 3> [16.50%] [count: INV]: _23 = bar_3(D)->D.15765._M_impl._M_end_of_storage; _24 = (long int) _23; _27 = _24 - _7; if (_27 == -4) goto <bb 4>; [67.00%] else goto <bb 5>; [33.00%] <bb 4> [11.06%] [count: INV]: __builtin_memset (_6, 0, 18446744073709551612); __first_28 = _6 + 18446744073709551612; bar_3(D)->D.15765._M_impl._M_finish = __first_28; goto <bb 8>; [100.00%] <bb 5> [5.45%] [count: INV]: std::__throw_length_error ("vector::_M_default_append"); <bb 6> [33.50%] [count: INV]: _20 = _1 * 4; _21 = _5 + _20; __pos.12_22 = (long int) _21; if (_7 != __pos.12_22) goto <bb 7>; [66.00%] else goto <bb 8>; [34.00%] <bb 7> [22.11%] [count: INV]: MEM[(int * *)bar_3(D) + 8B] = _21; <bb 8> [100.00%] [count: INV]: return; } *** This bug has been marked as a duplicate of bug 80641 ***