Module Name: src Committed By: kamil Date: Sun May 27 17:16:39 UTC 2018
Modified Files: src/tests/lib/libc/sys: t_ptrace_wait.h Log Message: Try to fool $CC harder in ATF ptrace(2) tests in trigger_fpe() A function that returns a value that is not used, can be optimized out by a compiler. Try to fool the compiler with calling libc functions that shall trigger a division by zero crash. Sponsored by <The NetBSD Foundation> To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/tests/lib/libc/sys/t_ptrace_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/lib/libc/sys/t_ptrace_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_wait.h:1.8 src/tests/lib/libc/sys/t_ptrace_wait.h:1.9 --- src/tests/lib/libc/sys/t_ptrace_wait.h:1.8 Sat May 26 15:15:17 2018 +++ src/tests/lib/libc/sys/t_ptrace_wait.h Sun May 27 17:16:39 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_wait.h,v 1.8 2018/05/26 15:15:17 kamil Exp $ */ +/* $NetBSD: t_ptrace_wait.h,v 1.9 2018/05/27 17:16:39 kamil Exp $ */ /*- * Copyright (c) 2016 The NetBSD Foundation, Inc. @@ -554,17 +554,14 @@ trigger_ill(void) #endif } -static int __used +static void __used trigger_fpe(void) { - static volatile int a = 1; - static volatile int b = 0; - static volatile int c; + volatile int a = getpid(); + volatile int b = atoi("0"); /* Division by zero causes CPU trap, translated to SIGFPE */ - c = a / b; - - return c; + usleep(a / b); } static void __used