https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92683
--- Comment #5 from Martin Sebor <msebor at gcc dot gnu.org> --- With pr92733 resolved I can verify that the test case from comment #0 is compiled correctly by the sparc-sun-solaris2.11 cross: $ cat pr92683.c && /build/sparc-sun-solaris2.11/gcc-svn/gcc/xgcc -B /build/sparc-sun-solaris2.11/gcc-svn/gcc -O1 -S -Wall -Wextra -fdump-tree-forwprop1=/dev/stdout pr92683.c int f (void) { return __builtin_strncmp ("123", "1234", 3); // correctly folded to zero } int g (void) { int n = 3; return __builtin_strncmp ("123", "1234", n); // incorrectly folded to -1 } ;; Function f (f, funcdef_no=0, decl_uid=1482, cgraph_uid=1, symbol_order=0) f () { <bb 2> : return 0; } ;; Function g (g, funcdef_no=1, decl_uid=1485, cgraph_uid=2, symbol_order=1) g () { int n; <bb 2> : return 0; } The gcc.dg/strcmpopt_8.c test also passes for me when compiled with the sparc-sun-solaris2.11 cross: $ nice make -C /build/sparc-sun-solaris2.11/gcc-svn/gcc check-c 'CFLAGS=-O0 -g3' 'CXXFLAGS=-O0 -g3' 'STAGE1_CFLAGS=-O0 -g3' 'STAGE1_CXXFLAGS=-O0 -g3' RUNTESTFLAGS="dg.exp=gcc.dg/strcmpopt_8.c" make: Entering directory '/ssd/build/sparc-sun-solaris2.11/gcc-svn/gcc' ... Test run by msebor on Fri Nov 29 11:59:25 2019 Target is sparc-sun-solaris2.11 Host is x86_64-pc-linux-gnu === gcc tests === Schedule of variations: unix Running target unix Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target. Using /usr/share/dejagnu/config/unix.exp as generic interface file for target. Using /src/gcc/svn/gcc/testsuite/config/default.exp as tool-and-target-specific interface file. WARNING: Assuming target board is the local machine (which is probably wrong). You may need to set your DEJAGNU environment variable. Running /src/gcc/svn/gcc/testsuite/gcc.dg/dg.exp ... === gcc Summary === # of expected passes 4 /ssd/build/sparc-sun-solaris2.11/gcc-svn/gcc/xgcc version 10.0.0 20191129 (experimental) (GCC) make[1]: Leaving directory '/ssd/build/sparc-sun-solaris2.11/gcc-svn/gcc' make: Leaving directory '/ssd/build/sparc-sun-solaris2.11/gcc-svn/gcc' The output looks as expected: $ /build/sparc-sun-solaris2.11/gcc-svn/gcc/xgcc -B /build/sparc-sun-solaris2.11/gcc-svn/gcc -O1 -S -Wall -Wextra -fdump-tree-forwprop1=/dev/stdout /src/gcc/svn/gcc/testsuite/gcc.dg/strcmpopt_8.c ;; Function test_literal (test_literal, funcdef_no=0, decl_uid=1485, cgraph_uid=1, symbol_order=0) test_literal () { int zero; size_t max; <bb 2> : return; } ;; Function test_cst_array (test_cst_array, funcdef_no=1, decl_uid=1492, cgraph_uid=2, symbol_order=3) test_cst_array () { int zero; size_t max; <bb 2> : return; }