public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/23631] New: construct to memory and memcpy instead of memset
@ 2005-08-30 10:24 etienne_lorrain at yahoo dot fr
  2005-08-30 10:39 ` [Bug middle-end/23631] " pinskia at gcc dot gnu dot org
  2005-08-30 10:40 ` pinskia at gcc dot gnu dot org
  0 siblings, 2 replies; 3+ messages in thread
From: etienne_lorrain at yahoo dot fr @ 2005-08-30 10:24 UTC (permalink / raw)
  To: gcc-bugs

A global .rodata constant is created in the following case
 and then memcpy() to the variable in the stack, instead
 of just calling the intended memset.

etienne@cygne:~/projet/gujin$ cat > tmp.c
int
sub (int i)
{
  int array[1000000] = { 0 };

  sub2 (&array[i]);
}

etienne@cygne:~/projet/gujin$ ~/projet/toolchain/bin/gcc -S -Os tmp.c -o tmp.s
etienne@cygne:~/projet/gujin$ cat tmp.s
        .file   "tmp.c"
        .section        .rodata
        .align 32
        .type   C.0.1134, @object
        .size   C.0.1134, 4000000
C.0.1134:
        .zero   4000000
        .text
.globl sub
        .type   sub, @function
sub:
        pushl   %ebp
        movl    %esp, %ebp
        pushl   %ebx
        subl    $4000000, %esp
        pushl   $4000000
        pushl   $C.0.1134
        leal    -4000004(%ebp), %ebx
        pushl   %ebx
        call    memcpy
        movl    8(%ebp), %eax
        leal    (%ebx,%eax,4), %eax
        pushl   %eax
        call    sub2
        addl    $16, %esp
        movl    -4(%ebp), %ebx
        leave
        ret
        .size   sub, .-sub
        .ident  "GCC: (GNU) 4.0.2 20050811 (prerelease)"
        .section        .note.GNU-stack,"",@progbits
etienne@cygne:~/projet/gujin$ ~/projet/toolchain/bin/gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --prefix=/home/etienne/projet/toolchain --enable-
l
anguages=c
Thread model: posix
gcc version 4.0.2 20050811 (prerelease)

  See also the thread at:
http://gcc.gnu.org/ml/gcc/2005-08/msg00660.html
  Thanks to Jim Wilson (GNU Tools Support, http://www.specifix.com) for the
 reduced test case and the analysis of the bug in gcc@gcc.gnu.org list.

  Etienne.

-- 
           Summary: construct to memory and memcpy instead of memset
           Product: gcc
           Version: 4.0.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: etienne_lorrain at yahoo dot fr
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23631


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/23631] construct to memory and memcpy instead of memset
  2005-08-30 10:24 [Bug c/23631] New: construct to memory and memcpy instead of memset etienne_lorrain at yahoo dot fr
@ 2005-08-30 10:39 ` pinskia at gcc dot gnu dot org
  2005-08-30 10:40 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-30 10:39 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|c                           |middle-end


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23631


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug middle-end/23631] construct to memory and memcpy instead of memset
  2005-08-30 10:24 [Bug c/23631] New: construct to memory and memcpy instead of memset etienne_lorrain at yahoo dot fr
  2005-08-30 10:39 ` [Bug middle-end/23631] " pinskia at gcc dot gnu dot org
@ 2005-08-30 10:40 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-08-30 10:40 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2005-08-30 10:39 -------
The issue is the same as PR 23477.

*** This bug has been marked as a duplicate of 23477 ***

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |DUPLICATE


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23631


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-30 10:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-08-30 10:24 [Bug c/23631] New: construct to memory and memcpy instead of memset etienne_lorrain at yahoo dot fr
2005-08-30 10:39 ` [Bug middle-end/23631] " pinskia at gcc dot gnu dot org
2005-08-30 10:40 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).