[7286] in Athena Bugs
rt 7.2R: hc2.1y
daemon@ATHENA.MIT.EDU (daemon@ATHENA.MIT.EDU)
Tue Mar 12 13:14:54 1991
Date: Tue, 12 Mar 91 13:14:38 EST
From: John T Kohl <jtkohl@MIT.EDU>
To: bugs@MIT.EDU
System name: soup
Type and version: RTPC-ROMPC 7.2R
Display type: apa16
What were you trying to do?
Compile some ISODE code.
What's wrong:
The compiler barfs on a legitimate (noop) cast. Both the pmax
cc1.31 and VAX PCC can compile it without complaint.
I boiled the problem down to this fragment:
typedef struct PElement {
int pe_refcnt; /* hack for ANYs in pepy */
} PElement, *PE;
typedef struct OIDentifier {
int oid_nelem; /* number of sub-identifiers */
unsigned int *oid_elements; /* the (ordered) list of sub-identifiers */
} OIDentifier, *OID;
OID prim2oid ();
#define NULLOID ((OID) 0)
void
frob(pe)
PE pe;
{
OID oid;
if (((OID) oid = prim2oid(pe)) == NULLOID) {
printf("bogus");
}
return;
}
The errors it generates:
% hc -v -c broken-hc.c
/lib/cpp -D__STDC__ -D__HIGHC__ broken-hc.c /tmp/pp.014195
/usr/lib/hc1com /tmp/pp.014195 -efile @E -silent -on CHAR_DEFAULT_UNSIGNED -offDOUBLE_MATH_ONLY -on DOUBLE_RETURN -on LONG_ENUMS -off PCC -on PCC_MSGS -ofile /tmp/IL1014195 -vfile /tmp/var014195 -machine rtfl -define ibm032 1 -pro hc.pro -copyr -dir /usr/include
MetaWare High C Compiler R2.1y
(c) Copyright 1987-89, MetaWare Incorporated
E "broken-hc.c",L22/C20: (syntactic) unexpected symbol:'='
REPAIR: '<CHAR>':Default_returned_by_error_recovery replaces EL@"broken-hc.c",L22/C10
1 user error No warnings
Exit 8 hc -v -c broken-hc.c
-------
If I remove the (OID) cast, the error goes away. If I group the cast
with the variable: ((OID) oid) = ..., the error goes away.
What should have happened:
The compiler shouldn't gratuitously fail.
Please describe any relevant documentation references:
X3.159