public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Error Injection
@ 2013-09-01 11:45 tturhan
  2013-09-03 17:59 ` Modifying the values of Gimple Instruction Operands tturhan
  0 siblings, 1 reply; 5+ messages in thread
From: tturhan @ 2013-09-01 11:45 UTC (permalink / raw)
  To: gcc

Hi,

I am a student at Bilkent Uni. in Turkey and using GCC as a tool for my
M.S. Thesis which is about Software Fault Tolerance.
I am stuck, in terms of implementing bit flips in the operands of a gimple
statement.

I need to inject bit flips to all kinds of operands, constant integers,
floats, variables, pointers etc...

It is simpler for constants, but I am having a hard time to get the value
of pointers and other variables.

My objective is to simply change the value of a tree operand, by injecting
a new instruction that changes the value or directly change the operand to
a bit flipped value.

For constant integers I did something like this:

int valueBefore = TREE_INT_CST_LOW(operands[i]);
int valueAfter = (valueBefore ^ (1u << 2)); 					tree number =
build_int_cst (integer_type_node, valueAfter);

I would love it if you can help me and
may even implement a tool for GCC for error injection purposes.

Any help would be much appreciated!

Thank you very much!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Modifying the values of Gimple Instruction Operands
  2013-09-01 11:45 Error Injection tturhan
@ 2013-09-03 17:59 ` tturhan
  2013-09-04  8:18   ` Richard Biener
  0 siblings, 1 reply; 5+ messages in thread
From: tturhan @ 2013-09-03 17:59 UTC (permalink / raw)
  To: tturhan; +Cc: gcc

Sorry forgot to mention, my name is Tuncer.

Again any help would be much appreciated.
I know these maybe simple for some of you if you could lend me a hand, you
will be doing a great deal of help.

Changed the subject for better understanding,

Thanks again guys :)


> Hi,
>
> I am a student at Bilkent Uni. in Turkey and using GCC as a tool for my
> M.S. Thesis which is about Software Fault Tolerance.
> I am stuck, in terms of implementing bit flips in the operands of a gimple
> statement.
>
> I need to inject bit flips to all kinds of operands, constant integers,
> floats, variables, pointers etc...
>
> It is simpler for constants, but I am having a hard time to get the value
> of pointers and other variables.
>
> My objective is to simply change the value of a tree operand, by injecting
> a new instruction that changes the value or directly change the operand to
> a bit flipped value.
>
> For constant integers I did something like this:
>
> int valueBefore = TREE_INT_CST_LOW(operands[i]);
> int valueAfter = (valueBefore ^ (1u << 2)); 					tree number =
> build_int_cst (integer_type_node, valueAfter);
>
> I would love it if you can help me and
> may even implement a tool for GCC for error injection purposes.
>
> Any help would be much appreciated!
>
> Thank you very much!
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modifying the values of Gimple Instruction Operands
  2013-09-03 17:59 ` Modifying the values of Gimple Instruction Operands tturhan
@ 2013-09-04  8:18   ` Richard Biener
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Biener @ 2013-09-04  8:18 UTC (permalink / raw)
  To: tturhan; +Cc: GCC Development

On Tue, Sep 3, 2013 at 7:59 PM,  <tturhan@cs.bilkent.edu.tr> wrote:
> Sorry forgot to mention, my name is Tuncer.
>
> Again any help would be much appreciated.
> I know these maybe simple for some of you if you could lend me a hand, you
> will be doing a great deal of help.
>
> Changed the subject for better understanding,
>
> Thanks again guys :)

Something like

   oldop = gimple_assign_rhs1 (stmt);
   gsi = gsi_for_stmt (stmt);
   newop = force_gimple_operand_gsi (&gsi, fold_build2 (BIT_IOR_EXPR,
TREE_TYPE (oldop), oldop, build_int_cst (TREE_TYPE (oldop), 1<<3)),
true, NULL_TREE, true, GSI_CONTINUE_LINKING);
   gimple_assign_set_rhs1 (stmt, newop);
   update_stmt (stmt);

>
>> Hi,
>>
>> I am a student at Bilkent Uni. in Turkey and using GCC as a tool for my
>> M.S. Thesis which is about Software Fault Tolerance.
>> I am stuck, in terms of implementing bit flips in the operands of a gimple
>> statement.
>>
>> I need to inject bit flips to all kinds of operands, constant integers,
>> floats, variables, pointers etc...
>>
>> It is simpler for constants, but I am having a hard time to get the value
>> of pointers and other variables.
>>
>> My objective is to simply change the value of a tree operand, by injecting
>> a new instruction that changes the value or directly change the operand to
>> a bit flipped value.
>>
>> For constant integers I did something like this:
>>
>> int valueBefore = TREE_INT_CST_LOW(operands[i]);
>> int valueAfter = (valueBefore ^ (1u << 2));                                   tree number =
>> build_int_cst (integer_type_node, valueAfter);
>>
>> I would love it if you can help me and
>> may even implement a tool for GCC for error injection purposes.
>>
>> Any help would be much appreciated!
>>
>> Thank you very much!
>>
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modifying the values of Gimple Instruction Operands
  2013-09-07 11:53 tturhan
@ 2013-09-23 18:09 ` tturhan
  0 siblings, 0 replies; 5+ messages in thread
From: tturhan @ 2013-09-23 18:09 UTC (permalink / raw)
  To: tturhan; +Cc: GCC Development

