www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/11/00:04:13

Xref: news-dnh.mv.net comp.os.msdos.djgpp:847
Path: news-dnh.mv.net!mv!news.sprintlink.net!howland.reston.ans.net!Germany.EU.net!news.dfn.de!fu-berlin.de!cs.tu-berlin.de!fauern!gs.dfn.de!news.gwdg.de!grotheer
From: grotheer AT PROBLEM_WITH_INEWS_DOMAIN_FILE (Olaf Grotheer)
Newsgroups: comp.os.msdos.djgpp
Subject: It's a bug?
Date: 10 Jul 1995 07:16:01 GMT
Organization: MPI fuer Festkoerperforschung, Stuttgart
Lines: 29
Nntp-Posting-Host: physx6.mpi-stuttgart.mpg.de
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

I have written a bit of source code that will cause the compiler to die
with a message "Segmentation violation in pointer 0x00000009 at d8:585a9",
when I try   gcc -c test.cpp -o test.o 
The compiler does not give any diagnostics before crashing. (I would have
expected something like  "test.cpp: line 7: can not assign int** to int*"
Here is the bit of code:

typedef int * Pint;
int main(void)
{
	int i;
	int ** X;
	X = new Pint[10];
	for (i = 0; i < 10; i++) X = new int(i);
	// Oops, a typo: I meant to say X[i] = new int(i);
}

I get this kind of crash quite regularly. The only way I have of locating an
error of this kind is quite cubersome: I comment out parts of my code in order
to figure out which line is offensive... 
The compiler compiles just fine when the source code is error free.
Is this a compiler bug or some quirk of my system? If that makes any 
difference, I got a 486 and use MS-DOS. My version of DJGPP is
djdev112, bnu24, gas23, gpp260, lgp260, gcc260

Thanks for any help (and for providing DJGPP in the first place !)

	Olaf

- Raw text -


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