Index: trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/PDMCritSect.cpp	(revision 62644)
@@ -54,4 +54,5 @@
 int pdmR3CritSectBothInitStats(PVM pVM)
 {
+    RT_NOREF_PV(pVM);
     STAM_REG(pVM, &pVM->pdm.s.StatQueuedCritSectLeaves, STAMTYPE_COUNTER, "/PDM/QueuedCritSectLeaves", STAMUNIT_OCCURENCES,
              "Number of times a critical section leave request needed to be queued for ring-3 execution.");
@@ -154,4 +155,5 @@
         if (pszName)
         {
+            RT_SRC_POS_NOREF();
 #ifndef PDMCRITSECT_STRICT
             pCritSect->Core.pValidatorRec = NULL;
@@ -246,4 +248,5 @@
                 pCritSect->Core.pValidatorRead  = NULL;
                 pCritSect->Core.pValidatorWrite = NULL;
+                RT_SRC_POS_NOREF();
 #ifdef PDMCRITSECTRW_STRICT
 # ifdef RT_LOCK_STRICT_ORDER
Index: trunk/src/VBox/VMM/VMMR3/PGM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/PGM.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/PGM.cpp	(revision 62644)
@@ -2166,5 +2166,5 @@
 VMMR3DECL(int) PGMR3InitFinalize(PVM pVM)
 {
-    int rc;
+    int rc = VERR_IPE_UNINITIALIZED_STATUS; /* (MSC incorrectly thinks it can be usused uninitialized) */
 
     /*
@@ -4208,22 +4208,22 @@
      */
     int cErrors = 0;
-    const static PGMCHECKINTARGS s_LeftToRight = {  true, NULL, NULL, NULL, pVM };
-    const static PGMCHECKINTARGS s_RightToLeft = { false, NULL, NULL, NULL, pVM };
-    PGMCHECKINTARGS Args = s_LeftToRight;
+    const PGMCHECKINTARGS LeftToRight = {  true, NULL, NULL, NULL, pVM };
+    const PGMCHECKINTARGS RightToLeft = { false, NULL, NULL, NULL, pVM };
+    PGMCHECKINTARGS Args = LeftToRight;
     cErrors += RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers,       true,  pgmR3CheckIntegrityPhysHandlerNode, &Args);
-    Args = s_RightToLeft;
+    Args = RightToLeft;
     cErrors += RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysHandlers,       false, pgmR3CheckIntegrityPhysHandlerNode, &Args);
 #ifdef VBOX_WITH_RAW_MODE
-    Args = s_LeftToRight;
+    Args = LeftToRight;
     cErrors += RTAvlroGCPtrDoWithAll( &pVM->pgm.s.pTreesR3->VirtHandlers,       true,  pgmR3CheckIntegrityVirtHandlerNode, &Args);
-    Args = s_RightToLeft;
+    Args = RightToLeft;
     cErrors += RTAvlroGCPtrDoWithAll( &pVM->pgm.s.pTreesR3->VirtHandlers,       false, pgmR3CheckIntegrityVirtHandlerNode, &Args);
-    Args = s_LeftToRight;
+    Args = LeftToRight;
     cErrors += RTAvlroGCPtrDoWithAll( &pVM->pgm.s.pTreesR3->HyperVirtHandlers,  true,  pgmR3CheckIntegrityVirtHandlerNode, &Args);
-    Args = s_RightToLeft;
+    Args = RightToLeft;
     cErrors += RTAvlroGCPtrDoWithAll( &pVM->pgm.s.pTreesR3->HyperVirtHandlers,  false, pgmR3CheckIntegrityVirtHandlerNode, &Args);
-    Args = s_LeftToRight;
+    Args = LeftToRight;
     cErrors += RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysToVirtHandlers, true,  pgmR3CheckIntegrityPhysToVirtHandlerNode, &Args);
-    Args = s_RightToLeft;
+    Args = RightToLeft;
     cErrors += RTAvlroGCPhysDoWithAll(&pVM->pgm.s.pTreesR3->PhysToVirtHandlers, false, pgmR3CheckIntegrityPhysToVirtHandlerNode, &Args);
 #endif /* VBOX_WITH_RAW_MODE */
Index: trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/PGMPhys.cpp	(revision 62644)
@@ -1252,6 +1252,6 @@
                             && PGM_PAGE_IS_FT_DIRTY(pPage))
                         {
-                            unsigned       cbPageRange = PAGE_SIZE;
-                            unsigned       iPageClean  = iPage + 1;
+                            uint32_t       cbPageRange = PAGE_SIZE;
+                            uint32_t       iPageClean  = iPage + 1;
                             RTGCPHYS       GCPhysPage  = pRam->GCPhys + iPage * PAGE_SIZE;
                             uint8_t       *pu8Page     = NULL;
@@ -1285,8 +1285,6 @@
                             }
 
