Bug 20641 - Missed optimization on the tree level (malloc attribute)
Summary: Missed optimization on the tree level (malloc attribute)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: 4.1.0
: P2 enhancement
Target Milestone: 4.1.0
Assignee: Not yet assigned to anyone
URL:
Keywords: alias, missed-optimization, TREE
Depends on:
Blocks: 20638
  Show dependency treegraph
 
Reported: 2005-03-25 20:59 UTC by Andrew Pinski
Modified: 2005-09-21 02:12 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-06-09 16:36:26


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Pinski 2005-03-25 20:59:21 UTC
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
}
Comment 1 Andrew Pinski 2005-09-21 02:12:44 UTC
Fixed for 4.1.0.