[PATCH] PR60092, basic support for posix_malloc

Jakub Jelinek jakub@redhat.com
Thu Feb 6 13:48:00 GMT 2014


On Thu, Feb 06, 2014 at 02:21:01PM +0100, Richard Biener wrote:
> + 	  /* We marking allocated storage local, we deal with it becoming
> + 	     global by escaping and setting of vars_contains_escaped_heap.  */

Did you mean By marking ..., or something else?

> + extern int posix_memalign(void **memptr,
> + 			  __SIZE_TYPE__ alignment, __SIZE_TYPE__ size);
> + 
> + int foo (int *p)
> + {
> +   int res = *p;
> +   int *q;
> +   posix_memalign ((void **)&q, 128, 128 * sizeof (int));

Do you really want to have strict aliasing violations in the testcase?
I think one has to take address of a void * variable and if you want
int *, then cast to int * afterwards.  Also, I think for posix_memalign
you really should be checking return value of the function.

Otherwise LGTM.

	Jakub



More information about the Gcc-patches mailing list