This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix unsafe function attributes for special functions (PR 71876)


On 07/21/16 00:00, Jakub Jelinek wrote:
> On Wed, Jul 20, 2016 at 09:50:03PM +0000, Bernd Edlinger wrote:
>> But the built-in alloca is still recognized because the builtin
>> does have ECF_MAY_BE_ALLOCA and ECF_MALLOC.
>
> But __builtin_alloca_with_align likely doesn't have ECF_MALLOC set (even
> when it should).
>
> 	Jakub
>


DEF_BUILTIN_STUB (BUILT_IN_ALLOCA_WITH_ALIGN, "__builtin_alloca_with_align")

do you know what the attributes are instead,
or where that is constructed?


At least in this example it seems to work:

extern "C"
void *alloca(unsigned long);
void test(void*);
void bar(unsigned long n)
{
   char *x = (char*) __builtin_alloca_with_align(n,64);
   if (x)
     *x = 0;
}

g++ -O3 -S -Wall test.cc -ansi

results in

_Z3barm:
.LFB0:
         .cfi_startproc
         rep ret
         .cfi_endproc


and make check-c has no regressions.


Thanks
Bernd.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]