Opened 19 months ago

Closed 19 months ago

Last modified 13 months ago

#152 closed defect (fixed)

Incorrect Lvalue conversion when using inline assembly

Reported by: Thierry Delisle Owned by: Thierry Delisle <tdelisle@…>
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:
Cc:

Description

Given the following code :

void bts(unsigned long long int * target, unsigned long long int bit ) {
	asm (
            "LOCK btsq %[bit], %[target]\n\t" :
            : [target] "m" (*target), [bit] "r" (bit)
	);
}

The code generator incorrectly generates code missing the * in front of target as follows:

void _X3btsFv_Pyy__1(unsigned long long int *_X6targetPy_1, unsigned long long int _X3bity_1){
    asm ( "LOCK btsq %[bit], %[target]\n\t" :  : [ target ] "m" ( _X6targetPy_1 ), [ bit ] "r" ( _X3bity_1 ) :  );
}

It should generate:

void _X3btsFv_Pyy__1(unsigned long long int *_X6targetPy_1, unsigned long long int _X3bity_1){
    asm ( "LOCK btsq %[bit], %[target]\n\t" :  : [ target ] "m" ( *_X6targetPy_1 ), [ bit ] "r" ( _X3bity_1 ) :  );
}

Change History (2)

comment:1 Changed 19 months ago by Thierry Delisle <tdelisle@…>

Owner: set to Thierry Delisle <tdelisle@…>
Resolution: fixed
Status: newclosed

In 78cdb06:

Modified Lvalue cast handling to ignore top level dereferencing in AsmExpr?, also added test case for this fixes #152?

comment:2 Changed 13 months ago by Thierry Delisle <tdelisle@…>

In 78cdb06:

Modified Lvalue cast handling to ignore top level dereferencing in AsmExpr?, also added test case for this fixes #152?

Note: See TracTickets for help on using tickets.