home *** CD-ROM | disk | FTP | other *** search
/ minnie.tuhs.org / unixen.tar / unixen / PDP-11 / Bug_Fixes / Net.v7bugs / 0054 < prev    next >
Encoding:
Text File  |  1982-01-08  |  979 b   |  27 lines

  1. Autah-cs.156
  2. net.bugs.v7
  3. utzoo!decvax!duke!chico!harpo!utah-cs!lepreau
  4. Wed Jan  6 12:17:38 1982
  5. Re: sizeof type botch (utzoo.1248)
  6. We decided that this is a compiler bug and fixed it.  What prompted this
  7. rash action is that the "bug" has disastrous consequences for a
  8. canonical Unix code sequence:
  9.  
  10. /* Read a "record" (struct), then back up to the beginning of it */
  11. /* in order to update it in place.                 */
  12.      read(fd, (char *) &record, sizeof record);
  13.      lseek(fd, (long) -(sizeof record), 1);
  14.  
  15. Because the sizeof expr was unsigned, you seek to a very large positive number!
  16. (Of course one can write:  -((long) sizeof record) but it's easy to forget...)
  17. The obvious negative aspect of this change is that sizeof (objects > 32K)
  18. doesn't work, but we think that's the lesser evil.  One can always do
  19. (sizeof(array[0]) * ARRAYLEN).
  20. -------------
  21. The fix follows, to c01.c.
  22. 43c43
  23. <         t1->type = UNSIGN;
  24. ---
  25. >         t1->type = INT;        /* was UNSIGN;     J.Lepreau 5/81 */
  26. -------------
  27.