From 3b8eeb2f7b1679f20d5906596e8edce4685f7986 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Fri, 11 Mar 2022 18:38:37 +0100 Subject: [PATCH] Pass -fwrapv option to compiler espeak source code uses signed integer wrapping (e.g. wavephase in wavegen.c's Wavegen). It happens that this is undefined behavior, so a compiler would be free optimize away various situations... Fortunately gcc has an -fwrapv option to make signed integer wrapping defined. Options would be needed for other compilers. --- configure.ac | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/configure.ac b/configure.ac index 31cd1281..5df50ec9 100644 --- a/configure.ac +++ b/configure.ac @@ -311,6 +311,15 @@ AX_CHECK_COMPILE_FLAG([-Wuninitialized], [CFLAGS="-Wuninitialized $CFLAG AX_CHECK_COMPILE_FLAG([-Wunused], [CFLAGS="-Wunused $CFLAGS"]) AX_CHECK_COMPILE_FLAG([-Wunused-parameter], [CFLAGS="-Wunused-parameter $CFLAGS"]) + +dnl ================================================================ +dnl Enable two-complement signed integer wrapping +dnl +dnl Otherwise this is undefined behavior. +dnl ================================================================ + +AX_CHECK_COMPILE_FLAG([-fwrapv], [CFLAGS="-fwrapv $CFLAGS"]) + dnl ================================================================ dnl libFuzzer checks. dnl ================================================================