Bad Code Generated for Function Returning _self Based Pointer

ID Number: Q67612

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax

Summary:

The Microsoft C versions 6.00, 6.00a, and 6.00ax compilers will

generate incorrect code for a function that returns a pointer based on

self. The code generated for the return statement introduces an extra

level of indirection.

Microsoft has confirmed this to be a problem in C versions 6.00,

6.00a, and 6.00ax. We are researching this problem and will post new

information here as it becomes available.

More Information:

The following program fragment demonstrates this problem. Compile the

code with the /Fc option to generate an assembly listing, and observe

the code in the resulting .COD file for the return statement in the

function test().

Sample Code

-----------

/* Compile options needed: /Fc (for listing)

*/

struct st {

int _based((_segment) _self) *pbs;

} far *pst;

int far *test(void)

{

return(pst->pbs);

}