Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 366511

Summary: microsoft.targets.Win32 (MSVC 9) fails at runtime in Module Primer/Lesson 9 in HeapStd_alloc, with alignment failure
Product: z_Archived Reporter: Gordon Deane <gordon.deane>
Component: DSDPAssignee: Doug Gaff <dgaff.eclipse>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Gordon Deane CLA 2011-12-13 05:27:12 EST
Build Identifier: XDC 3.22.04.46 command line, no Eclipse involved.

Attempting to run Module Primer/Lesson 9 from RTSC-pedia, but using Microsoft C/C++ 9 (as shipped with Visual Studio 2008) as a target.

/*
 *  ======== config.bld ========
 */

var Build = xdc.useModule('xdc.bld.BuildEnvironment');
 
function unixPath(x)
{
    return x.replace('\\','/');
}

var Win32 = xdc.useModule('microsoft.targets.Win32');
 
var rootDir = java.lang.System.getenv("VSINSTALLDIR");

if (!rootDir)
{
    raise(java.lang.RuntimeException("Must set %VSINSTALLDIR%\n"));
}
print("Configuring Microsoft Visual C++ 9 in " + rootDir);
Win32.rootDir = unixPath(rootDir);
var sdkPath = unixPath(java.lang.System.getenv("WindowsSdkDirShort"));
print("Windows SDK in " + sdkPath + " (* mangled for TI tools)");
if (!sdkPath)
{
    throw new java.lang.RuntimeException("Must set %WindowsSdkDirShort% to short path of SDK, see SetupSDKEnvironment.js\n");
}

Win32.vcPath = [
          ["Visual.C++.9",
              {
                  compilerDir: "VC",
                  dllPath: "Common7/IDE",
                  sdkPath: sdkPath,
                  libs: " msvcrt.lib setargv.obj oldnames.lib ole32.lib oleaut32.lib olepro32.lib uuid.lib kernel32.lib user32.lib gdi32.lib advapi32.lib shell32.lib comctl32.lib"
              }
          ],
      ];

Build.targets = [Win32];




Output:

C:\Software\XDC_tutorial\msvc9_build\module_examples\acme\filters\test  09:57:10
> xdc test
running FirTest1.exe ...
xdc.runtime.HeapStd: line 68: assertion failure: HeapStd_alloc - requested alignment is greater than allowed
xdc.runtime.Error.raise: terminating execution

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
gmake.exe[1]: *** [FirTest1.exe.test] Error 3
xdctools_3_22_04_46\gmake.exe: *** [FirTest1.exe.test] Error 2



NB. When building the same code with the MinGW toolchain this works fine.
Is it possible that maxDefaultTypeAlign is not set correctly for the microsoft target?  I could not find out where this is set.

Reproducible: Always

Steps to Reproduce:
1. Download module_examples from RTSC primer site, unpack.
2. Replace config.bld as above
3. Start a VS2008 command shell, ie. with all environment vars set
4. Set WindowsSdkDirShort to the short path of the platform SDK as per cdoc docs.  (This is very irritating, BTW, as I couldn't find any way to convert long to short path inside XS, though it can be done easily in native langs with COM access)
5. Build acme/utils,acme/utils/filters with xdc all (works fine) and install in repo
6. cd to acme\filters\test and build with xdc all, this succeeds.
7. run with xdc test, fails as described.