http://llvm.org/bugs/show_bug.cgi?id=4239

           Summary: clang: incorrect handling of  __attribute__ ((regparm
                    (3), stdcall))
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]


This bug in clang causes libgnuregex to crash/hang on FreeBSD.
Same file compiled with gcc works.

Testcase:
void abort(void) __attribute__((__noreturn__));
typedef void re_string_t;
typedef void re_dfa_t;
typedef int reg_errcode_t;
static reg_errcode_t re_string_construct (re_string_t *pstr, const char *str,
       int len, char * trans,
       int icase, const re_dfa_t *dfa)
     __attribute__ ((regparm (3), stdcall));
static reg_errcode_t
re_string_construct (pstr, str, len, trans, icase, dfa)
     re_string_t *pstr;
     const char *str;
     int len, icase;
     char * trans;
     const re_dfa_t *dfa;
{
        if (dfa != (void*)0x282020c0)
                abort();
return 0;
}
int main()
{
return re_string_construct(0, 0, 0, 0, 0, (void*)0x282020c0);
}


Works with gcc, llvm-gcc -m32, fails with clang -m32.
Works with clang on x86-64 (64-bit default).

There is something wrong with parameter passing, dfa becomes 0x3.

It seems that the missing x86_stdcallcc in the call causes this.
Shouldn't the verifier reject this assembly then? (incompatible calling
conventions).


-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to