The whole essense of many optimizations is to make memory req smaller. It's usually considered a good thing.
-
-
If you can prove no other memory is accessed, perhaps. I'm not sure the optimization bothers to check though.
2 replies 0 retweets 0 likes -
I don't think just checking accesses is sufficient. There's also arithmetic & other considerations.
1 reply 0 retweets 0 likes -
The standard doesn't mention arithmetic, but it does seem impossible to satisfy reqs for pointer subtraction.
1 reply 0 retweets 0 likes -
Consider X=SIZE_MAX; p=calloc(X,X); if(p) printf("%p %p\n", p, p+X+1); // opt reducing alloc'd size is invalid.
1 reply 0 retweets 0 likes -
I think you could say as long as the pointer is considered valid, it's okay ("magic compression").
1 reply 0 retweets 0 likes -
No, there are clear violations of as-if rule (xform produces output non-xformed ver provably doesn't produce).
1 reply 0 retweets 0 likes -
Yes, that would only be valid if it were something calloc did anyway.
1 reply 0 retweets 0 likes -
calloc can't do that. All objects have unique addresses, all array members have unique offsets.
1 reply 0 retweets 0 likes -
:-/ If the program never checks that, isn't it as-if it can do magic?
2 replies 0 retweets 0 likes
That's what I was saying - without asserting non-existence of any code that sees the diff, the xform is invalid
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.