[omniORB] Incorrect c++ code generation for unsigned long long constants in OO4

Carl Thompson cet@carlthompson.net
Wed, 29 Aug 2001 14:14:03 -0700


Hello,

The C++ backend of the IDL compiler for omniORB4 does not output correct 
code for unsigned long long constants.  For example, this IDL:

   -- test.idl --------------------------------------------------------
   typedef unsigned long long ULL;
   const ULL t1 = 0x7fffffffffffffff;
   const ULL t2 = t1;
   --------------------------------------------------------------------

generates this code:

   -- test.hh --------------------------------------------------------
   typedef CORBA::ULongLong ULL;

   _CORBA_GLOBAL_VARINT const CORBA::ULongLong t1 _init_in_decl_( =
     _CORBA_LONGLONG_CONST(9223372036854775807) );

   _CORBA_GLOBAL_VARINT const CORBA::ULongLong t2 _init_in_decl_( =
     _CORBA_LONGLONG_CONST(18446744073709551615) );
   -------------------------------------------------------------------

The value of t2 is incorrect.  Also, it is using _CORBA_LONGLONG_CONST() 
which suggests that it should be using _CORBA_ULONGLONG_CONST().

testSK.cc is similarly incorrect.

The "long" , "unsigned long" , and "long long" types all seem to work 
correctly.  It's just "unsigned long long" that has the problem.

Note that the value assigned to t1 in the above example does not really 
matter as long as it is greater than 0x7fff (32,767).

Also, the C++ backend does not generate the suffixes for integer 
constants (L, UL, LL and ULL) as it should.

I tested with the latest CVS snapshot.

Thanks,
Carl Thompson