Bug 110103 - the pointers return from two malloc is not equal
Summary: the pointers return from two malloc is not equal
Status: RESOLVED DUPLICATE of bug 13962
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-03 11:06 UTC by vfdff
Modified: 2023-06-05 06:46 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description vfdff 2023-06-03 11:06:06 UTC
test:https://gcc.godbolt.org/z/j74z1qaT9
```
int check_pointer (void)
{
   int *pa = (int *) malloc (sizeof (int) * NUM);
   int *pb = (int *) malloc (sizeof (int) * NUM);

   return pa == pb;
}

```

* llvm just return 0, while gcc not
Comment 1 Xi Ruoyao 2023-06-04 10:13:35 UTC
Hmm, is it valid to optimize the malloc() calls away here?
Comment 2 Richard Biener 2023-06-05 06:46:06 UTC
optimizing away malloc() is on the border of validity I think since grabbing memory is an observable side-effect.  Otherwise a duplicate of PR13962.

*** This bug has been marked as a duplicate of bug 13962 ***