compiler bug

Norman Diamond diamond at jit345.swstokyo.dec.com
Wed Jan 23 14:12:14 AEST 1991


In article <1685 at svin02.info.win.tue.nl> debra at svin02.info.win.tue.nl (Paul de Bra) writes:

>struct a { int b, int c } d , e ;
      should be  ;
>main()
>{
>  int f;
>  f = (d=e).b;
>}

After correcting your bug, I saw the same error message that you saw.
Actually it's inherited from BSD's pcc, which is probably inherited
from System III's pcc (because the last time I touched a System V
machine, its pcc-based compiler accepted this usage of ".").

In ANSI C, (d=e) is a perfectly legal non-lvalue value, therefore (d=e).b
is also a perfectly legal non-lvalue value.  (I would say rvalue but ANSI C
doesn't use this word, except for a dangling reference in the index.)

(d=e),d.b  also yields a perfectly legal non-lvalue value, so I would
agree with your suggestion that it should be equivalent.

In K&R-I, the left operand of "." had to be an lvalue.  Therefore, if your
vendor does not claim ANSI conformance, it might not be a compiler bug.
--
Norman Diamond       diamond at tkov50.enet.dec.com
If this were the company's opinion, I wouldn't be allowed to post it.



More information about the Comp.std.c mailing list