summaryrefslogtreecommitdiff
path: root/src/htscoremain.c
diff options
context:
space:
mode:
authorXavier Roche <xroche@users.noreply.github.com>2013-08-25 09:51:38 +0000
committerXavier Roche <xroche@users.noreply.github.com>2013-08-25 09:51:38 +0000
commitd4453441f12a26c273c6bd8bcfa1b3f76889a884 (patch)
tree02edd11196cc5dc9c1f47812faa840e09ba260a0 /src/htscoremain.c
parent96e6c1e20546e9b1130e4662288a107ef6a4db00 (diff)
The crash test has two stack levels (for etsting purpose)
Diffstat (limited to 'src/htscoremain.c')
-rw-r--r--src/htscoremain.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/htscoremain.c b/src/htscoremain.c
index 3910157..044e720 100644
--- a/src/htscoremain.c
+++ b/src/htscoremain.c
@@ -105,6 +105,19 @@ extern int IPV6_resolver;
} \
} while(0)
+#ifdef HTS_CRASH_TEST
+static __attribute__ ((noinline)) void fourty_two(void) {
+ char *const ptr = (char*) (uintptr_t) 0x42;
+ (*ptr)++;
+}
+static __attribute__ ((noinline)) void do_really_crash(void) {
+ fourty_two();
+}
+static __attribute__ ((noinline)) void do_crash(void) {
+ do_really_crash();
+}
+#endif
+
HTSEXT_API int hts_main(int argc, char **argv) {
httrackp *opt = hts_create_opt();
int ret = hts_main2(argc, argv, opt);
@@ -2607,10 +2620,7 @@ HTSEXT_API int hts_main2(int argc, char **argv, httrackp * opt) {
#ifdef HTS_CRASH_TEST
case 'c': /* crash test */
- {
- char *const ptr = (char*) (uintptr_t) 0x42;
- (*ptr)++;
- }
+ do_crash();
break;
#endif