Article View: comp.sys.atari.st
Article #2018Fix for Sozobon C case-without-switch bug
From: Michael Vishchers
Date: Mon, 26 Jun 1989 11:34
Date: Mon, 26 Jun 1989 11:34
83 lines
3090 bytes
3090 bytes
This is a followup to my article about the Sozobon C case-without-switch bug.
I received an answer from Tony Andrews saying that this bug will not be in
the new version. For all those who do not want to wait, but get rid of the
bombs NOW, here is a bug fix I received from
Andreas Schwab <schwab@joan.irb.informatik.uni-dortmund.de>
I have not tested it, but it seems okay.
Ah yes, if you do not have patch, you must make the modifications by hand.
Isn't it great to have a good Compiler with sources ?
Good luck.
diff -c fun.c.old fun.c
*** fun.c.old Mon Jun 26 12:53:39 1989
--- fun.c Mon Jun 26 12:53:03 1989
***************
*** 34,40
struct swittbl {
NODEP caselist;
int deflbl;
! } *curswit;
int curbrk, curcont;
int funtopl, funbotl, funretl, funstrl;
--- 34,40 -----
struct swittbl {
NODEP caselist;
int deflbl;
! } *curswit = NULL; /* Initialisierung noetig */
int curbrk, curcont;
int funtopl, funbotl, funretl, funstrl;
***************
*** 616,621
case K_DEFAULT:
if (debugs)
printf("DEFAULT ");
if (curswit->deflbl >= 0)
error("multiple 'default'");
curswit->deflbl = l1;
--- 616,623 -----
case K_DEFAULT:
if (debugs)
printf("DEFAULT ");
+ if (curswit == NULL) /* Innerhalb 'switch'? */
+ error("'default' without 'switch'");
if (curswit->deflbl >= 0)
error("multiple 'default'");
curswit->deflbl = l1;
***************
*** 703,708
np->c_casel = lbl;
sprintf(np->n_name, "%d:%d", val, lbl);
last = NULL;
for (p = curswit->caselist; p; last=p, p=p->n_next)
if (p->c_casev == val) {
--- 705,712 -----
np->c_casel = lbl;
sprintf(np->n_name, "%d:%d", val, lbl);
+ if (curswit == NULL) /* Innerhalb 'switch'? */
+ error("'case' without 'switch'");
last = NULL;
for (p = curswit->caselist; p; last=p, p=p->n_next)
if (p->c_casev == val) {
------------------------------------------------------------------------
______________________________________________________________________
/ Michael Vishchers | History repeats itself.\
| michaelV@owl.ls5.informatik.uni-dortmund.de | Has to. |
| michaelV%owl.ls5@UNIDO.uucp | No one listens. |
| (I think) | (steve turner) |
\______________________________________________________________________/
/ Home address:: Frohnhauser Str. 233 D-4300 Essen 1 West-Germany\
________________________________________________________________________
Technical Details
Message-ID:
<1440@laura.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bbn!ginosko!uunet!mcvax!unido!laura!exunido!agrusowShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bbn!ginosko!uunet!mcvax!unido!laura!exunido!agrusow From: agrusow@exunido.uucp (Michael Vishchers) Newsgroups: comp.sys.atari.st Subject: Fix for Sozobon C case-without-switch bug Message-ID: <1440@laura.UUCP> Date: 26 Jun 89 11:34:42 GMT Sender: news@laura.UUCP Reply-To: Andreas Schwab <schwab@joan.irb.informatik.uni-dortmund.de> Organization: University of Dortmund, W-Germany Lines: 83