Re: [PATCH v2] compiler: prevent dead store elimination

2010-03-02 Thread Andi Kleen
+ do {\ + struct __scrub { typeof(*p) c[n]; };\ The typeof(*p) suggestion doesn't work. It would require p to always be a pointer type with an accurate (for memset) sizeof(*p). In general however we'll memset some array described

Re: [PATCH v2] compiler: prevent dead store elimination

2010-03-02 Thread Andi Kleen
+#define ARRAY_PREVENT_DSE(p, n) Who says the Intel compiler doesn't need this? There was a comment in include/linux/compiler-intel.h that it's not supported. That's true for the ia64 version, but not for the x86 version which supports gcc compatible inline assembler. So on x86 you

Re: [PATCH v2] compiler: prevent dead store elimination

2010-03-01 Thread Mikael Pettersson
Roel Kluin writes: Due to optimization A call to memset() may be removed as a dead store when ___^ lower-case a the buffer is not used after its value is overwritten. The new function secure_bzero() ensures a section of memory is padded with zeroes. From the GCC

[PATCH v2] compiler: prevent dead store elimination

2010-02-28 Thread Roel Kluin
Due to optimization A call to memset() may be removed as a dead store when the buffer is not used after its value is overwritten. The new function secure_bzero() ensures a section of memory is padded with zeroes. From the GCC manual, section 5.37: If your assembler instructions access memory in