public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/17046] New: An unused array is not optimized away.
@ 2004-08-16  6:56 kazu at cs dot umass dot edu
  2004-08-16  7:02 ` [Bug tree-optimization/17046] " pinskia at gcc dot gnu dot org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kazu at cs dot umass dot edu @ 2004-08-16  6:56 UTC (permalink / raw)
  To: gcc-bugs

Consider:

static const int banana[] = { 0, 1, 2, 3 };

int
foo (void)
{
  int a = banana[2];
  return a * 0;
}

./cc1 -O2 -fomit-frame-pointer generates:

        .file   "test.c"
        .section        .rodata
        .align 4
        .type   banana, @object
        .size   banana, 16
banana:
        .long   0
        .long   1
        .long   2
        .long   3
        .text
        .p2align 2,,3
.globl foo
        .type   foo, @function
foo:
        xorl    %eax, %eax
        ret
        .size   foo, .-foo
        .ident  "GCC: (GNU) 3.5.0 20040816 (experimental)"
        .section        .note.GNU-stack,"",@progbits

Note that array "banana" is not optimized away.

-- 
           Summary: An unused array is not optimized away.
           Product: gcc
           Version: 3.5.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: kazu at cs dot umass dot edu
                CC: gcc-bugs at gcc dot gnu dot org


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


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

end of thread, other threads:[~2005-05-04  2:16 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-16  6:56 [Bug tree-optimization/17046] New: An unused array is not optimized away kazu at cs dot umass dot edu
2004-08-16  7:02 ` [Bug tree-optimization/17046] " pinskia at gcc dot gnu dot org
2004-08-16  7:31 ` kazu at cs dot umass dot edu
2005-05-04  2:16 ` 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).