-                            for (iPage; iPage < iPageClean; iPage++)
-                                PGM_PAGE_CLEAR_FT_DIRTY(&pRam->aPages[iPage]);
-
-                            iPage = iPageClean - 1;
+                            for (uint32_t iTmp = iPage; iTmp < iPageClean; iTmp++)
+                                PGM_PAGE_CLEAR_FT_DIRTY(&pRam->aPages[iTmp]);
                         }
                         break;
@@ -1509,5 +1507,5 @@
     PPGMRAMRANGE pRam = (PPGMRAMRANGE)pvUser;
     Assert(pRam->fFlags & PGM_RAM_RANGE_FLAGS_FLOATING);
-    Assert(pRam->pSelfRC == GCPtrOld + PAGE_SIZE);
+    Assert(pRam->pSelfRC == GCPtrOld + PAGE_SIZE); RT_NOREF_PV(GCPtrOld);
 
     switch (enmMode)
@@ -2542,73 +2540,75 @@
     if (RT_SUCCESS(rc))
     {
-        void *pvPages;
         PSUPPAGE paPages = (PSUPPAGE)RTMemTmpAlloc(cPages * sizeof(SUPPAGE));
         if (RT_SUCCESS(rc))
+        {
+            void *pvPages;
             rc = SUPR3PageAllocEx(cPages, 0 /*fFlags*/, &pvPages, NULL /*pR0Ptr*/, paPages);
-        if (RT_SUCCESS(rc))
-        {
-            memset(pvPages, 0, cPages * PAGE_SIZE);
-
-            /*
-             * Create the MMIO2 range record for it.
-             */
-            const size_t cbRange = RT_OFFSETOF(PGMMMIO2RANGE, RamRange.aPages[cPages]);
-            PPGMMMIO2RANGE pNew;
-            rc = MMR3HyperAllocOnceNoRel(pVM, cbRange, 0, MM_TAG_PGM_PHYS, (void **)&pNew);
-            AssertLogRelMsgRC(rc, ("cbRamRange=%zu\n", cbRange));
             if (RT_SUCCESS(rc))
             {
-                pNew->pDevInsR3             = pDevIns;
-                pNew->pvR3                  = pvPages;
-                //pNew->pNext               = NULL;
-                //pNew->fMapped             = false;
-                //pNew->fOverlapping        = false;
-                pNew->iRegion               = iRegion;
-                pNew->idSavedState          = UINT8_MAX;
-                pNew->idMmio2               = idMmio2;
-                pNew->RamRange.pSelfR0      = MMHyperCCToR0(pVM, &pNew->RamRange);
-                pNew->RamRange.pSelfRC      = MMHyperCCToRC(pVM, &pNew->RamRange);
-                pNew->RamRange.GCPhys       = NIL_RTGCPHYS;
-                pNew->RamRange.GCPhysLast   = NIL_RTGCPHYS;
-                pNew->RamRange.pszDesc      = pszDesc;
-                pNew->RamRange.cb           = cb;
-                pNew->RamRange.fFlags       = PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO2;
-                pNew->RamRange.pvR3         = pvPages;
-                //pNew->RamRange.paLSPages    = NULL;
-
-                uint32_t iPage = cPages;
-                while (iPage-- > 0)
+                memset(pvPages, 0, cPages * PAGE_SIZE);
+
+                /*
+                 * Create the MMIO2 range record for it.
+                 */
+                const size_t cbRange = RT_OFFSETOF(PGMMMIO2RANGE, RamRange.aPages[cPages]);
+                PPGMMMIO2RANGE pNew;
+                rc = MMR3HyperAllocOnceNoRel(pVM, cbRange, 0, MM_TAG_PGM_PHYS, (void **)&pNew);
+                AssertLogRelMsgRC(rc, ("cbRamRange=%zu\n", cbRange));
+                if (RT_SUCCESS(rc))
                 {
-                    PGM_PAGE_INIT(&pNew->RamRange.aPages[iPage],
-                                  paPages[iPage].Phys,
-                                  PGM_MMIO2_PAGEID_MAKE(idMmio2, iPage),
-                                  PGMPAGETYPE_MMIO2, PGM_PAGE_STATE_ALLOCATED);
+                    pNew->pDevInsR3             = pDevIns;
+                    pNew->pvR3                  = pvPages;
+                    //pNew->pNext               = NULL;
+                    //pNew->fMapped             = false;
+                    //pNew->fOverlapping        = false;
+                    pNew->iRegion               = iRegion;
+                    pNew->idSavedState          = UINT8_MAX;
+                    pNew->idMmio2               = idMmio2;
+                    pNew->RamRange.pSelfR0      = MMHyperCCToR0(pVM, &pNew->RamRange);
+                    pNew->RamRange.pSelfRC      = MMHyperCCToRC(pVM, &pNew->RamRange);
+                    pNew->RamRange.GCPhys       = NIL_RTGCPHYS;
+                    pNew->RamRange.GCPhysLast   = NIL_RTGCPHYS;
+                    pNew->RamRange.pszDesc      = pszDesc;
+                    pNew->RamRange.cb           = cb;
+                    pNew->RamRange.fFlags       = PGM_RAM_RANGE_FLAGS_AD_HOC_MMIO2;
+                    pNew->RamRange.pvR3         = pvPages;
+                    //pNew->RamRange.paLSPages    = NULL;
+
+                    uint32_t iPage = cPages;
+                    while (iPage-- > 0)
+                    {
+                        PGM_PAGE_INIT(&pNew->RamRange.aPages[iPage],
+                                      paPages[iPage].Phys,
+                                      PGM_MMIO2_PAGEID_MAKE(idMmio2, iPage),
+                                      PGMPAGETYPE_MMIO2, PGM_PAGE_STATE_ALLOCATED);
+                    }
+
+                    /* update page count stats */
+                    pVM->pgm.s.cAllPages     += cPages;
+                    pVM->pgm.s.cPrivatePages += cPages;
+
+                    /*
+                     * Link it into the list.
+                     * Since there is no particular order, just push it.
+                     */
+                    /** @todo we can save us the linked list now, just search the lookup table... */
+                    pgmLock(pVM);
+                    Assert(pVM->pgm.s.apMmio2RangesR3[idMmio2 - 1] == NULL);
+                    Assert(pVM->pgm.s.apMmio2RangesR0[idMmio2 - 1] == NIL_RTR0PTR);
+                    pNew->pNextR3 = pVM->pgm.s.pMmio2RangesR3;
+                    pVM->pgm.s.pMmio2RangesR3 = pNew;
+                    pVM->pgm.s.apMmio2RangesR3[idMmio2 - 1] = pNew;
+                    pVM->pgm.s.apMmio2RangesR0[idMmio2 - 1] = MMHyperCCToR0(pVM, pNew);
+                    pgmUnlock(pVM);
+
+                    *ppv = pvPages;
+                    RTMemTmpFree(paPages);
+                    pgmPhysInvalidatePageMapTLB(pVM);
+                    return VINF_SUCCESS;
                 }
 
-                /* update page count stats */
-                pVM->pgm.s.cAllPages     += cPages;
-                pVM->pgm.s.cPrivatePages += cPages;
-
-                /*
-                 * Link it into the list.
-                 * Since there is no particular order, just push it.
-                 */
-                /** @todo we can save us the linked list now, just search the lookup table... */
-                pgmLock(pVM);
-                Assert(pVM->pgm.s.apMmio2RangesR3[idMmio2 - 1] == NULL);
-                Assert(pVM->pgm.s.apMmio2RangesR0[idMmio2 - 1] == NIL_RTR0PTR);
-                pNew->pNextR3 = pVM->pgm.s.pMmio2RangesR3;
-                pVM->pgm.s.pMmio2RangesR3 = pNew;
-                pVM->pgm.s.apMmio2RangesR3[idMmio2 - 1] = pNew;
-                pVM->pgm.s.apMmio2RangesR0[idMmio2 - 1] = MMHyperCCToR0(pVM, pNew);
-                pgmUnlock(pVM);
-
-                *ppv = pvPages;
-                RTMemTmpFree(paPages);
-                pgmPhysInvalidatePageMapTLB(pVM);
-                return VINF_SUCCESS;
+                SUPR3PageFreeEx(pvPages, cPages);
             }
-
-            SUPR3PageFreeEx(pvPages, cPages);
         }
         RTMemTmpFree(paPages);
Index: trunk/src/VBox/VMM/VMMR3/SELM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/SELM.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/SELM.cpp	(revision 62644)
@@ -2040,4 +2040,6 @@
         return false;
     }
+#  else
+    RT_NOREF_PV(pVM);
 #  endif
     return true;
@@ -2500,10 +2502,16 @@
  * @param   pszMsg  Message to prepend the log entry with.
  */
-VMMR3DECL(void) SELMR3DumpDescriptor(X86DESC  Desc, RTSEL Sel, const char *pszMsg)
-{
-    char szOutput[128];
-    selmR3FormatDescriptor(Desc, Sel, &szOutput[0], sizeof(szOutput));
-    Log(("%s: %s\n", pszMsg, szOutput));
-    NOREF(szOutput[0]);
+VMMR3DECL(void) SELMR3DumpDescriptor(X86DESC Desc, RTSEL Sel, const char *pszMsg)
+{
+#ifdef LOG_ENABLED
+    if (LogIsEnabled())
+    {
+        char szOutput[128];
+        selmR3FormatDescriptor(Desc, Sel, &szOutput[0], sizeof(szOutput));
+        Log(("%s: %s\n", pszMsg, szOutput));
+    }
+#else
+    RT_NOREF3(Desc, Sel, pszMsg);
+#endif
 }
 
Index: trunk/src/VBox/VMM/VMMR3/STAM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/STAM.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/STAM.cpp	(revision 62644)
@@ -830,5 +830,5 @@
             do
             {
-                PSTAMLOOKUP pChild = pCur->papChildren[iCur];
+                PSTAMLOOKUP pChild = papChildren[iCur];
                 if (pChild->pDesc)
                     return pChild->pDesc;
@@ -908,8 +908,8 @@
              * Check all children.
              */
-            PSTAMLOOKUP *papChildren = pCur->papChildren;
+            PSTAMLOOKUP * const papChildren = pCur->papChildren;
             do
             {
-                PSTAMLOOKUP pChild = pCur->papChildren[iCur];
+                PSTAMLOOKUP pChild = papChildren[iCur];
                 if (pChild->pDesc)
                     return pChild->pDesc;
@@ -963,8 +963,8 @@
              * Check children backwards, depth first.
              */
-            PSTAMLOOKUP *papChildren = pCur->papChildren;
+            PSTAMLOOKUP * const papChildren = pCur->papChildren;
             do
             {
-                PSTAMLOOKUP pChild = pCur->papChildren[iCur];
+                PSTAMLOOKUP pChild = papChildren[iCur];
                 if (pChild->cChildren > 0)
                 {
@@ -1446,8 +1446,7 @@
  *
  * @returns VINF_SUCCESS
- * @param   pUVM        Pointer to the user mode VM structure.
  * @param   pCur        The descriptor to destroy.
  */
-static int stamR3DestroyDesc(PUVM pUVM, PSTAMDESC pCur)
+static int stamR3DestroyDesc(PSTAMDESC pCur)
 {
     RTListNodeRemove(&pCur->ListEntry);
@@ -1493,5 +1492,5 @@
     {
         if (pCur->u.pv == pvSample)
-            rc = stamR3DestroyDesc(pUVM, pCur);
+            rc = stamR3DestroyDesc(pCur);
     }
 
@@ -1526,5 +1525,5 @@
 
             if (RTStrSimplePatternMatch(pszPat, pCur->pszName))
-                rc = stamR3DestroyDesc(pUVM, pCur);
+                rc = stamR3DestroyDesc(pCur);
 
             /* advance. */
@@ -1722,5 +1721,5 @@
             ASMAtomicXchgU64(&pDesc->u.pProfile->cTicks, 0);
             ASMAtomicXchgU64(&pDesc->u.pProfile->cTicksMax, 0);
-            ASMAtomicXchgU64(&pDesc->u.pProfile->cTicksMin, ~0);
+            ASMAtomicXchgU64(&pDesc->u.pProfile->cTicksMin, UINT64_MAX);
             break;
 
Index: trunk/src/VBox/VMM/VMMR3/TM.cpp
===================================================================
--- trunk/src/VBox/VMM/VMMR3/TM.cpp	(revision 62643)
+++ trunk/src/VBox/VMM/VMMR3/TM.cpp	(revision 62644)
@@ -170,5 +170,5 @@
 static bool                 tmR3HasFixedTSC(PVM pVM);
 static const char *         tmR3GetTSCModeName(PVM pVM);
-static uint64_t             tmR3CalibrateTSC(PVM pVM);
+static uint64_t             tmR3CalibrateTSC(void);
 static DECLCALLBACK(int)    tmR3Save(PVM pVM, PSSMHANDLE pSSM);
 static DECLCALLBACK(int)    tmR3Load(PVM pVM, PSSMHANDLE pSSM, uint32_t uVersion, uint32_t uPass);
@@ -415,5 +415,5 @@
     if (rc == VERR_CFGM_VALUE_NOT_FOUND)
     {
-        pVM->tm.s.cTSCTicksPerSecond = tmR3CalibrateTSC(pVM);
+        pVM->tm.s.cTSCTicksPerSecond = tmR3CalibrateTSC();
         if (   pVM->tm.s.enmTSCMode != TMTSCMODE_REAL_TSC_OFFSET
             && pVM->tm.s.cTSCTicksPerSecond >= _4G)
@@ -925,5 +925,5 @@
  * @returns Number of ticks per second.
  */
-static uint64_t tmR3CalibrateTSC(PVM pVM)
+static uint64_t tmR3CalibrateTSC(void)
 {
     uint64_t u64Hz;
@@ -3253,4 +3253,5 @@
     Assert(   pVM->tm.s.enmTSCMode == TMTSCMODE_REAL_TSC_OFFSET
            && pVM->tm.s.enmTSCMode != pVM->tm.s.enmOriginalTSCMode);
+    RT_NOREF1(pvData);
 
     /*
