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, PR 57748] Check for out of bounds access, Part 2


> So I still think my patch does the right thing.
> 
> The rationale is:
> 
>           = expand_expr (tem,
>                          (TREE_CODE (TREE_TYPE (tem)) == UNION_TYPE
>                           && COMPLETE_TYPE_P (TREE_TYPE (tem))
>                           && (TREE_CODE (TYPE_SIZE (TREE_TYPE (tem)))
>                               != INTEGER_CST)
>                           && modifier != EXPAND_STACK_PARM
>                           ? target : NULL_RTX),
>                          VOIDmode,
>                          EXPAND_MEMORY);
> 
> returns the address of the structure in question,
> we can add offset, bitoffset, and access the memory
> in the right mode and alignment information is
> passed to the backend via  MEM_ALIGN (op0).

But there are conceptually no reasons to require a MEM here.  Look at all the 
code just below the block.  Given how hard it is to eliminate spills to memory 
in RTL once they are generated, this shouldn't be taken lightly.

-- 
Eric Botcazou


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