[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [csmith-dev] Combined use of csmith_minimal.h and safe_math_macros.h

Hi Tahina,

I am fine with the approach that you proposed in your patch. Thanks!

- Yang

On 11/04/2015 10:47 AM, Tahina Ramananandro wrote:
Dear Csmith developers,

I am using Csmith 2.2.0 (git dcef52) and preprocessing/compiling the C files produced by Csmith with -DCSMITH_MINIMAL to use csmith_minimal.h instead of the definitions of csmith.h, thus reducing the set of included functions to the minimum (in particular by not requiring too many standard header files). However, such a file will still include safe_math.h whereas I claim it can be replaced with safe_math_macros.h thus further reducing the set of included functions (in particular if the C source file was generated by Csmith with --no-safe-math).

By reading random_inc.h, it seems that USE_MATH_MACROS can be used alone to replace safe_math.h with safe_math_macros.h, but when used with CSMITH_MINIMAL, it becomes inoperant. To solve this issue and allow the combined use of USE_MATH_MACROS and CSMITH_MINIMAL, I attached a patch for csmith_minimal.h following the same pattern as in random_inc.h.

Is my understanding of these preprocessing symbols correct? Are they stable enough (even though not extensively documented) to be used in practice?
If so, do you think this patch is worth considering for inclusion?

(As an alternative to my patch proposal, you might prefer handling USE_MATH_MACROS from within safe_math.h to "redirect" the preprocessor to safe_math_minimal.h, in the same way as CSMITH_MINIMAL being handled from within csmith.h to "redirect" to csmith_minimal.h, thus avoiding the duplication of compilation directives from random_inc.h to csmith_minimal.h)

Thank you in advance for your help.
Best regards,

Tahina Oliver Ramananandro, Ph. D.
Senior Engineer, Advanced Compilers and Formal Verification
Reservoir Labs, Inc.
632 Broadway, Suite 803
New York, NY 10012
Phone: +1 (212) 780-0527 ext. 157