IBM Support

Testing long long variable results in incorrect when using MinGW

Troubleshooting


Problem

Attempts to test a long long variable using IBM Rational Test RealTime result in an unexpected value in the report.

Symptom

You test MyVarLong in the following way.

Disclaimer

All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.




long long int MyVarLong;

VAR MyVarLong, long#h64, init = 0xAAAAAAAAAAAAAAAALL, ev = 0x0FFFFFFFFFFFFFFFL



EXPECTED


OBTAINED


The test truncated the obtained value to a 32-bits value.

Cause

Minimalist GNU for Windows (MinGW) uses the MSVCRT library for the printf format that Test RealTime uses.

Resolving The Problem

You need to customize the MinGW Target Deployment Port to use the MSVCRT library.

To do so, use the Target Deployment Port Editor in Parser Settings > Header adaptation for C.



  1. 1. Verify if you have the following pragma in
    Parser Settings > Header adaptation for C.


    #pragma attol sizeof(long) = 64









  2. Add the following code In Library Settings > Include files or code visible only to the Target Deployment Port.



    #define _MSC_VER 1400






[{"Product":{"code":"SSSHUF","label":"Rational Test RealTime"},"Business Unit":{"code":"BU053","label":"Cloud & Data Platform"},"Component":"Component Testing: C","Platform":[{"code":"PF033","label":"Windows"}],"Version":"7.5;7.5.0.1;7.5.0.2;7.5.0.3;7.5.0.4;7.5.0.5;7.5.0.6;8.0;8.0.0.1;8.0.0.2;8.0.0.3","Edition":"","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
16 June 2018

UID

swg21612988