public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/50569] New: Wrong code error: memcpy eliminated when it is needed
@ 2011-09-29 18:58 pkoning at gcc dot gnu.org
  2011-09-29 18:58 ` [Bug c/50569] " pkoning at gcc dot gnu.org
                   ` (16 more replies)
  0 siblings, 17 replies; 18+ messages in thread
From: pkoning at gcc dot gnu.org @ 2011-09-29 18:58 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 50569
           Summary: Wrong code error: memcpy eliminated when it is needed
    Classification: Unclassified
           Product: gcc
           Version: 4.6.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: pkoning@gcc.gnu.org


Created attachment 25382
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25382
Test code that shows the issue

This issue shows up in 4.6.1 but is not present in 4.5.1.

The attached sample code picks up a buffer pointer from external data
structures, copies a block of data to a temporary variable, and then references
the temporary.  GCC 4.6.1 optimized away the memcpy and instead directly
references the original data, which is fine... except that the pointer is "char
*" meaning that the data structure in that buffer is not necessarily aligned. 
And the references through that pointer are written as if the data IS aligned,
so on my strict-alignment target (MIPS) I get an alignment exception.

GCC 4.5.1 does it right -- it also optimizes away the memcpy but it accesses
the original data using unaligned accesses.


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

end of thread, other threads:[~2012-06-12  9:24 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-29 18:58 [Bug c/50569] New: Wrong code error: memcpy eliminated when it is needed pkoning at gcc dot gnu.org
2011-09-29 18:58 ` [Bug c/50569] " pkoning at gcc dot gnu.org
2011-09-29 19:00 ` mikpe at it dot uu.se
2011-09-29 19:53 ` [Bug middle-end/50569] " pinskia at gcc dot gnu.org
2011-09-29 20:45 ` pkoning at gcc dot gnu.org
2011-09-29 20:56 ` mikpe at it dot uu.se
2011-09-29 22:14 ` pkoning at gcc dot gnu.org
2011-10-01 10:29 ` mikpe at it dot uu.se
2011-11-04 15:32 ` mikpe at it dot uu.se
2011-11-04 20:58 ` mikpe at it dot uu.se
2011-12-09  8:55 ` [Bug tree-optimization/50569] [4.6/4.7 regression] unaligned memory accesses generated for memcpy ebotcazou at gcc dot gnu.org
2011-12-10 16:47 ` mikpe at it dot uu.se
2011-12-10 17:55 ` ebotcazou at gcc dot gnu.org
2011-12-11 20:25 ` mikpe at it dot uu.se
2011-12-12 18:25 ` ebotcazou at gcc dot gnu.org
2011-12-12 18:27 ` ebotcazou at gcc dot gnu.org
2011-12-12 18:55 ` ebotcazou at gcc dot gnu.org
2012-06-12  9:24 ` liujiangning 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).