public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "guillaume dot melquiond at ens-lyon dot fr" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/27055] New: Structures are copied byte by byte into function arguments Date: Thu, 06 Apr 2006 11:46:00 -0000 [thread overview] Message-ID: <bug-27055-7904@http.gcc.gnu.org/bugzilla/> (raw) I tried the following testcase with various GCC versions available as Debian packages. With 3.3.5, the copy from *a to the stack frame of g is done word-by-word with rep movsl. With 3.4.4, it is done by memcpy. Both previous methods are fine. With 3.4.6, the copy is done byte-by-byte without string opcodes. With 4.0.3 and 4.1.0, it is done byte-by-byte and out-of-line: there are two jumps for each copied byte! So argument copy got broken for x86 during GCC 3.4 cycle and it did not get any better with GCC 4. typedef struct A { int a[1000]; } A; void g(A); void f(A *a) { g(*a); } Assembly output with GCC4 and -O3 optimization: pushl %ebp xorl %edx, %edx movl %esp, %ebp subl $4008, %esp movl 8(%ebp), %ecx .L3: cmpl $4000, %edx jb .L2 call g leave ret .p2align 4,,7 .L2: movzbl (%ecx,%edx), %eax movb %al, (%esp,%edx) incl %edx .p2align 4,,3 jmp .L3 $ LANG=C gcc-3.4 -v Reading specs from /usr/lib/gcc/i486-linux-gnu/3.4.6/specs Configured with: ../src/configure -v --enable-languages=c,c++,f77,pascal --prefix=/usr --libexecdir=/usr/lib --with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib --enable-nls --without-included-gettext --program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --with-tune=i686 i486-linux-gnu Thread model: posix gcc version 3.4.6 (Debian 3.4.6-1) $ LANG=C gcc-4.1 -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --enable-languages=c,c++,java,fortran,objc,obj-c++,ada,treelang --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --program-suffix=-4.1 --enable-__cxa_atexit --enable-clocale=gnu --enable-libstdcxx-debug --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-4.1-1.4.2.0/jre --enable-mpfr --with-tune=i686 --enable-checking=release i486-linux-gnu Thread model: posix gcc version 4.1.0 (Debian 4.1.0-1) -- Summary: Structures are copied byte by byte into function arguments Product: gcc Version: 4.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: guillaume dot melquiond at ens-lyon dot fr GCC target triplet: i486-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27055
next reply other threads:[~2006-04-06 11:46 UTC|newest] Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-04-06 11:46 guillaume dot melquiond at ens-lyon dot fr [this message] 2006-04-06 12:03 ` [Bug c/27055] " gdr at integrable-solutions dot net 2006-04-06 12:49 ` pluto at agmk dot net 2006-04-06 13:05 ` guillaume dot melquiond at ens-lyon dot fr 2006-04-13 1:52 ` [Bug target/27055] " pinskia at gcc dot gnu dot org 2006-04-16 18:16 ` guillaume dot melquiond at ens-lyon dot fr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-27055-7904@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).