[Bug lto/78529] New: gcc.c-torture/execute/builtins/strcat-chk.c failed with lto/O2
amker at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Nov 25 16:13:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78529
Bug ID: 78529
Summary: gcc.c-torture/execute/builtins/strcat-chk.c failed
with lto/O2
Product: gcc
Version: 7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: lto
Assignee: unassigned at gcc dot gnu.org
Reporter: amker at gcc dot gnu.org
Target Milestone: ---
Hi,
With below commit:
commit c618308c1b2a474bd56ede831f681a49f4327d4c
Author: prathamesh3492 <prathamesh3492@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Wed Nov 23 10:52:25 2016 +0000
2016-11-23 Richard Biener <rguenther@suse.de>
Prathamesh Kulkarni <prathamesh.kulkarni@linaro.rog>
PR tree-optimization/78154
* tree-vrp.c (gimple_stmt_nonzero_warnv_p): Return true if function
returns it's argument and the argument is nonnull.
* builtin-attrs.def: Define ATTR_RETURNS_NONNULL,
ATT_RETNONNULL_NOTHROW_LEAF.
* builtins.def (BUILT_IN_MEMPCPY): Change attribute to
ATTR_RETNONNULL_NOTHROW_LEAF.
(BUILT_IN_STPCPY): Likewise.
(BUILT_IN_STPNCPY): Likewise.
(BUILT_IN_MEMPCPY_CHK): Likewise.
(BUILT_IN_STPCPY_CHK): Likewise.
(BUILT_IN_STPNCPY_CHK): Likewise.
(BUILT_IN_STRCAT): Change attribute to ATTR_RET1_NOTHROW_NONNULL_LEAF.
(BUILT_IN_STRNCAT): Likewise.
(BUILT_IN_STRNCPY): Likewise.
(BUILT_IN_MEMSET_CHK): Likewise.
(BUILT_IN_STRCAT_CHK): Likewise.
(BUILT_IN_STRCPY_CHK): Likewise.
(BUILT_IN_STRNCAT_CHK): Likewise.
(BUILT_IN_STRNCPY_CHK): Likewise.
testsuite/
* gcc.dg/tree-ssa/pr78154.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@242745
138bc75d-0d04-0410-961f-82ee72b054a4
We have new failure:
FAIL: gcc.c-torture/execute/builtins/strcat-chk.c execution, -O2 -flto
-fuse-linker-plugin -fno-fat-lto-objects
With/without the revision, there is difference in assembly like:
*** 1368,1387 ****
4023e4: b9401261 ldr w1, [x19, #16]
4023e8: 6b00003f cmp w1, w0
4023ec: 54ffff01 b.ne 4023cc <test1+0x14c> // b.any
! 4023f0: 91001664 add x4, x19, #0x5
! 4023f4: d2800802 mov x2, #0x40 // #64
! 4023f8: 52800b01 mov w1, #0x58 // #88
4023fc: aa1303e0 mov x0, x19
402400: 94000950 bl 404940 <memset>
402404: b9400a96 ldr w22, [x20, #8]
402408: f9400297 ldr x23, [x20]
40240c: d2800762 mov x2, #0x3b // #59
402410: 10071c81 adr x1, 4107a0 <s1+0x90>
! 402414: aa0403e0 mov x0, x4
402418: f90023b7 str x23, [x29, #64]
40241c: b9004bb6 str w22, [x29, #72]
402420: 97fffc0c bl 401450 <__strcat_chk>
! 402424: eb00001f cmp x0, x0
402428: 54fffd21 b.ne 4023cc <test1+0x14c> // b.any
40242c: 10071820 adr x0, 410730 <s1+0x20>
402430: f94023a2 ldr x2, [x29, #64]
--- 1368,1387 ----
4023e4: b9401261 ldr w1, [x19, #16]
4023e8: 6b00003f cmp w1, w0
4023ec: 54ffff01 b.ne 4023cc <test1+0x14c> // b.any
! 4023f0: d2800802 mov x2, #0x40 // #64
! 4023f4: 52800b01 mov w1, #0x58 // #88
! 4023f8: 91001678 add x24, x19, #0x5
4023fc: aa1303e0 mov x0, x19
402400: 94000950 bl 404940 <memset>
402404: b9400a96 ldr w22, [x20, #8]
402408: f9400297 ldr x23, [x20]
40240c: d2800762 mov x2, #0x3b // #59
402410: 10071c81 adr x1, 4107a0 <s1+0x90>
! 402414: aa1803e0 mov x0, x24
402418: f90023b7 str x23, [x29, #64]
40241c: b9004bb6 str w22, [x29, #72]
402420: 97fffc0c bl 401450 <__strcat_chk>
! 402424: eb00031f cmp x24, x0
402428: 54fffd21 b.ne 4023cc <test1+0x14c> // b.any
40242c: 10071820 adr x0, 410730 <s1+0x20>
402430: f94023a2 ldr x2, [x29, #64]
Looks like the "cmp x0, x0" instruction is wrongly optimized?
GCC is configured as:
configure --target=aarch64-none-elf --prefix=... --with-gmp=... --with-mpfr=...
--with-mpc=... --with-isl=... --with-pkgversion=unknown --disable-shared
--disable-nls --disable-threads --disable-tls --enable-checking=yes
--enable-languages=c,c++,fortran --with-newlib
More information about the Gcc-bugs
mailing list