Article View: comp.bugs.4bsd
Article #413C compiler bug in Sun OS 3.0
From: Fred Fish
Date: Sat, 15 Nov 1986 20:21
Date: Sat, 15 Nov 1986 20:21
61 lines
1819 bytes
1819 bytes
[Is there a sun specific newsgroup under the new usenet organization, other
than mod.computers.sun?]
/*
* DESCRIPTION
*
* The C compiler has a bug with use of the comma operator in
* return expressions.
*
* SUN OS REVISION
*
* 3.0 SUNBIN DOMESTIC 68020
* Part Number: 700-1114-05 Rev. A
*
* COMMENTS
*
* From K&R, pages 58-59:
*
* "A pair of expressions separated by a comma is evaluated
* left to right, and the type and value of the result are
* the type and value of the right operand."
*
* This bug has apparently been fixed in 3.2.
*
*/
#include <stdio.h>
main ()
{
int value;
value = nobug ();
printf ("nobug() returns %d, %#x, %#o\n", value, value, value);
value = bug ();
printf ("bug() returns %d, %#x, %#o\n", value, value, value);
value = bugworkaround ();
printf ("bugworkaround() returns %d, %#x, %#o\n", value, value, value);
}
int nobug ()
{
return (0202);
}
int bug ()
{
return (4, 0202);
}
int bugworkaround ()
{
return (4, (int)0202);
}
--
===========================================================================
Fred Fish Motorola Computer Division, 3013 S 52nd St, Tempe, Az 85282 USA
{mcdsun,well}!fnf (602) 438-5976
===========================================================================
Technical Details
Message-ID:
<125@mcdsun.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!nbires!hao!noao!mcdsun!fnfShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!nbires!hao!noao!mcdsun!fnf From: fnf@mcdsun.UUCP (Fred Fish) Newsgroups: comp.bugs.4bsd Subject: C compiler bug in Sun OS 3.0 Message-ID: <125@mcdsun.UUCP> Date: Sat, 15-Nov-86 15:21:00 EST Article-I.D.: mcdsun.125 Posted: Sat Nov 15 15:21:00 1986 Date-Received: Sun, 16-Nov-86 07:22:27 EST Organization: Motorola Microcomputer Division, Tempe, Az. Lines: 61