Article View: gnu.gcc.bug
Article #1009gcc compiled program core dumps
From: Bjoern Wennberg
Date: Fri, 28 Aug 1992 13:49
Date: Fri, 28 Aug 1992 13:49
44 lines
1968 bytes
1968 bytes
Hi!
I loaded down a maze generator posted on comp.lang.c (I have forgotten
the name of the author)
The program runs properly when compiled with cc but coredumps when
compiled with gcc
Here is the program:
char *M, A, Z, E = 40, J[40], T[40];
main (C)
{
for (*J = A = scanf (M = "%d", &C); --E; J[E] = T[E] = E)
printf ("._");
for (; (A -= Z = !Z) || (printf ("\n|"), A = 39, C--); Z || printf (M))
M[Z] = Z[A - (E = A[J - Z]) && !C & A == T[A] | 6 << 11 < rand () || !C & !Z ? J[T[E] = T[A]] = E, J[T[A] = A - Z] = A, "_." : " |"];
}
Compiling with gcc:
$gcc c.c
$a.out
2
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
|Segmentation fault (core dumped)
Compiling with cc:
$cc c.c
$a.out
2
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
| ._| . . ._| | |_._._. . ._|_._._._._. ._|_. ._|_._. ._| | . ._|_. | . ._._. |
|_._._|_|_._._._._._._._|_._._._._._._._._._._._._._._._._._|_._._._._|_._._|_|
Why does the program core dump when compiled with gcc ?
I have tried to different gcc's (both 2.2.2) a) i386v4 and b)isc
bjornw>
-------------------------------------------------------------
| bjornw@colargol.edb.tih.no Bj|rn Wennberg tlf.: 07-524946 |
| bjornw@edb.tih.no Wesselsgt. 7 |
| 7043 TRONDHEIM, NORWAY |
-------------------------------------------------------------
Technical Details
Message-ID:
<1992Aug28.134922.5514@ugle.unit.no>Path:
arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!colargol.edb.tih.no!bjornwShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!ames!elroy.jpl.nasa.gov!usc!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!colargol.edb.tih.no!bjornw From: bjornw@colargol.edb.tih.no (Bjoern Wennberg) Subject: gcc compiled program core dumps Message-ID: <1992Aug28.134922.5514@ugle.unit.no> Sender: gnulists@ai.mit.edu Organization: Colargol, Trondheim College of Engineering Distribution: gnu Date: Fri, 28 Aug 1992 13:49:22 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 46