Can you guys please help me for variables and pointers ?

Any ideas or pointers will be fine!

Thank you very much in advance.

> Thank you very much Richard,
>
> Very good starter for me but I am actually having the hardest time with
> variables, pointers etc...
>
> I know this may be a lot to ask but,
> If you could help me with this I will very much appreciate it.
>
> Thanks again very much!
> I will be sure to include your name in my paper :)
>
>> On Tue, Sep 3, 2013 at 7:59 PM,  <tturhan@cs.bilkent.edu.tr> wrote:
>>> Sorry forgot to mention, my name is Tuncer.
>>> Again any help would be much appreciated.
>>> I know these maybe simple for some of you if you could lend me a hand,
>>> you
>>> will be doing a great deal of help.
>>> Changed the subject for better understanding,
>>> Thanks again guys :)
>> Something like
>>    oldop = gimple_assign_rhs1 (stmt);
>>    gsi = gsi_for_stmt (stmt);
>>    newop = force_gimple_operand_gsi (&gsi, fold_build2 (BIT_IOR_EXPR,
>> TREE_TYPE (oldop), oldop, build_int_cst (TREE_TYPE (oldop), 1<<3)),
> true, NULL_TREE, true, GSI_CONTINUE_LINKING);
>>    gimple_assign_set_rhs1 (stmt, newop);
>>    update_stmt (stmt);
>>>> Hi,
>>>> I am a student at Bilkent Uni. in Turkey and using GCC as a tool for
> my
>>>> M.S. Thesis which is about Software Fault Tolerance.
>>>> I am stuck, in terms of implementing bit flips in the operands of a
> gimple
>>>> statement.
>>>> I need to inject bit flips to all kinds of operands, constant
> integers,
>>>> floats, variables, pointers etc...
>>>> It is simpler for constants, but I am having a hard time to get the
>>>> value
>>>> of pointers and other variables.
>>>> My objective is to simply change the value of a tree operand, by
> injecting
>>>> a new instruction that changes the value or directly change the
> operand
>>>> to
>>>> a bit flipped value.
>>>> For constant integers I did something like this:
>>>> int valueBefore = TREE_INT_CST_LOW(operands[i]);
>>>> int valueAfter = (valueBefore ^ (1u << 2));
>
>>>>       tree number =
>>>> build_int_cst (integer_type_node, valueAfter);
>>>> I would love it if you can help me and
>>>> may even implement a tool for GCC for error injection purposes. Any
> help would be much appreciated!
>>>> Thank you very much!
>
>
>
>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Modifying the values of Gimple Instruction Operands
@ 2013-09-07 11:53 tturhan
  2013-09-23 18:09 ` tturhan
  0 siblings, 1 reply; 5+ messages in thread
From: tturhan @ 2013-09-07 11:53 UTC (permalink / raw)
  To: Richard Biener; +Cc: tturhan, GCC Development

Thank you very much Richard,

Very good starter for me but I am actually having the hardest time with
variables, pointers etc...

I know this may be a lot to ask but,
If you could help me with this I will very much appreciate it.

Thanks again very much!
I will be sure to include your name in my paper :)

> On Tue, Sep 3, 2013 at 7:59 PM,  <tturhan@cs.bilkent.edu.tr> wrote:
>> Sorry forgot to mention, my name is Tuncer.
>> Again any help would be much appreciated.
>> I know these maybe simple for some of you if you could lend me a hand, you
>> will be doing a great deal of help.
>> Changed the subject for better understanding,
>> Thanks again guys :)
> Something like
>    oldop = gimple_assign_rhs1 (stmt);
>    gsi = gsi_for_stmt (stmt);
>    newop = force_gimple_operand_gsi (&gsi, fold_build2 (BIT_IOR_EXPR,
> TREE_TYPE (oldop), oldop, build_int_cst (TREE_TYPE (oldop), 1<<3)),
true, NULL_TREE, true, GSI_CONTINUE_LINKING);
>    gimple_assign_set_rhs1 (stmt, newop);
>    update_stmt (stmt);
>>> Hi,
>>> I am a student at Bilkent Uni. in Turkey and using GCC as a tool for
my
>>> M.S. Thesis which is about Software Fault Tolerance.
>>> I am stuck, in terms of implementing bit flips in the operands of a
gimple
>>> statement.
>>> I need to inject bit flips to all kinds of operands, constant
integers,
>>> floats, variables, pointers etc...
>>> It is simpler for constants, but I am having a hard time to get the value
>>> of pointers and other variables.
>>> My objective is to simply change the value of a tree operand, by
injecting
>>> a new instruction that changes the value or directly change the
operand
>>> to
>>> a bit flipped value.
>>> For constant integers I did something like this:
>>> int valueBefore = TREE_INT_CST_LOW(operands[i]);
>>> int valueAfter = (valueBefore ^ (1u << 2));

>>>       tree number =
>>> build_int_cst (integer_type_node, valueAfter);
>>> I would love it if you can help me and
>>> may even implement a tool for GCC for error injection purposes. Any
help would be much appreciated!
>>> Thank you very much!




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-09-23 18:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-01 11:45 Error Injection tturhan
2013-09-03 17:59 ` Modifying the values of Gimple Instruction Operands tturhan
2013-09-04  8:18   ` Richard Biener
2013-09-07 11:53 tturhan
2013-09-23 18:09 ` tturhan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).