Launchpad has imported 14 comments from the remote bug at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71709.
If you reply to an imported comment from within Launchpad, your comment will be sent to the remote bug automatically. Read more about Launchpad's inter-bugtracker facilities at https://documentation.ubuntu.com/launchpad/user/reference/bugs/multi-project-bugs/about-multi-project-bugs/#bugs-in-external-trackers. ------------------------------------------------------------------------ On 2016-06-30T01:15:39+00:00 Ant7n wrote: The following test case fails on ppc64le: #include <string.h> char boot_command_line[2048]; char *saved_command_line; static char *static_command_line; static char *initcall_command_line; void *memblock_virt_alloc(int, int); void setup_command_line(char *command_line) { saved_command_line = memblock_virt_alloc(strlen(boot_command_line) + 1, 0); initcall_command_line = memblock_virt_alloc(strlen(boot_command_line) + 1, 0); static_command_line = memblock_virt_alloc(strlen(command_line) + 1, 0); strcpy(saved_command_line, boot_command_line); strcpy(static_command_line, command_line); } When built with: # gcc -fno-common -mcmodel=medium -O2 The last strcpy() call has lost its first argument: bl memblock_virt_alloc nop addis 3,2,.LANCHOR0+2048@toc@ha # gpr load fusion, type long ld 3,.LANCHOR0+2048@toc@l(3) mr 4,31 bl strcpy nop mr 4,30 bl strcpy Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/0 ------------------------------------------------------------------------ On 2016-06-30T01:44:29+00:00 Pinskia wrote: GCC must be thinking saved_command_line and static_command_line are the same ... Because strcpy returns the 1st argument. Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/1 ------------------------------------------------------------------------ On 2016-06-30T02:15:46+00:00 Segher-8 wrote: Confirmed. Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/2 ------------------------------------------------------------------------ On 2016-06-30T02:22:28+00:00 Segher-8 wrote: Before the first RTL CSE, we have on that second strcpy: (call_insn 47 46 0 2 (parallel [ (set (reg:DI 3 3) (call (mem:SI (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x3fff900ea000 strcpy>) [0 __builtin_strcpy S4 A8]) (const_int 64 [0x40]))) (clobber (reg:DI 65 lr)) ]) 71709.c:17 677 {*call_value_nonlocal_aixdi} (expr_list:REG_CALL_DECL (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x3fff900ea000 strcpy>) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil))) (expr_list (use (reg:DI 2 2)) (expr_list:DI (set (reg:DI 3 3) (reg:DI 3 3)) (expr_list:DI (use (reg:DI 3 3)) (expr_list:DI (use (reg:DI 4 4)) (nil)))))) but after cse1 it is: (call_insn 47 46 0 2 (parallel [ (set (reg:DI 3 3) (call (mem:SI (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x3fff900ea000 strcpy>) [0 __builtin_strcpy S4 A8]) (const_int 64 [0x40]))) (clobber (reg:DI 65 lr)) ]) 71709.c:17 677 {*call_value_nonlocal_aixdi} (expr_list:REG_DEAD (reg:DI 4 4) (expr_list:REG_UNUSED (reg:DI 3 3) (expr_list:REG_CALL_DECL (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x3fff900ea000 strcpy>) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil))))) (expr_list (use (reg:DI 2 2)) (expr_list:DI (set (reg:DI 3 3) (reg:DI 3 3)) (expr_list:DI (use (reg:DI 3 3)) (expr_list:DI (use (reg:DI 4 4)) (nil)))))) (note the REG_UNUSED). Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/3 ------------------------------------------------------------------------ On 2016-06-30T13:17:16+00:00 Alan Modra wrote: Comment #3 isn't showing any real problem. Where things go wrong is in ira where the first strcpy call gets a bad REG_RETURNED note. I think it is a bug in ira-lives.c:find_call_crossed_cheap_reg where insn 50 below is not recognized as a single_set due to the unspec in the parallel (which is an rs6000 backend problem that needs fixing too), then tries to use reg_overlap_mentioned_p but that misses the set dest. So find_call_crossed_cheap_reg thinks r3 hasn't been touched at that point and looks back at prior insns, finding the set from reg 168. (insn 50 42 44 2 (parallel [ (set (reg:DI 3 3) (mem/f/c:DI (unspec:DI [ (plus:DI (unspec:DI [ (symbol_ref:DI ("*.LANCHOR0") [flags 0x182]) (reg:DI 2 2) ] UNSPEC_TOCREL) (const_int 2048 [0x800])) ] UNSPEC_FUSION_ADDIS) [1 saved_command_line+0 S8 A64])) (unspec [ (const_int 0 [0]) ] UNSPEC_FUSION_ADDIS) (use (reg:DI 2 2)) (clobber (scratch:DI)) ]) /home/alan/anton.c:18 875 {*toc_fusionload_di} (nil)) (call_insn 44 50 45 2 (parallel [ (set (reg:DI 3 3) (call (mem:SI (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x7f5bb162be00 strcpy>) [0 __builtin_strcpy S4 A8]) (const_int 0 [0]))) (clobber (reg:DI 65 lr)) ]) /home/alan/anton.c:18 711 {*call_value_nonlocal_aixdi} (expr_list:REG_RETURNED (reg/f:DI 168 [ _15 ]) (expr_list:REG_DEAD (reg:DI 4 4) (expr_list:REG_UNUSED (reg:DI 3 3) (expr_list:REG_CALL_DECL (symbol_ref:DI ("strcpy") [flags 0x41] <function_decl 0x7f5bb162be00 strcpy>) (expr_list:REG_EH_REGION (const_int 0 [0]) (nil)))))) (expr_list (use (reg:DI 2 2)) (expr_list:DI (set (reg:DI 3 3) (reg:DI 3 3)) (expr_list:DI (use (reg:DI 3 3)) (expr_list:DI (use (reg:DI 4 4)) (nil)))))) Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/4 ------------------------------------------------------------------------ On 2016-06-30T13:37:38+00:00 Alan Modra wrote: Created attachment 38802 fix Cures the error in find_call_crossed_cheap_reg Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/5 ------------------------------------------------------------------------ On 2016-06-30T18:52:30+00:00 Segher-8 wrote: Yeah that looks better, I'm still confused by REG_DEAD vs. REG_UNUSED, sigh. The whole logic here seems somewhat confused. Or at least it is confusing me :-) Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/6 ------------------------------------------------------------------------ On 2016-07-01T06:34:35+00:00 Alan Modra wrote: find_call_crossed_cheap_reg is certainly confusing. On looking at it again this morning, I can't see why it uses reg_overlap_mentioned_p to break out of the loop. Who cares if the reg is referenced (except autoinc)? I'm thinking now that the correct exit condition is simply reg_set_p (reg, prev). Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/7 ------------------------------------------------------------------------ On 2016-07-01T11:15:54+00:00 Amodra-gcc wrote: Author: amodra Date: Fri Jul 1 11:15:17 2016 New Revision: 237909 URL: https://gcc.gnu.org/viewcvs?rev=237909&root=gcc&view=rev Log: strcpy arg optimised out For functions that return an argument unchanged, like strcat, find_call_crossed_cheap_reg attempts to find an assignment between a pseudo reg and the arg reg before the call, so that uses of the pseudo after the call can instead use the return value. The exit condition on the loop looking at previous insns was wrong. Uses of the arg reg don't matter. What matters is the insn setting the arg reg as any assignment involving the arg reg prior to that insn is likely a completely unrelated use of the hard reg. PR rtl-optimization/71709 * ira-lives.c (find_call_crossed_cheap_reg): Exit loop on arg reg being set, not referenced. Modified: trunk/gcc/ChangeLog trunk/gcc/ira-lives.c Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/8 ------------------------------------------------------------------------ On 2016-07-01T12:42:06+00:00 Alan Modra wrote: Fixed. Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/9 ------------------------------------------------------------------------ On 2016-09-26T16:56:33+00:00 Doko-v wrote: https://bugs.debian.org/838892 reports this for the gcc-6 branch too; could that be backported? Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/10 ------------------------------------------------------------------------ On 2016-09-28T19:13:22+00:00 Bill-schmidt wrote: Working on the backports. Stay tuned. Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/12 ------------------------------------------------------------------------ On 2016-09-28T21:36:09+00:00 Bill-schmidt wrote: Author: wschmidt Date: Wed Sep 28 21:35:37 2016 New Revision: 240598 URL: https://gcc.gnu.org/viewcvs?rev=240598&root=gcc&view=rev Log: 2016-09-28 Bill Schmidt <[email protected]> Alan Modra <[email protected]> Backport from mainline 2016-07-01 Alan Modra <[email protected]> PR rtl-optimization/71709 * ira-lives.c (find_call_crossed_cheap_reg): Exit loop on arg reg being set, not referenced. Modified: branches/gcc-6-branch/gcc/ChangeLog branches/gcc-6-branch/gcc/ira-lives.c Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/13 ------------------------------------------------------------------------ On 2016-09-28T21:37:31+00:00 Bill-schmidt wrote: Author: wschmidt Date: Wed Sep 28 21:36:59 2016 New Revision: 240599 URL: https://gcc.gnu.org/viewcvs?rev=240599&root=gcc&view=rev Log: 2016-09-28 Bill Schmidt <[email protected]> Alan Modra <[email protected]> Backport from mainline 2016-07-01 Alan Modra <[email protected]> PR rtl-optimization/71709 * ira-lives.c (find_call_crossed_cheap_reg): Exit loop on arg reg being set, not referenced. Modified: branches/gcc-5-branch/gcc/ChangeLog branches/gcc-5-branch/gcc/ira-lives.c Reply at: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1628207/comments/14 ** Changed in: gcc Status: Unknown => Fix Released ** Changed in: gcc Importance: Unknown => Medium ** Bug watch added: Debian Bug tracker #838892 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=838892 -- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/1628207 Title: boot arguments passed in CONFIG_CMDLINE not being picked up by kernel with gcc-ppc64-linux-gnu v5.4.0 and v6.1.1 To manage notifications about this bug go to: https://bugs.launchpad.net/gcc/+bug/1628207/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
