Re: unitialised error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ken Foskey <foskey@xxxxxxxxxxxxxxxx> writes:

> On Fri, 2004-07-02 at 15:35, llewelly@xxxxxxxxxxxx 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;

  }

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux