From jin@iss-p1.lbl.gov  Thu May  8 18:39:50 1997
Received: from iss-p1.lbl.gov (iss-p1.lbl.gov [131.243.2.47])
          by hub.freebsd.org (8.8.5/8.8.5) with ESMTP id SAA01811
          for <FreeBSD-gnats-submit@freebsd.org>; Thu, 8 May 1997 18:39:48 -0700 (PDT)
Received: (from jin@localhost)
	by iss-p1.lbl.gov (8.8.5/8.8.5) id SAA18755;
	Thu, 8 May 1997 18:39:44 -0700 (PDT)
Message-Id: <199705090139.SAA18755@iss-p1.lbl.gov>
Date: Thu, 8 May 1997 18:39:44 -0700 (PDT)
From: "Jin Guojun[ITG]" <jin@iss-p1.lbl.gov>
Reply-To: jin@iss-p1.lbl.gov
To: FreeBSD-gnats-submit@freebsd.org
Subject: cc failed on deafult <= default
X-Send-Pr-Version: 3.2

>Number:         3554
>Category:       gnu
>Synopsis:       cc failed on deafult <= default
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:
>Keywords:
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May  8 18:40:01 PDT 1997
>Closed-Date:    Fri May 9 17:52:41 MEST 1997
>Last-Modified:  Fri May  9 17:53:09 MEST 1997
>Originator:     Jin Guojun[ITG]
>Release:        FreeBSD 2.2-RELEASE i386
>Organization:
>Environment:

	cc (gcc) 2.7.2.1

>Description:

	switch (x) {
	case ...
	...
	deafult: ...	/* no error reported, but fails	*/
	}

	if deafult is the alias to default, it should make it work,
	otherwise, please generate error code, and fail for .o .

>How-To-Repeat:

	

>Fix:
	
	

>Release-Note:
>Audit-Trail:

From: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
To: jin@iss-p1.lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/3554: cc failed on deafult <= default 
Date: Fri, 09 May 1997 13:21:33 +0400

 > >Description:
 > 
 > 	switch (x) {
 > 	case ...
 > 	...
 > 	deafult: ...	/* no error reported, but fails	*/
 > 	}
 > 
 > 	if deafult is the alias to default, it should make it work,
 > 	otherwise, please generate error code, and fail for .o .
 > 
 'deafult:' is a label. It can be used in 'goto' statement.
 
 Dima
 
 

From: Dmitrij Tejblum <dima@tejblum.dnttm.rssi.ru>
To: jin@iss-p1.lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/3554: cc failed on deafult <= default 
Date: Fri, 09 May 1997 13:21:33 +0400

 > >Description:
 > 
 > 	switch (x) {
 > 	case ...
 > 	...
 > 	deafult: ...	/* no error reported, but fails	*/
 > 	}
 > 
 > 	if deafult is the alias to default, it should make it work,
 > 	otherwise, please generate error code, and fail for .o .
 > 
 'deafult:' is a label. It can be used in 'goto' statement.
 
 Dima
 
 

From: j@uriah.heep.sax.de (J Wunsch)
To: jin@iss-p1.lbl.gov
Cc: FreeBSD-gnats-submit@FreeBSD.ORG
Subject: Re: gnu/3554: cc failed on deafult <= default
Date: Fri, 9 May 1997 10:44:31 +0200

 As Jin Guojun[ITG] wrote:
 
 > >Description:
 > 
 > 	switch (x) {
 > 	case ...
 > 	...
 > 	deafult: ...	/* no error reported, but fails	*/
 > 	}
 
 This is legal C code.  deafult: is just a label as any other case
 labels, or a plain label as in:
 
 	for (i = 0; i < max; i++) {
 		someptr = &array[i];
    defualt:
    do_again:
 
 		...
 		if (some_condition) {
 			goto do_again;	/* both statements are the same */
 			goto defualt;
 		}
 		...
 	}
 
 You should get a warning about an unused label with -Wall.
 
 Or to quote some more twisted example here, take Duff's device:
 
 :Duff's device: n. The most dramatic use yet seen of {fall
    through} in C, invented by Tom Duff when he was at Lucasfilm.
    Trying to {bum} all the instructions he could out of an inner
    loop that copied data serially onto an output port, he decided to
    {unroll} it.  He then realized that the unrolled version could
    be implemented by *interlacing* the structures of a switch and
    a loop:
 
         register n = (count + 7) / 8;       /* count > 0 assumed */
 
         switch (count % 8)
         {
         case 0: do {    *to = *from++;
         case 7:         *to = *from++;
         case 6:         *to = *from++;
         case 5:         *to = *from++;
         case 4:         *to = *from++;
         case 3:         *to = *from++;
         case 2:         *to = *from++;
         case 1:         *to = *from++;
              } while (--n > 0);
         }
 
    Having verified that the device is valid portable C, Duff announced
    it.  C's default {fall through} in case statements has long been
    its most controversial single feature; Duff observed that "This
    code forms some sort of argument in that debate, but I'm not sure
    whether it's for or against."
 
 (Courtesy the Jargon file, of course.)
 
 -- 
 cheers, J"org
 
 joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
 Never trust an operating system you don't have sources for. ;-)
State-Changed-From-To: open->closed 
State-Changed-By: joerg 
State-Changed-When: Fri May 9 17:52:41 MEST 1997 
State-Changed-Why:  
That's actually legal C code. 
>Unformatted:
