https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90837
Bug ID: 90837 Summary: Generate infinite loop when using -ftree-vrp Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: zhongyunde at huawei dot com Target Milestone: --- Created attachment 46481 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46481&action=edit a simplified test case compile loop.c with follow command on x86 target , it will Generate infinite loop, which is not expect. /home/gcc-serials/GCC/gcc-810/binary/bin/gcc -S -O2 -dpA loop.c -fdump-tree-vrp-details test case attached. if (uwtotalUserNum > 5) { for (uwUserCountCell0 = 0; uwUserCountCell0 < (uwtotalUserNum - 1); uwUserCountCell0++) { for (uwUserCountCell1 = 0; uwUserCountCell1 < (uwtotalUserNum - (uwUserCountCell0 + 1)); uwUserCountCell1++) { if (pstruCodeDetectBuf->auwMulRRUPeakUsrInfo[0][uwUserCountCell1].hfPeakValue < pstruCodeDetectBuf->auwMulRRUPeakUsrInfo[0][uwUserCountCell1 + 1].hfPeakValue) { pstruDetectUserInfoCell0[uwUserCountCell1].uwRachRelativeValue = pstruDetectUserInfoCell0[uwUserCountCell1 + 1].uwRachRelativeValue; } } } in vrp1 dump , there is similar code: <bb 10> : # PHI <bb 11> : # PHI ... if (_10 < _12) goto <bb 12> else goto <bb 10> <bb 12> ... goto <bb 10>