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

pinskia at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Fri Mar 25 20:59:00 GMT 2005


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



More information about the Gcc-bugs mailing list