- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
#include <stdio.h>
#include <stddef.h>
#include <stdlib.h>
#include <limits.h>
int gcc_rtm_virt_test(int a, int(*f)(int, int(*)(), float*), float fa[static (-1,0,1)]) {
short s = sizeof (short) + sizeof 0;
char b[12] = "0123456789";
for (long ll = sizeof b; ll -= 4;) {
b[ll] = '0';
b[ll-1] = '1';
b[ll-2] = '2';
b[ll-3] = '3';
}
return s - ((1 << 2) - (b[0] - '2'));
}
int gcc_rtm_cf32(int(*f0)(), int(*f1)()) {
ptrdiff_t d = f1 - f0;
// guess you know what you're doing
if (! (d >> sizeof (ptrdiff_t) * CHAR_BIT - 1)) {
while (d--) {
switch(*(unsigned short*)(f0 + d)) {
case 0xc3c9:
return 0;
case 0xb8:
if (!*(unsigned int*)(f0 + d + 1)) {
return 1;
}
break;
case 0xC031:
return 2;
}
}
return -1;
};
return -2;
}
int main() {
switch (gcc_rtm_cf32(gcc_rtm_virt_test, gcc_rtm_cf32)) {
case -1:
fprintf(stderr, "Hey, added smth. special? Maybe -Og? \n"), abort();
break;
case 0:
fprintf(stderr, "Hey, -O0 smells like a dead rat.. check your flags!\n"), abort();
break;
case 1:
fprintf(stderr, "Hey, -O1 is still not allowed.. Would you do better?\n"), abort();
break;
case 2:
fprintf(stdout, "Hey, finally you've captured [-O2 || -O3 || -Ofast || -Os] flag!");
break;
default:
fprintf(stderr, "Hey, looks like you've got impl. defined crap, check PTRDIFF_T stuff.. \n"), abort();
break;
};
}
И далее по тексту..gcc'шники опять обкурились в рантайме. Зачэм так делоть, это прикольно?