This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
RE: [PATCH, PR 57748] Check for out of bounds access, Part 2
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: Eric Botcazou <ebotcazou at adacore dot com>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Martin Jambor <mjambor at suse dot cz>, Richard Biener <richard dot guenther at gmail dot com>
- Date: Thu, 26 Sep 2013 13:58:19 +0200
- Subject: RE: [PATCH, PR 57748] Check for out of bounds access, Part 2
- Authentication-results: sourceware.org; auth=none
- References: <20130910193228 dot GE6732 at virgil dot suse> <20130925140102 dot GC21731 at virgil dot suse> <DUB122-W526EFD4F4073604124730DE4280 at phx dot gbl>,<2318377 dot jMH3S0V0Gd at polaris>
Hi,
On Thu, 26 Sep 2013 11:34:02, Eric Botcazou wrote:
>
>> 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
Sure, but the modifier is not meant to force something into memory,
especially when it is already in an register. Remember, we are only
talking of structures here, and we only want to access one member.
It is more the other way round:
It says: "You do not have to load the value in a register, if it is already in
memory I'm happy"
At least in my understanding.
Bernd.