El 6 abr 2016, a las 03:02, Nicholas Mc Guire <[email protected]> escribió:
>
>the canary would need to be declared
>volatile or gcc will optimize it out.
Yes, indeed. I discovered it the hard way after applying Julia's suggestion :(
Thanks.
BTW, I used the DIVIDE_BY_ZERO macro because Coccinelle was failing
when inline assembly was used, like this:
--------8<-------------8<----------8<------------8<-------
init_defs_builtins: /usr/lib/coccinelle/standard.h
-----------------------------------------------------------------------
processing semantic patch file: ssp3.cocci
with isos from: /usr/lib/coccinelle/standard.iso
-----------------------------------------------------------------------
@@
identifier fn;
fresh identifier canary = "canary_";
@@
fn (...)
{
+ volatile int canary = 0xdeadbeef;
<...
+ if ((canary ^ 0xdeadbeef) != 0)
+ asm volatile ("divl %0"::"r"(0):"eax","edx");
return ...;
...>
}
162 170
Fatal error: exception Failure("plus: parse error: \n = File \"ssp3.cocci\",
line 10, column 11, charpos = 162\n around = 'volatile', whole content = +
asm volatile (\"divl %0\"::\"r\"(0):\"eax\",\"edx\");\n")
--------8<-------------8<----------8<------------8<-------
Is it because I'm using GCC extensions?
Regards,
Diego.
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci