On 6/20/19 8:09 PM, Martin Sebor wrote:
> On 6/20/19 4:23 PM, Jeff Law wrote:
>> As outlined in the BZ, our alias analysis code is context insensitive.
>> So when we copy-propagate pointers, we can can and do copy PTA
>> information from members to the representative pointer in the copy-of
>> chain (we do this when the representative pointer has no associated PTA
>> information).
>>
>> However, [E]VRP can set the non-nullness of a pointer using context
>> sensitive information.  So we have to be more careful when copying PTA
>> information.
>>
>> We already have similar issues with alignment information as well.  This
>> patch just extends the hack to avoid copying alignment information in
>> some circumstances to also avoid copying the non-nullness property.
>>
>> Bootstrapped and regression tested on x86_64-linux-gnu.  OK for the
>> trunk?
>>
>> Jeff
>>
> 
> Just a question/comment about the test:
> 
> --- /dev/null
> +++ b/gcc/testsuite/gcc.c-torture/execute/pr90949.c
> @@ -0,0 +1,33 @@
> +void __attribute__((noipa,noinline)) my_puts (const char *str) { }
> +void __attribute__((noipa,noinline)) my_free (void *p) { }
> +
> +
> +struct Node
> +{
> +    struct Node* child;
> +};
> +
> +char *space[sizeof (struct Node) * 2] = { };
> +
> +void * __attribute__((noipa,noinline)) my_malloc (int bytes) { return
> &space;}
> 
> Shouldn't space be declared as an array of char rather than char*?
Yup.  I'll fix it.

> (As it is, strictly speaking, accessing it via an lvalue of type
> Node is undefined, even if it's carefully hidden from the compiler
> by the attributes.)
Doesn't really matter in the end.  In fact there's really not a reason
why this has to return char * or void * since it's really not malloc.
We could have struct Nodes.  I'll fix that too.

jeff
> 
> Martin

Reply via email to