This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: unitialised error


Falk Hueffner <hueffner@informatik.uni-tuebingen.de> writes:

> Ken Foskey <foskey@optushome.com.au> writes:
> 
> > The following code gives me an uninitialised warning on nCol.  There is
> > no possible default clause for this one.
> >
> > switch( nXIndex & 3 )
> > {
> > 	case 0 :
> > 		nCol = *pTmp >> 6;
> > 		break;
> > 	case 1 :
> > 		nCol = ( *pTmp >> 4 ) & 0x03 ;
> > 		break;
> >
> > 	case 2 :
> > 		nCol = ( *pTmp >> 2 ) & 0x03;
> > 		break;
> > 	case 3 :
> > 		nCol = ( *pTmp++ ) & 0x03;
> > 		break;
> > }
> 
> There will always be cases where gcc guesses wrong on this; it is not
> only very hard, but provably impossible to get it always right.


However I get no such warnings for the same code, not with gcc 3.4,
    3.3.3, or very old 2.95.3 .


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]