Article View: gnu.gcc.bug
Article #1099hppa1.1 switch problem
From: Marv Graham
Date: Wed, 09 Sep 1992 13:56
Date: Wed, 09 Sep 1992 13:56
49 lines
1383 bytes
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
Technical Details
Message-ID:
<1992Sep9.135633.27512@news.eng.convex.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!convex.com!grahamShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!convex.com!graham From: graham@convex.com (Marv Graham) Subject: hppa1.1 switch problem Message-ID: <1992Sep9.135633.27512@news.eng.convex.com> Sender: gnulists@ai.mit.edu Organization: Engineering, CONVEX Computer Corp., Richardson, Tx., USA Distribution: gnu Date: Wed, 9 Sep 1992 13:56:33 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 50