This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: unitialised error
Ken Foskey <foskey@optushome.com.au> writes:
> On Fri, 2004-07-02 at 15:35, llewelly@xmission.com wrote:
>
> > However I get no such warnings for the same code, not with gcc 3.4,
> > 3.3.3, or very old 2.95.3 .
>
> You need to turn on optimisation and -Wuninitialized
I had optimization and -Wuninitialized. Here was the full compile
line:
cd /home/llewelly/llewelly/cc_moderated/
g++-3.4 -O2 -W -Wall -Wuninitialized foskey.cc
Compilation finished at Fri Jul 2 07:41:03
(I just re-verified)
Maybe the surrounding code you didn't paste affected the diagnostic. I
completed your original example like this:
int main()
{
int nXIndex;
int nCol;
int Tmp;
int *pTmp;
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;
}
Tmp= nCol;
}