X-Git-Url: https://pd.if.org/git/?p=lice;a=blobdiff_plain;f=tests%2Freturnaddr.c;fp=tests%2Freturnaddr.c;h=f4c2cc07cfae75eee05d9f7d94990bd262cd0913;hp=0000000000000000000000000000000000000000;hb=946bdbe1d5dd89ab671391fbe429a1c2c48ecaa7;hpb=f1abb26903687c7967cf37c3f6c830051bdeb371 diff --git a/tests/returnaddr.c b/tests/returnaddr.c new file mode 100644 index 0000000..f4c2cc0 --- /dev/null +++ b/tests/returnaddr.c @@ -0,0 +1,25 @@ +// __builtin_return_address + +static void *a(void) { + return __builtin_return_address(1); +} + +static void *b(void) { + expecti(__builtin_return_address(0), a()); + return __builtin_return_address(0); +} + +static void *c(void) { +_1: + void *this = b(); +_2: + expecti((&&_1 < this && this <= &&_2), 1); + + return this; +} + +int main(void) { + expecti(c() <= b(), 1); + + return 0; +}