Article View: gnu.gcc.help
Article #51342DOS vs ...
From: Matthew Kwiecien
Date: Sun, 06 Jun 1993 17:13
Date: Sun, 06 Jun 1993 17:13
99 lines
2916 bytes
2916 bytes
Thanks to all who replied to my initial (vague) question regarding various
platforms and gcc.
Here are some snippits of code and more detailed explanations :
[stuff in main]
...
int a[XY],b[XY],d[XY];
int *p,*c,*n,*t;
int l,lnl,lz,lnv;
FILE *ifp,*ofp,*ifn;
c = a;
p = b;
n = d;
ifn = fopen("neck.snp","rb");
lz = 2;
lnl = 0;
lnv = 0;
for (l=3;l<=Z;l++) {
getneck(n,l,ifn,&lz,&lnl,&lnv);
t = p;
p = c;
c = n;
n = t;
}
[stuff from routine in question]
/* GETNECK */
void getneck(int *a, int l, FILE *ifn, int *lz, int *lnl, int *lnv)
{
int z1,ln;
while (((*lz) <= l) && ((*lz) > 0)){
if ((*lz >= 2) && (a[(*lnl)] != 1) && (*lnl) != 0)
(void) printf("oops -- %d %d %d\n",*lz,*lnl,*lnv);
a[(*lnl)] = -(*lnv);
(void) fread ((char *) &z1,sizeof(int),1,ifn);
(void) fread ((char *) &ln,sizeof(int),1,ifn);
*lz = z1/65536;
*lnl = z1%65536;
*lnv = (ln/10000)*3000 + (ln % 10000);
}
}
The problem lies in the getneck routine.
The printf routine prints only ONE integer not Three, if the ``if''
statement (apparently) evaluates to true.
The data file being read (ifn) was written on the same system as the one
that is running this programme.
I have tried writting and reading the data files as ASCII and converting
them in this routine, but that did not help.
What bothers me, is that the programme does not crash, but just continues to
run spitting out crap.
Again, Under SunOS 4.1.1 (gcc 2.3.3) the programme runs fine.
Under NetBSD 0.8 (distributed binaries) I only had to declare my initial
arrays as static to get the programme to work.
Under MS-DOS 5.0 (gcc 2.2.2) the programme will not work.
The only compiler options that I use is -O.
My suspicion is that the memory mapping gets all messed up.
I have a 1.0 Gig. drive and 4 MB of memory. Again, it is a 386DX-25MHz.
Is there a special way that I need to configure the DOS system so that gcc
works properly ?
Can anyone see anything obvious ?
Thanks for you help,
Matt
P.S. Sorry about the lack of info in the previous post.
--
M.J. (Matt) Kwiecien | Email : matt@prism.uwaterloo.ca
Dept. of Chem. Eng. | : kwiecien@watdcs.bitnet
University of Waterloo. | Phone : (519) 885-1211 ext. 6157
Technical Details
Message-ID:
<C87MIz.6L3@watserv2.uwaterloo.ca>Path:
arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!pipex!uunet!europa.eng.gtefsd.com!howland.reston.ans.net!torn!watserv2.uwaterloo.ca!mattShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,4cdf56d011108d94,start X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-06-06 10:24:51 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!Germany.EU.net!mcsun!uknet!pipex!uunet!europa.eng.gtefsd.com!howland.reston.ans.net!torn!watserv2.uwaterloo.ca!matt From: matt@prism.uwaterloo.ca (Matthew Kwiecien) Subject: DOS vs ... Message-ID: <C87MIz.6L3@watserv2.uwaterloo.ca> Sender: news@watserv2.uwaterloo.ca Organization: University of Waterloo Date: Sun, 6 Jun 1993 17:13:46 GMT Lines: 99