While input parameters to asm blocks are expressions (not lvalues), they cannot (safely) be modified within the asm code unless they are also listed as outputs. While this may appear to work, code that comes *after* the asm block may fail.

dw
Index: mingw-w64-headers/include/psdk_inc/intrin-mac.h
===================================================================
--- mingw-w64-headers/include/psdk_inc/intrin-mac.h     (revision 5928)
+++ mingw-w64-headers/include/psdk_inc/intrin-mac.h     (working copy)
@@ -15,11 +15,13 @@
    FunctionName: Any valid function name
    DataType: BYTE, WORD, DWORD or DWORD64 */
 
+/* While we don't need the output values for Dest or Count, we
+   must still inform the compiler the asm changes them. */
 #define __buildstos(x, y) void x(y *Dest, y Data, size_t Count) \
 { \
    __asm__ __volatile__ ("rep stos%z[Data]" \
-      :  /* no outputs */ \
-      : "D" (Dest), "c" (Count), [Data] "a" (Data) \
+      : "+D" (Dest), "+c" (Count) \
+      : [Data] "a" (Data) \
       : "memory"); \
 }
 
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to