This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/47953] New: Code generation depends on function prototype
- From: "hjl.tools at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 2 Mar 2011 13:28:58 +0000
- Subject: [Bug c/47953] New: Code generation depends on function prototype
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47953
Summary: Code generation depends on function prototype
Product: gcc
Version: 4.6.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: hjl.tools@gmail.com
CC: jsm28@gcc.gnu.org
On Linux/x86-64, I got
[hjl@gnu-6 ilp32-27]$ cat x.c
void (*foo[6][6]) (int);
void bar (hdR)
int hdR;
{ }
void xxx ()
{
unsigned int i, j;
for (i = 0; i < 6; ++i)
for (j = 0; j < 6; ++j)
foo [i][j] = bar;
}
[hjl@gnu-6 ilp32-27]$ cat y.c
void (*foo[6][6]) (int);
void bar (int hdR)
{ }
void xxx ()
{
unsigned int i, j;
for (i = 0; i < 6; ++i)
for (j = 0; j < 6; ++j)
foo [i][j] = bar;
}
[hjl@gnu-6 ilp32-27]$ make x.s y.s
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o x.s -O3 x.c
/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/xgcc
-B/export/build/gnu/gcc-x32/build-x86_64-linux/gcc/ -S -o y.s -O3 y.c
[hjl@gnu-6 ilp32-27]$ cat x.s y.s
.file "x.c"
.text
.p2align 4,,15
.globl bar
.type bar, @function
bar:
.LFB0:
.cfi_startproc
rep
ret
.cfi_endproc
.LFE0:
.size bar, .-bar
.p2align 4,,15
.globl xxx
.type xxx, @function
xxx:
.LFB1:
.cfi_startproc
movq .LC0(%rip), %xmm1
punpcklqdq %xmm1, %xmm1
movdqa %xmm1, foo(%rip)
movdqa %xmm1, foo+16(%rip)
movdqa %xmm1, foo+32(%rip)
movdqa %xmm1, foo+48(%rip)
movdqa %xmm1, foo+64(%rip)
movdqa %xmm1, foo+80(%rip)
movdqa %xmm1, foo+96(%rip)
movdqa %xmm1, foo+112(%rip)
movdqa %xmm1, foo+128(%rip)
movdqa %xmm1, foo+144(%rip)
movdqa %xmm1, foo+160(%rip)
movdqa %xmm1, foo+176(%rip)
movdqa %xmm1, foo+192(%rip)
movdqa %xmm1, foo+208(%rip)
movdqa %xmm1, foo+224(%rip)
movdqa %xmm1, foo+240(%rip)
movdqa %xmm1, foo+256(%rip)
movdqa %xmm1, foo+272(%rip)
ret
.cfi_endproc
.LFE1:
.size xxx, .-xxx
.comm foo,288,32
.section .rodata.cst8,"aM",@progbits,8
.align 8
.LC0:
.quad bar
.ident "GCC: (GNU) 4.6.0 20110224 (experimental)"
.section .note.GNU-stack,"",@progbits
.file "y.c"
.text
.p2align 4,,15
.globl bar
.type bar, @function
bar:
.LFB0:
.cfi_startproc
rep
ret
.cfi_endproc
.LFE0:
.size bar, .-bar
.p2align 4,,15
.globl xxx
.type xxx, @function
xxx:
.LFB1:
.cfi_startproc
movq $bar, foo(%rip)
movq $bar, foo+8(%rip)
movq $bar, foo+16(%rip)
movq $bar, foo+24(%rip)
movq $bar, foo+32(%rip)
movq $bar, foo+40(%rip)
movq $bar, foo+48(%rip)
movq $bar, foo+56(%rip)
movq $bar, foo+64(%rip)
movq $bar, foo+72(%rip)
movq $bar, foo+80(%rip)
movq $bar, foo+88(%rip)
movq $bar, foo+96(%rip)
movq $bar, foo+104(%rip)
movq $bar, foo+112(%rip)
movq $bar, foo+120(%rip)
movq $bar, foo+128(%rip)
movq $bar, foo+136(%rip)
movq $bar, foo+144(%rip)
movq $bar, foo+152(%rip)
movq $bar, foo+160(%rip)
movq $bar, foo+168(%rip)
movq $bar, foo+176(%rip)
movq $bar, foo+184(%rip)
movq $bar, foo+192(%rip)
movq $bar, foo+200(%rip)
movq $bar, foo+208(%rip)
movq $bar, foo+216(%rip)
movq $bar, foo+224(%rip)
movq $bar, foo+232(%rip)
movq $bar, foo+240(%rip)
movq $bar, foo+248(%rip)
movq $bar, foo+256(%rip)
movq $bar, foo+264(%rip)
movq $bar, foo+272(%rip)
movq $bar, foo+280(%rip)
ret
.cfi_endproc
.LFE1:
.size xxx, .-xxx
.comm foo,288,32
.ident "GCC: (GNU) 4.6.0 20110224 (experimental)"
.section .note.GNU-stack,"",@progbits
[hjl@gnu-6 ilp32-27]$
The only difference in input is:
void bar (hdR)
int hdR;
{ }
vs.
void bar (int hdR)
{ }
I am expecting the same assembly code.