This is the mail archive of the gcc-help@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: duplicate a variable!!!!


On 03/31/2011 11:16 AM, Greicy.Costa-Marques@imag.fr wrote:
> 
> Hi,  Ian
> 
>> One important question
>> is going to be how you know which variable you want to duplicate.
> 
> yes, i know which variables i want to duplicate.
> 
>> Presumably you don't want to duplicate all variables.
> 
> no, i want to duplicate all variables in my code.

Statically-allocated, or even on-stack variables?

>> Another important question is what you want to do with the  
>> duplicated variable.
> 
> Because I want to harden  my code.  I'm working with fault injection  
> by software and I want to harden my code, and a way of hardening is  
> the duplication of variables. And as I still do not know how, I chose  
> to start trying for a single variable and after to use the same path  
> for all variables in my code.
> 
>> If you duplicate the variable in a straightforward way, the duplicate will
>> simply be removed by the optimization passes.
> 
> I want the duplication remains after optimization.

I suspect that the easiest way would be to create a volatile copy of
every variable after gimplification, and then fix up all assignemnts
to copy into the volatile.

Andrew.


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