🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Bjoern Wennberg Fri, 28 Aug 1992 13:49
gcc compiled program core dumps
#1009
Author: Bjoern Wennberg
Date: Fri, 28 Aug 1992 13:49
44 lines
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         |
  -------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads