duplicate a variable!!!!

Greicy.Costa-Marques@imag.fr Greicy.Costa-Marques@imag.fr
Thu Mar 31 11:39:00 GMT 2011


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.

> 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.

In my work I have to do that with gcc (in another words i have to  
modify the compiler so it makes it)

you said is necessary to have to learn a fair amount of gcc  
infrastructure in order to do it.  Like what?


greicy





Ian Lance Taylor <iant@google.com> a écrit :

> Greicy.Costa-Marques@imag.fr writes:
>
>> I'd like to know if is possible to gcc to duplicate  a variable? for example
>>
>> ....
>> int a=2; i have this
>>
>> i want to do it: int a_1=2, a_2=2;
>>
>> I have a code in c and i want to modify the gcc so it makes the
>> duplication of the variable. i like to do it at the level of RTL to
>> ASM.
>> I  know that there is a function (output_asm_insn) in final.c that
>> goes from RTL to ASM.
>> would anyone have any suggestions to do this?
>
> Yes, it is possible.  However, you are going to have to learn a fair
> amount of gcc infrastructure in order to do it.  One important question
> is going to be how you know which variable you want to duplicate.
> Presumably you don't want to duplicate all variables.  Another important
> question is what you want to do with the duplicated variable.  If you
> duplicate the variable in a straightforward way, the duplicate will
> simply be removed by the optimization passes.
>
> Ian
>



More information about the Gcc-help mailing list