Interaction between storage class and qualifiers
David B.Anderson
davea at quasar.wpd.sgi.com
Wed Jan 9 06:26:26 AEST 1991
In article <1991Jan8.000756.24432 at zoo.toronto.edu> henry at zoo.toronto.edu (Henry Spencer) writes:
>In article <2760 at charon.cwi.nl> jack at cwi.nl (Jack Jansen) writes:
>>The SGI C compiler treats the following two pointers as unequal:
Henry's corrections are appropriate. What started this is a compiler
bug that caused rejection of a legal assignment.
By e-mail, Jack Jensen sent me a complete example:
volatile struct foo { int y; } *ptr;
main() {
register volatile struct foo *p1;
volatile register struct foo *p2; /* compiler gets ``wrong struct'' */
p1 = ptr;
p2 = ptr; /* compiler rejects this: compiler bug */
}
ccom: Warning: tv2.c, line 11: illegal structure pointer combination
p2 = ptr;
------------^
CHARACTERIZATION: Considering:
X to be volatile, const, int, char, unsigned, struct foo (etc)
or a combination
and
Y to be register, auto, extern, static, typedef
then
X Y X
would not always get the compiler-internal Node data correct.
the type would be right, but other data (like the structure index)
would come from the first X only and ignore the second.
WORKAROUND: Using
Y X
instead is recommended practice and works around the bug.
FIX:
This previously unknown bug will be fixed (today) for the next
major release (4.0).
Thanks to Jack Jensen for letting us know about the problem.
Sorry for any inconvenience this may have caused....
[ David B. Anderson Silicon Graphics (415)335-1548 davea at sgi.com ]
[``What can go wrong?'' --Calvin to Hobbes]
More information about the Comp.std.c
mailing list