[x86/Linux] Fix indirection of non-volatile null pointer will be deleted (dotnet...
authorSaeHie Park <saehie.park@gmail.com>
Mon, 5 Dec 2016 07:45:38 +0000 (16:45 +0900)
committerJan Kotas <jkotas@microsoft.com>
Mon, 5 Dec 2016 07:45:38 +0000 (23:45 -0800)
Fix compile error for x86/Linux
- fix error "indirection of non-volatile null pointer will be deleted, not trap [-Werror,-Wnull-dereference]"
- using clang 3.8

Commit migrated from https://github.com/dotnet/coreclr/commit/9f84a04da21622944a96b2e77d3330910f5af263

src/coreclr/src/vm/i386/gmsx86.cpp

index e7e16b7..a7afcb9 100644 (file)
@@ -1108,7 +1108,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
                     goto again;
                 }
 #ifndef _PREFIX_
-                *((int*) 0) = 1;        // If you get at this error, it is because yout
+                *((volatile int*) 0) = 1; // If you get at this error, it is because yout
                                         // set a breakpoint in a helpermethod frame epilog
                                         // you can't do that unfortunately.  Just move it
                                         // into the interior of the method to fix it  
@@ -1225,7 +1225,7 @@ void LazyMachState::unwindLazyState(LazyMachState* baseState,
                 // FIX what to do here?
 #ifndef DACCESS_COMPILE
 #ifndef _PREFIX_
-                *((unsigned __int8**) 0) = ip;  // cause an access violation (Free Build assert)
+                *((volatile PTR_BYTE*) 0) = ip;  // cause an access violation (Free Build assert)
 #endif // !_PREFIX_                            
 #else
                 DacNotImpl();