Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
tools
vsnet.act
vsnet.debugging
vsnet.documentation
vsnet.enterprise.tools
vsnet.general
vsnet.ide
vsnet.jlca
vsnet.servicepacks
vsnet.setup
vsnet.vsip
vsnet.vss
vsnet.vstools.office
vstudio.development
vstudio.extensibility
vstudio.general
vstudio.helpauthoring
vstudio.setup
vstudio.sourcesafe
  
 
date: Fri, 2 May 2008 10:54:02 -0700,    group: microsoft.public.vstudio.development        back       


Bug in compiler ?   
Hi,

I met buggy compiled C code.
There is declaration of called function:
typedef time_t TIME;

void 
ack_lease (
  struct packet *, 
  struct lease *, 
  unsigned int, 
  TIME, 
  char *, 
  int, 
  struct host_decl *
);

When this function was called by this way:
ack_lease (packet, lease, DHCPACK, 
0, 
msgbuf, ms_nulltp, (struct host_decl *)0);

then on begin of called function body parameters after fourth parameter was 
all next parameters offset 4 bytes.
It is because compiler does not automatically converts 0 to 64-bit number, 
but it pushes to stack 32-bit number even in declaration is 64-bit TIME. On 
the other side called function calculates always with 64-bit number on the 
stack, so there is reason for offset and locals after TIME parameter are 
invalid in called function.

but

When this function was called by this way:
ack_lease (packet, lease, DHCPACK, 
0ULL, 
msgbuf, ms_nulltp, (struct host_decl *)0);

all is ok.

Compiler is from VS2005, version 14.00.50727.42 for 80x86.
The same code was ok in VS2003, so it seems that this behavior is only in 
compiler for VS2005.

Peter Skvarka
SOFT IN ENGINES
date: Fri, 2 May 2008 10:54:02 -0700   author:   Peter

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us