https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103762
Bug ID: 103762 Summary: [12 Regression] glibc master branch is miscompiled by r12-897 Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: hjl.tools at gmail dot com CC: luoxhu at cn dot ibm.com Target Milestone: --- Target: x86-64 On x86-64, r12-897 commit de56f95afaaa22c67cbeec780921d63e8b34514e Author: Xionghu Luo <luo...@linux.ibm.com> Date: Tue May 18 21:34:18 2021 -0500 Run pass_sink_code once more before store_merging Gimple sink code pass runs quite early, there may be some new oppertunities exposed by later gimple optmization passes, this patch runs the sink code pass once more before store_merging. For detailed discussion, please refer to: https://gcc.gnu.org/pipermail/gcc-patches/2020-December/562352.html Tested the SPEC2017 performance on P8LE, 544.nab_r is improved by 2.43%, but no big changes to other cases, GEOMEAN is improved quite small with 0.25%. gcc/ChangeLog: 2021-05-18 Xionghu Luo <luo...@linux.ibm.com> * passes.def: Add sink_code pass before store_merging. * tree-ssa-sink.c (pass_sink_code:clone): New. gcc/testsuite/ChangeLog: 2021-05-18 Xionghu Luo <luo...@linux.ibm.com> * gcc.dg/tree-ssa/ssa-sink-1.c: Adjust. * gcc.dg/tree-ssa/ssa-sink-2.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-3.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-4.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-5.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-6.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-7.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-8.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-9.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-10.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-13.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-14.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-16.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-17.c: Ditto. * gcc.dg/tree-ssa/ssa-sink-18.c: New. miscompiled glibc master branch: FAIL: elf/tst-env-setuid [hjl@gnu-skx-1 build-x86_64-linux]$ env GCONV_PATH=/export/build/gnu/tools-build/glibc-cet/build-x86_64-linux/iconvdata LOCPATH=/export/build/gnu/tools-build/glibc-cet/build-x86_64-linux/localedata LC_ALL=C MALLOC_CHECK_=2 MALLOC_MMAP_THRESHOLD_=4096 LD_HWCAP_MASK=0x1 /export/build/gnu/tools-build/glibc-test/build-x86_64-linux/elf/tst-env-setuid Segmentation fault (core dumped) [hjl@gnu-skx-1 build-x86_64-linux]$ (gdb) set env MALLOC_CHECK_=2 (gdb) r --direct Starting program: /export/build/gnu/tools-build/glibc-test/build-x86_64-linux/elf/tst-env-setuid --direct Program received signal SIGSEGV, Segmentation fault. 0x00007ffff7f67053 in do_tunable_update_val (cur=cur@entry=0xffffefefe7f0, valp=valp@entry=0x7fffffffdd38, minp=minp@entry=0x0, maxp=maxp@entry=0x0) at dl-tunables.c:102 102 if (cur->type.type_code == TUNABLE_TYPE_STRING) (gdb) bt #0 0x00007ffff7f67053 in do_tunable_update_val (cur=cur@entry=0xffffefefe7f0, valp=valp@entry=0x7fffffffdd38, minp=minp@entry=0x0, maxp=maxp@entry=0x0) at dl-tunables.c:102 #1 0x00007ffff7f6733c in tunable_initialize (strval=0x7fffffffefa7 "2", cur=<optimized out>) at dl-tunables.c:151 #2 __tunables_init (envp=0x7fffffffe058) at dl-tunables.c:349 #3 0x00007ffff7f15f67 in __libc_start_main_impl (main=0x7ffff7f128f0 <main>, argc=2, argv=0x7fffffffdea8, init=<optimized out>, fini=<optimized out>, rtld_fini=0x0, stack_end=0x7fffffffde98) at ../csu/libc-start.c:291 #4 0x00007ffff7f129c5 in _start () at ../sysdeps/x86_64/start.S:115 (gdb)