the latest gcc10.2.1 failed with SSA corruption on multiple c modules of our important application on O3. disabling -fsplit-loops cures the failure. I was able to reduce the huge routine to the following simple one to reproduce the failure: #include <setjmp.h> #include <stdlib.h> static void * my_malloc (size_t size); typedef struct glk { struct glk *nxt; } glk; typedef struct Lock { glk ByteLock; } Lock; static Lock *l, *lk; void bytelocks(glk *rethead, jmp_buf jb) { glk *cur, *cur_lk; if (( _setjmp (jb)) == 0) for (cur = &l->ByteLock; cur != ((glk *)0) ; cur = (cur)->nxt) for (cur_lk = &lk->ByteLock; cur_lk != ((glk *)0); cur_lk = cur_lk->nxt) { glk *retrng; if(!rethead) rethead = (glk *) my_malloc (sizeof(glk)); retrng = (glk *) my_malloc (sizeof(glk)); retrng->nxt = rethead; } return; } /home/qinzhao/Install/latest/bin/gcc -O3 t.c t.c:4:15: warning: ‘my_malloc’ used but never defined 4 | static void * my_malloc (size_t size); | ^~~~~~~~~ Unable to coalesce ssa_names 5 and 6 which are marked as MUST COALESCE. rethead_5(ab) and rethead_6(ab) during RTL pass: expand t.c: In function ‘bytelocks’: t.c:17:6: internal compiler error: SSA corruption 17 | void bytelocks(glk *rethead, jmp_buf jb) | ^~~~~~~~~ 0xbcca65 fail_abnormal_edge_coalesce ../../latest_gcc/gcc/tree-ssa-coalesce.c:1003 0xbcca65 coalesce_partitions ../../latest_gcc/gcc/tree-ssa-coalesce.c:1425 0xbcca65 coalesce_ssa_name(_var_map*) ../../latest_gcc/gcc/tree-ssa-coalesce.c:1755 0xb7d597 remove_ssa_form ../../latest_gcc/gcc/tree-outof-ssa.c:1065 0xb7d597 rewrite_out_of_ssa(ssaexpand*) ../../latest_gcc/gcc/tree-outof-ssa.c:1323 0x6fb5d5 execute ../../latest_gcc/gcc/cfgexpand.c:6352 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.
/home/qinzhao/Install/latest/bin/gcc -v Using built-in specs. COLLECT_GCC=/home/qinzhao/Install/latest/bin/gcc COLLECT_LTO_WRAPPER=/home/qinzhao/Install/latest/libexec/gcc/x86_64-pc-linux-gnu/10.2.1/lto-wrapper Target: x86_64-pc-linux-gnu Configured with: ../latest_gcc/configure --prefix=/home/qinzhao/Install/latest -enable-languages=c,c++,fortran,lto Thread model: posix Supported LTO compression algorithms: zlib gcc version 10.2.1 20201009 (GCC)
Confirmed. I will have a look. Seems to work on trunk, probably by accident.
Started one master with r10-4447-g095f78c62157124a and disappeared with r11-309-gfe8c8f1e5ed61f00.
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:5b2cc633794f6e1f882d46bdefe267401d33285e commit r11-3808-g5b2cc633794f6e1f882d46bdefe267401d33285e Author: Richard Biener <rguenther@suse.de> Date: Mon Oct 12 08:51:05 2020 +0200 tree-optimization/97357 - avoid abnormals in loop splitting conditions This avoids abnormals in another place. 2020-10-12 Richard Biener <rguenther@suse.de> PR tree-optimization/97357 * tree-ssa-loop-split.c (ssa_semi_invariant_p): Abnormal SSA names are not semi invariant. * gcc.dg/pr97357.c: New testcase.
The releases/gcc-10 branch has been updated by Richard Biener <rguenth@gcc.gnu.org>: https://gcc.gnu.org/g:e293967739f8ac5341ad4e2121f9d87b67499008 commit r10-8879-ge293967739f8ac5341ad4e2121f9d87b67499008 Author: Richard Biener <rguenther@suse.de> Date: Mon Oct 12 08:51:05 2020 +0200 tree-optimization/97357 - avoid abnormals in loop splitting conditions This avoids abnormals in another place. 2020-10-12 Richard Biener <rguenther@suse.de> PR tree-optimization/97357 * tree-ssa-loop-split.c (ssa_semi_invariant_p): Abnormal SSA names are not semi invariant. * gcc.dg/pr97357.c: New testcase.
Fixed.
The master branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>: https://gcc.gnu.org/g:f10f11eb63b0ed082674d9a589e67230aa49efb5 commit r11-3824-gf10f11eb63b0ed082674d9a589e67230aa49efb5 Author: Christophe Lyon <christophe.lyon@linaro.org> Date: Mon Oct 12 14:04:06 2020 +0000 tree-optimization/97357: Fix testcase Calling _setjmp causing a warning when targeting newlib. 2020-10-12 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ PR tree-optimization/97357 * gcc.dg/pr97357.c: Call setjmp instead of _setjmp.
The releases/gcc-10 branch has been updated by Christophe Lyon <clyon@gcc.gnu.org>: https://gcc.gnu.org/g:124b4630636974638dfab057bb96f91bb7ee40eb commit r10-8881-g124b4630636974638dfab057bb96f91bb7ee40eb Author: Christophe Lyon <christophe.lyon@linaro.org> Date: Mon Oct 12 14:04:06 2020 +0000 tree-optimization/97357: Fix testcase Calling _setjmp causing a warning when targeting newlib. 2020-10-12 Christophe Lyon <christophe.lyon@linaro.org> gcc/testsuite/ PR tree-optimization/97357 * gcc.dg/pr97357.c: Call setjmp instead of _setjmp. (cherry picked from commit f10f11eb63b0ed082674d9a589e67230aa49efb5)
with the patch, all the C modules in our application that failed with this bug passed without any issue.