[LLVMbugs] [Bug 6108] New: Broken __mode__ (__DI__) on 64bit platforms

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Thu Jan 21 18:42:34 PST 2010


           Summary: Broken __mode__ (__DI__) on 64bit platforms
           Product: new-bugs
           Version: trunk
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: chandlerc at gmail.com
                CC: llvmbugs at cs.uiuc.edu, zhanyong.wan at gmail.com

An integer with this attribute in Clang will not be the same fundamental type
as 'long int', and instead will be 'long long'.

% cat test.cpp
typedef int int64_t __attribute__ ((__mode__ (__DI__)));
typedef long int intptr_t;
void f(int64_t* x) { (void)x; }
int test(intptr_t* y) { f(y); }
% clang++ -fsyntax-only -m64 test.cpp   
test.cpp:4:25: error: no matching function for call to 'f'
int test(intptr_t* y) { f(y); }
test.cpp:3:6: note: candidate function not viable: no known conversion from
'intptr_t *' to
      'int64_t *' for 1st argument
void f(int64_t* x) { (void)x; }
2 diagnostics generated.

Useful program showing what is actually happening, and also highlighting *yet
another* aspect of this bug:

% cat ull.cpp 
#include <iostream>
#include <typeinfo>

typedef int my_int64_t __attribute__ ((__mode__ (__DI__)));
typedef long int my_intptr_t;

int main(void) {
  std::cout << typeid(long int).name() << "\n";
  std::cout << typeid(int __attribute__ ((__mode__ (__DI__)))).name() << "\n";
  std::cout << typeid(long long).name() << "\n";
  std::cout << typeid(my_int64_t).name() << "\n";
  std::cout << typeid(my_intptr_t).name() << "\n";
  return 0;
% clang++ -m64 ull.cpp -o ull; ./ull

The typeid seems to change based on whether or not its seen through a typedef.

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list