This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/71709] New: powerpc64le: argument to strcpy() optimised out


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71709

            Bug ID: 71709
           Summary: powerpc64le: argument to strcpy() optimised out
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: anton at samba dot org
  Target Milestone: ---

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]