🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by Marv Graham Wed, 09 Sep 1992 13:56
hppa1.1 switch problem
#1099
Author: Marv Graham
Date: Wed, 09 Sep 1992 13:56
49 lines
1383 bytes
/*<< hpux gcc 2.2.2 for hp710 (hppa1.1) gets wrong answers on the following code

The output should be:
4: a = 1028

but I get:

5: a = 1028
5: a = 1028

There is no problem unless -DOMIT is used on the command line
i.e: three cases work, more than three cases fails.

When it fails, it always uses the last case for all values of "a",
even when "a" is not one of the labels (e.g. 1 as below).
<<*/

sw(int a)
{
	switch (a) {
#ifdef OMIT
	case 0x402:
		printf("2: a = %d\n", a);
		break;
#endif  /* OMIT */
	case 0x403:
		printf("3: a = %d\n", a);
		break;
	case 0x404:
		printf("4: a = %d\n", a);
		break;
	case 0x405:
		printf("5: a = %d\n", a);
		break;
	}
}

main(void)
{
	sw(0x404);
	sw(1);
}

There are no problems with either the convex or the i386 versions of gcc-2.2.2
with this program - OMIT or not.


Marv Graham; Convex Computer Corp.  {uunet,sun,uiucdcs,allegra}!convex!graham
					graham@bach.convex.com
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