home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / lzop-1.00.tar.gz / lzop-1.00.tar / lzop-1.00 / acconfig / m4 / gccbugsr.m4 < prev    next >
Text File  |  1998-04-20  |  1KB  |  38 lines

  1. ## --------------------------------------------------------- ##
  2. ## Check if gcc suffers the '-fstrength-reduce' bug.         ##
  3. ## --------------------------------------------------------- ##
  4.  
  5. # serial 1
  6.  
  7. AC_DEFUN(mfx_PROG_GCC_BUG_STRENGTH_REDUCE,
  8. [AC_REQUIRE([AC_PROG_CC])dnl
  9. AC_REQUIRE([AC_PROG_CPP])dnl
  10. if test "$ac_cv_prog_gcc" = yes; then
  11. mfx_save_cflags="$CFLAGS"
  12. CFLAGS="$CFLAGS -O2 -fstrength-reduce"
  13. AC_CACHE_CHECK(whether ${CC-cc} suffers the -fstrength-reduce bug,
  14. mfx_cv_prog_gcc_bug_strength_reduce,
  15. [AC_TRY_RUN([
  16. /* gcc strength-reduce optimization bug on Intel platforms.
  17.  * Adapted from bug-report by John E. Davis <davis@space.mit.edu>
  18.  * Compile and run it using gcc -O2 -fno-strength-reduce and
  19.  * gcc -O2 -fstrength-reduce.
  20.  */
  21. int a[3];
  22. unsigned an = 3;
  23. int strength_reduce_bug();
  24. main() {
  25.   unsigned j;
  26.   for (j = 0; j < an; j++)
  27.     a[j] = (int)j - 3;
  28.   exit(strength_reduce_bug() ? 1 : 0);
  29. }
  30. int strength_reduce_bug()
  31. { return a[0] != -3 || a[1] != -2 || a[2] != -1; }],
  32. mfx_cv_prog_gcc_bug_strength_reduce=no,
  33. mfx_cv_prog_gcc_bug_strength_reduce=yes,
  34. mfx_cv_prog_gcc_bug_strength_reduce=unknown)])
  35. CFLAGS="$mfx_save_cflags"
  36. fi
  37. ])
  38.