8230ff782d
This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/gcc.git#ac8f498836cb54282caf6ee9c6bb0c179029c18c
35 lines
589 B
C
35 lines
589 B
C
extern void *malloc (__SIZE_TYPE__) __attribute__((malloc,transaction_safe));
|
|
|
|
static int __attribute__((transaction_safe))
|
|
something (void)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
struct large { int foo[500]; };
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
int *p;
|
|
struct large *lp;
|
|
|
|
__transaction_atomic {
|
|
p = malloc (sizeof (*p) * 100);
|
|
lp = malloc (sizeof (*lp) * 100);
|
|
|
|
/* No instrumentation necessary; P and LP are transaction local. */
|
|
p[5] = 123;
|
|
lp->foo[66] = 123;
|
|
|
|
if (something ())
|
|
__transaction_cancel;
|
|
}
|
|
|
|
__transaction_relaxed {
|
|
++p[5];
|
|
}
|
|
|
|
return ( (p[5] == 124) ? 0 : 1 );
|
|
}
|