delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/23/06:46:33

Date: Sun, 23 Mar 1997 14:34:17 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Regis BOSSUT <bossut AT isen DOT fr>
cc: djgpp AT delorie DOT com
Subject: Re: A simple program that works except under GDB...
In-Reply-To: <333251F7.6AEA@isen.fr>
Message-ID: <Pine.SUN.3.91.970323143342.29590F-100000@is>
MIME-Version: 1.0

On Fri, 21 Mar 1997, Regis BOSSUT wrote:

> 1) The packed attribute is not of any help, since the items of ncb are
>    already correctly aligned.

Did you actually tried to add ``__attribute__(packed))''?  Because I
think that you are wrong in assuming that NCB is already aligned.
Here:

> #define BYTE unsigned char
> #define WORD unsigned short
> #define DWORD unsigned int
>
> typedef struct {
> BYTE  ncb_command;
> #define NCBASTAT 0x33
> BYTE  ncb_retcode, ncb_lsn, ncb_num;
> char *ncb_buffer; WORD  ncb_length;
> BYTE  ncb_callname[16], ncb_name[16];
> BYTE  ncb_rto, ncb_sto;
> int   (*ncb_post)();			<<<<<<<<<<<<
> BYTE  ncb_lana_num, ncb_cmd_cplt;	<<<<<<<<<<<<
> char *ncb_vname;			<<<<<<<<<<<<
> BYTE  ncb_vnamelen;
> BYTE  ncb_reserve[9];
> } NCB;

The 3 marked lines show that *ncb_vname (a 4-byte pointer) is not
aligned, because there are only 2 bytes between it and the preceding
(*ncb_post)(), which is a 4-byte pointer to a function.  Am I missing
something?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019