Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!sdrc!scjones
From: scjones@sdrc.UUCP (Larry Jones)
Newsgroups: comp.unix.microport
Subject: C Compiler Bug
Keywords: compiler bug bit-field assignment
Message-ID: <388@sdrc.UUCP>
Date: 20 Sep 88 21:54:24 GMT
Organization: Structural Dynamics Research Corp., Cincinnati
Lines: 30

Has anyone else run into a problem with bit-field assignments?  It seems
that the result of the assignment is not the value that was assigned to
the bit field as it should be, but rather the value of the int containing
the bit field as illustrated by the following program:

	#include 
	
	struct {
	   unsigned  :3;
	   unsigned a:1;
	   } x;
	
	main()
	   {
	
	   printf("Value of x.a = 1 is %d\n", x.a = 1);
	   }

	Value of x.a = 1 is 8

I've discovered this on System V/386 Version 2.2 - anyone know how pervasive
it is?  (Anyone have any good idea how to search mumblety thousand lines of
code for multiple assignments involving bit fields?)

----
Larry Jones                         UUCP: uunet!sdrc!scjones
SDRC                                      scjones@sdrc.uucp
2000 Eastman Dr.                    BIX:  ltl
Milford, OH  45150                  AT&T: (513) 576-2070
"Save the Quayles" - Mark Russell