public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/51683] New: [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp
@ 2011-12-27 11:19 jakub at gcc dot gnu.org
  2011-12-27 11:33 ` [Bug tree-optimization/51683] " jakub at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-27 11:19 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 51683
           Summary: [4.7 Regression] __builtin_memcpy etc. with constant
                    first argument optimized away by ccp
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: jakub@gcc.gnu.org
        ReportedBy: jakub@gcc.gnu.org


static inline void *
bar (void *p, void *q, int r)
{
  return __builtin_memcpy (p, q, r);
}

void *
foo (void *p)
{
  return bar ((void *) 0x12345000, p, 256);
}

at -O2 starting with http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=175290
is optimized away.  While the return value from memcpy is known to be constant
and we know that constant, we ignore the other side-effects of the call.


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

* [Bug tree-optimization/51683] [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp
  2011-12-27 11:19 [Bug tree-optimization/51683] New: [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp jakub at gcc dot gnu.org
@ 2011-12-27 11:33 ` jakub at gcc dot gnu.org
  2011-12-27 11:37 ` jakub at gcc dot gnu.org
  2011-12-31 23:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-27 11:33 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2011-12-27
   Target Milestone|---                         |4.7.0
     Ever Confirmed|0                           |1


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

* [Bug tree-optimization/51683] [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp
  2011-12-27 11:19 [Bug tree-optimization/51683] New: [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp jakub at gcc dot gnu.org
  2011-12-27 11:33 ` [Bug tree-optimization/51683] " jakub at gcc dot gnu.org
@ 2011-12-27 11:37 ` jakub at gcc dot gnu.org
  2011-12-31 23:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-27 11:37 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-27 11:33:01 UTC ---
Created attachment 26188
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26188
gcc47-pr51683.patch

Untested fix.


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

* [Bug tree-optimization/51683] [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp
  2011-12-27 11:19 [Bug tree-optimization/51683] New: [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp jakub at gcc dot gnu.org
  2011-12-27 11:33 ` [Bug tree-optimization/51683] " jakub at gcc dot gnu.org
  2011-12-27 11:37 ` jakub at gcc dot gnu.org
@ 2011-12-31 23:57 ` jakub at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: jakub at gcc dot gnu.org @ 2011-12-31 23:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-12-31 23:54:00 UTC ---
Author: jakub
Date: Sat Dec 31 23:53:57 2011
New Revision: 182761

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=182761
Log:
    PR tree-optimization/51683
    * tree-ssa-propagate.c (substitute_and_fold): Don't optimize away
    calls with side-effects.
    * tree-ssa-ccp.c (ccp_fold_stmt): Likewise.

    * gcc.dg/pr51683.c: New test.

Added:
    trunk/gcc/testsuite/gcc.dg/pr51683.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/tree-ssa-ccp.c
    trunk/gcc/tree-ssa-propagate.c


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

end of thread, other threads:[~2011-12-31 23:54 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-12-27 11:19 [Bug tree-optimization/51683] New: [4.7 Regression] __builtin_memcpy etc. with constant first argument optimized away by ccp jakub at gcc dot gnu.org
2011-12-27 11:33 ` [Bug tree-optimization/51683] " jakub at gcc dot gnu.org
2011-12-27 11:37 ` jakub at gcc dot gnu.org
2011-12-31 23:57 ` jakub 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).