public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/47953] New: Code generation depends on function prototype
@ 2011-03-02 13:29 hjl.tools at gmail dot com
  2011-03-02 16:54 ` [Bug c/47953] " joseph at codesourcery dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2011-03-02 13:29 UTC (permalink / raw)
  To: gcc-bugs

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.


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

* [Bug c/47953] Code generation depends on function prototype
  2011-03-02 13:29 [Bug c/47953] New: Code generation depends on function prototype hjl.tools at gmail dot com
@ 2011-03-02 16:54 ` joseph at codesourcery dot com
  2011-03-02 17:09 ` hjl.tools at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: joseph at codesourcery dot com @ 2011-03-02 16:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from joseph at codesourcery dot com <joseph at codesourcery dot com> 2011-03-02 16:54:10 UTC ---
I suspect this is the same as bug 46076; at least it looks related.


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

* [Bug c/47953] Code generation depends on function prototype
  2011-03-02 13:29 [Bug c/47953] New: Code generation depends on function prototype hjl.tools at gmail dot com
  2011-03-02 16:54 ` [Bug c/47953] " joseph at codesourcery dot com
@ 2011-03-02 17:09 ` hjl.tools at gmail dot com
  2011-12-16  1:42 ` pinskia at gcc dot gnu.org
  2014-05-07  8:29 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: hjl.tools at gmail dot com @ 2011-03-02 17:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from H.J. Lu <hjl.tools at gmail dot com> 2011-03-02 17:09:48 UTC ---
(In reply to comment #1)
> I suspect this is the same as bug 46076; at least it looks related.

I am not sure if they are related. Here we generate different codes
based on function prototype.


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

* [Bug c/47953] Code generation depends on function prototype
  2011-03-02 13:29 [Bug c/47953] New: Code generation depends on function prototype hjl.tools at gmail dot com
  2011-03-02 16:54 ` [Bug c/47953] " joseph at codesourcery dot com
  2011-03-02 17:09 ` hjl.tools at gmail dot com
@ 2011-12-16  1:42 ` pinskia at gcc dot gnu.org
  2014-05-07  8:29 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2011-12-16  1:42 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2011-12-16 01:33:57 UTC ---
The trunk gives the same assembly code for both cases now.


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

* [Bug c/47953] Code generation depends on function prototype
  2011-03-02 13:29 [Bug c/47953] New: Code generation depends on function prototype hjl.tools at gmail dot com
                   ` (2 preceding siblings ...)
  2011-12-16  1:42 ` pinskia at gcc dot gnu.org
@ 2014-05-07  8:29 ` mpolacek at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2014-05-07  8:29 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|                            |mpolacek at gcc dot gnu.org
         Resolution|---                         |FIXED

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
...thus hopefully fixed.


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

end of thread, other threads:[~2014-05-07  8:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-02 13:29 [Bug c/47953] New: Code generation depends on function prototype hjl.tools at gmail dot com
2011-03-02 16:54 ` [Bug c/47953] " joseph at codesourcery dot com
2011-03-02 17:09 ` hjl.tools at gmail dot com
2011-12-16  1:42 ` pinskia at gcc dot gnu.org
2014-05-07  8:29 ` mpolacek at gcc dot gnu.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).