www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/19/00:09:20

Xref: news2.mv.net comp.os.msdos.djgpp:3998
From: dan AT dan DOT emsphone DOT com (Dan Nelson)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bugs in cwsdpmi?
Date: 19 May 1996 02:01:36 GMT
Organization: PSI Public Usenet Link
Lines: 28
Message-ID: <4nlve0$s8s@client3.news.psi.net>
References: <4nlke7$aka AT news1 DOT goodnet DOT com>
NNTP-Posting-Host: 199.67.51.101
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

snarfy AT goodnet DOT com wrote:
> Here is an interesting 'bug' that I have found in cwsdpmi.  When I compile
> the attached file and run it under dos, it blows up giving me a SIGSEGV, but
> it works correctly under a windows dos box and in linux dosemu.  Here
> is the program:

Then windows and dosemu are broken :)  Where are you allocating the
structure that bar points to?  Bar's only the pointer, and since it's
static, it's zeroed out.  Your SIGSEGV is a null pointer violation.

> 
> #include <stdio.h>
> 
> typedef struct {
> int x;
> int y;
> } foo;
> 
> foo *bar;
> void main()
> {
>      bar->x = 3;
>      bar->y = 4;
>      printf("x = %d\n", bar->x);
> }

	-Dan Nelson
	dnelson AT emsphone DOT com

- Raw text -


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