Skip to content

Instantly share code, notes, and snippets.

@BeMg
Last active April 1, 2020 05:47
Show Gist options
  • Save BeMg/2c94b2d8b391a0cb4e1567b95993803c to your computer and use it in GitHub Desktop.
Save BeMg/2c94b2d8b391a0cb4e1567b95993803c to your computer and use it in GitHub Desktop.
RSRF test case
struct S { int s; unsigned long t; };
__attribute__ ((noinline, noclone)) unsigned long long
bar (struct S *x, unsigned long y)
{
return x->s + y;
}
__attribute__ ((noinline, noclone)) unsigned long long
foo (struct S *x, unsigned long y)
{
unsigned long a;
if (__builtin_expect (((__UINTPTR_TYPE__) (x) + 0x1000U < 0x2000U), 0))
return ~0ULL;
if (__builtin_expect (x->s <= 0 || x->s > 9, 0))
return ~0ULL;
a = x->t >> 12;
if (y == a)
return ~0ULL;
if (x->s == 3)
return x->t + y * 4096;
return bar (x, y);
}
/* Check that floating point casts of integer operations don't ICE. */
/* The first of these routines caused problems for a patch, that wasn't
otherwise caught by a full bootstrap, the regression test suite or
SPEC CPU2000. */
double
andop (unsigned int x)
{
return x & 1;
}
double
orop (unsigned int x)
{
return x | 1;
}
double
notop (unsigned int x)
{
return ~x;
}
extern int foo ();
int bar ()
{
return foo ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment