https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86222
Bug ID: 86222 Summary: ICE in final_scan_insn_1 calling strncmp() with a bound of PTRDIFF_MAX + 1 Product: gcc Version: 8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: rtl-optimization Assignee: unassigned at gcc dot gnu.org Reporter: msebor at gcc dot gnu.org Target Milestone: --- The following test case was reduced from a powerpc-ibm-aix7.2 ICE in the gcc.dg/attr-nonstring-3.c test case added in r261704: $ cat c.i && /ssd/build/powerpc-ibm-aix7.2/gcc-8-branch/gcc/xgcc -B /ssd/build/powerpc-ibm-aix7.2/gcc-8-branch/gcc -S -O2 -Wall -Wextra -fdump-tree-optimized=/dev/stdout c.i typedef typeof (sizeof 0) size_t; extern int strncmp (const char*, const char*, size_t); int f (void) { size_t n = 0x7fffffffL; // PTRDIFF_MAX extern char a[]; extern char b[16]; return strncmp (a, b, n + 1); } ;; Function f (f, funcdef_no=0, decl_uid=2619, cgraph_uid=0, symbol_order=0) f () { int _2; <bb 2> [local count: 1073741825]: _2 = strncmp (&a, &b, 2147483648); [tail call] return _2; } c.i: In function âfâ: c.i:12:1: error: could not split insn } ^ (insn 116 118 194 (set (reg:SI 5 5) (const_int -2147483680 [0xffffffff7fffffe0])) "c.i":11 485 {*movsi_internal1} (nil)) during RTL pass: final c.i:12:1: internal compiler error: in final_scan_insn_1, at final.c:3142 0xfed675 _fatal_insn(char const*, rtx_def const*, char const*, int, char const*) /src/gcc/8-branch/gcc/rtl-error.c:108 0xb5c13c final_scan_insn_1 /src/gcc/8-branch/gcc/final.c:3142 0xb5c7a9 final_scan_insn(rtx_insn*, _IO_FILE*, int, int, int*) /src/gcc/8-branch/gcc/final.c:3221 0xb58a26 final_1 /src/gcc/8-branch/gcc/final.c:2091 0xb616ce rest_of_handle_final /src/gcc/8-branch/gcc/final.c:4674 0xb61b56 execute /src/gcc/8-branch/gcc/final.c:4748 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.