Void _saveregs Function Does Not Preserve AX Register

ID Number: Q67357

6.00 6.00a 6.00ax | 6.00 6.00a

MS-DOS | OS/2

buglist6.00 buglist6.00a buglist6.00ax

Summary:

Functions with a void return type that are declared with the _saveregs

attribute do not preserve the AX register. An arbitrary return value

is stored in AX unnecessarily.

The C online Help states the following:

The _saveregs keyword causes the compiler to generate code that

saves and restores all CPU registers when entering and exiting the

specified function. Note that _saveregs does not restore registers

used for a return value (the AX register, or AX and DX).

The second sentence states that AX will not be preserved whenever

there is a return value, but a void function has no return value.

Thus, there is no reason the AX register should not be preserved.

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

and 6.0ax and QuickC versions 2.5 and 2.51 (buglist2.50 and

buglist2.51). We are researching this problem and will post new

information here as it becomes available.