delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/12/19/10:48:01

Message-ID: <00b201c069d3$2e7af580$0500a8c0@brk>
From: "Johan Henriksson" <jhe AT realsoftware DOT cjb DOT net>
To: <djgpp AT delorie DOT com>
Subject: Re: DJGPP Bug?
Date: Tue, 19 Dec 2000 16:47:56 +0100
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 4.72.3110.1
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
Reply-To: djgpp AT delorie DOT com

from: Johan Henriksson, leadprogrammer @ www.realsoftware.cjb.net
"The individual should be praised for it's struggle, the society
condemned for it's actions" - me 1997        #12035895
----------------------------------------------------------------------------
-------------------


>Here is a bug that I think should be verified by you guys before I report
it
>(as it could be my fault). This is an exact source code listing:
>struct Intptrholder
>{
>        int * intinstruct;
>};
>
>int main()
>{
>        int * intptr;
>        Intptrholder * intptrholder;
>        intptrholder->intinstruct = intptr;
>        return 0;
>}


Isn't it quite obvius? You're dereferencing the pointer intptrholder with is
invalid
and then writes the adress of intptr to intinstruct, causing the GPF. Valid
version:

struct Intptrholder
 {
 int * intinstruct;
 };

int main()
 {
 int * intptr;
 Intptrholder intptrholder;
 intptrholder.intinstruct = intptr;
 return(0);
 }

- Raw text -


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