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:19, Bernd Edlinger wrote:
> 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?
>

tree.c:

   /* If we're checking the stack, `alloca' can throw.  */
   const int alloca_flags
     = ECF_MALLOC | ECF_LEAF | (flag_stack_check ? 0 : ECF_NOTHROW);

   if (!builtin_decl_explicit_p (BUILT_IN_ALLOCA))
     {
       ftype = build_function_type_list (ptr_type_node,
                                         size_type_node, NULL_TREE);
       local_define_builtin ("__builtin_alloca", ftype, BUILT_IN_ALLOCA,
                             "alloca", alloca_flags);
     }

   ftype = build_function_type_list (ptr_type_node, size_type_node,
                                     size_type_node, NULL_TREE);
   local_define_builtin ("__builtin_alloca_with_align", ftype,
                         BUILT_IN_ALLOCA_WITH_ALIGN,
                         "__builtin_alloca_with_align",
                         alloca_flags);


looks like ECF_MALLOC and ECF_LEAF are always there.

Right?


Bernd.


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