1.1 --- a/src/share/vm/runtime/sharedRuntimeTrig.cpp Tue May 04 12:25:39 2010 -0700 1.2 +++ b/src/share/vm/runtime/sharedRuntimeTrig.cpp Tue May 11 14:35:43 2010 -0700 1.3 @@ -41,6 +41,26 @@ 1.4 # pragma optimize ( "", off ) 1.5 #endif 1.6 1.7 +/* The above workaround now causes more problems with the latest MS compiler. 1.8 + * Visual Studio 2010's /GS option tries to guard against buffer overruns. 1.9 + * /GS is on by default if you specify optimizations, which we do globally 1.10 + * via /W3 /O2. However the above selective turning off of optimizations means 1.11 + * that /GS issues a warning "4748". And since we treat warnings as errors (/WX) 1.12 + * then the compilation fails. There are several possible solutions 1.13 + * (1) Remove that pragma above as obsolete with VS2010 - requires testing. 1.14 + * (2) Stop treating warnings as errors - would be a backward step 1.15 + * (3) Disable /GS - may help performance but you lose the security checks 1.16 + * (4) Disable the warning with "#pragma warning( disable : 4748 )" 1.17 + * (5) Disable planting the code with __declspec(safebuffers) 1.18 + * I've opted for (5) although we should investigate the local performance 1.19 + * benefits of (1) and global performance benefit of (3). 1.20 + */ 1.21 +#if defined(WIN32) && (defined(_MSC_VER) && (_MSC_VER >= 1600)) 1.22 +#define SAFEBUF __declspec(safebuffers) 1.23 +#else 1.24 +#define SAFEBUF 1.25 +#endif 1.26 + 1.27 #include <math.h> 1.28 1.29 // VM_LITTLE_ENDIAN is #defined appropriately in the Makefiles 1.30 @@ -235,7 +255,7 @@ 1.31 two24B = 1.67772160000000000000e+07, /* 0x41700000, 0x00000000 */ 1.32 twon24 = 5.96046447753906250000e-08; /* 0x3E700000, 0x00000000 */ 1.33 1.34 -static int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) { 1.35 +static SAFEBUF int __kernel_rem_pio2(double *x, double *y, int e0, int nx, int prec, const int *ipio2) { 1.36 int jz,jx,jv,jp,jk,carry,n,iq[20],i,j,k,m,q0,ih; 1.37 double z,fw,f[20],fq[20],q[20]; 1.38 1.39 @@ -451,7 +471,7 @@ 1.40 pio2_3 = 2.02226624871116645580e-21, /* 0x3BA3198A, 0x2E000000 */ 1.41 pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ 1.42 1.43 -static int __ieee754_rem_pio2(double x, double *y) { 1.44 +static SAFEBUF int __ieee754_rem_pio2(double x, double *y) { 1.45 double z,w,t,r,fn; 1.46 double tx[3]; 1.47 int e0,i,j,nx,n,ix,hx,i0;