]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Ported this test to ppc.
authorBart Van Assche <bvanassche@acm.org>
Thu, 26 Feb 2009 17:50:14 +0000 (17:50 +0000)
committerBart Van Assche <bvanassche@acm.org>
Thu, 26 Feb 2009 17:50:14 +0000 (17:50 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@9275

none/tests/faultstatus.c

index 97d1f3741c50fa0559f3caf56073b8ef128db3d9..ebf7147ded797bd8e9b48b0f5b84d1da8b43f153 100644 (file)
@@ -9,6 +9,19 @@
 #include <sys/mman.h>
 #include <unistd.h>
 
+/*
+ * Division by zero triggers a SIGFPE on x86 and x86_64,
+ * but not on the PowerPC architecture.
+ */
+#if defined(__powerpc__)
+#define DIVISION_BY_ZERO_TRIGGERS_FPE 0
+#define DIVISION_BY_ZERO_SI_CODE      SI_TKILL
+#else
+#define DIVISION_BY_ZERO_TRIGGERS_FPE 1
+#define DIVISION_BY_ZERO_SI_CODE      FPE_INTDIV
+#endif
+
+
 struct test {
        void (*test)(void);
        int sig;
@@ -93,6 +106,9 @@ static void test4()
        volatile int v = 44/zero();
 
        (void)v;
+#if DIVISION_BY_ZERO_TRIGGERS_FPE == 0
+       raise(SIGFPE);
+#endif
 }
 
 int main()
@@ -125,7 +141,7 @@ int main()
                        T(1, SIGSEGV,   SEGV_MAPERR,    BADADDR),
                        T(2, SIGSEGV,   SEGV_ACCERR,    mapping),
                        T(3, SIGBUS,    BUS_ADRERR,     &mapping[FILESIZE+10]),
-                       T(4, SIGFPE,    FPE_INTDIV,     0),
+                       T(4, SIGFPE,    DIVISION_BY_ZERO_SI_CODE, 0),
 #undef T
                };