This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/20641] New: Missed optimization on the tree level (malloc attribute)


Give the following code, we don't optimize it on the tree level:
typedef __SIZE_TYPE__ size_t;
extern void link_error();
extern void *f (size_t) __attribute__((__malloc__));
static int x;

void test3(void)
{
  int *ptr1, *ptr2;

  ptr1 = &x;
  ptr2 = (int*) f(sizeof (int));

  *ptr1 = 12;
  *ptr2 = 8;

  if (*ptr1 != 12)
    link_error();  //<-- This should be gone
}

-- 
           Summary: Missed optimization on the tree level (malloc attribute)
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, TREE
          Severity: enhancement
          Priority: P2
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pinskia at gcc dot gnu dot org
                CC: gcc-bugs at gcc dot gnu dot org


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]