// filename:c2011-F-9-1-ex.c // original examples and/or notes: // (c) ISO/IEC JTC1 SC22 WG14 N1570, April 12, 2011 // C2011 F.9.1 Global transformations // compile and output mechanism: // (c) Ogawa Kiyoshi, kaizen@gifu-u.ac.jp, December.29, 2013 // compile errors and/or wornings: // (c) Apple LLVM version 4.2 (clang-425.0.27) (based on LLVM 3.2svn) // Target: x86_64-apple-darwin11.4.2 //Thread model: posix // (c) LLVM 2003-2009 University of Illinois at Urbana-Champaign. #include #include // Example #include #pragma STDC FENV_ACCESS ON void f(double x) { int n; /* ... */ for (int i = 0; i < n; i++) x + 1; /* ... */ printf("%d %lf \n",n,x); } int main(void) { int n; double x; f(9); if (0 < n) x + 1; printf("%d %lf \n",n,x); return printf("F.9.1 Global transformations\n"); } // warning may be // c2011-F-9-1-ex.c:15:14: warning: pragma STDC FENV_ACCESS ON is not supported, ignoring pragma [-Wunknown-pragmas] // #pragma STDC FENV_ACCESS ON // ^ // c2011-F-9-1-ex.c:20:31: warning: expression result unused [-Wunused-value] // for (int i = 0; i < n; i++) x + 1; // ~ ^ ~ // c2011-F-9-1-ex.c:28:15: warning: expression result unused [-Wunused-value] // if (0 < n) x + 1; // ~ ^ ~ // 3 warnings generated. // output may be // -1038565372 9.000000 //left value are changing // 1847459929 0.000000 // left value are changing // F.9.1 Global transformations