🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #49785

warnings about unused variables

#49785
From: Christoph Martin
Date: Thu, 09 Dec 1993 16:28
50 lines
1490 bytes
In the following code gcc and g++ both find the uninitialized variable
y but not i and j.

------------------------------

void foo (int x)
{
}

void bar (unsigned int a)
{
  int i, j, y;
  
  {
    i += j;
  }
  {
    int x = y + j;
    switch (y)
    {
    case 1: x = 1;
      break;
    default:
      x = 0;
    }
    foo (x);
  }
}

int main()
{
  return 0;
}

------------------------------

gcc -Wall -O uninit.c -o uninit
uninit.c: In function `bar':
uninit.c:7: warning: `y' may be used uninitialized in this function

------------------------------

What is the problem?

	Christoph


============================================================================
Christoph Martin, Zentrum f"ur Datenverarbeitung, Uni-Mainz, Germany
Internet: martin@goofy.zdv.uni-mainz.de
Technical Details
Message-ID: <2e7jmn$cpu@bambi.zdv.Uni-Mainz.DE>
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!math.fu-berlin.de!news.th-darmstadt.de!news.uni-mainz.de!perdita!martin

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,6561dd7f31b36367,start
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1993-12-10 06:44:29 PST
Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!zib-berlin.de!math.fu-berlin.de!news.th-darmstadt.de!news.uni-mainz.de!perdita!martin
From: martin@perdita (Christoph Martin)
Newsgroups: gnu.gcc.help
Subject: warnings about unused variables
Date: 9 Dec 1993 16:28:07 GMT
Organization: Johannes Gutenberg-Universitaet Mainz, Germany
Lines: 50
Message-ID: <2e7jmn$cpu@bambi.zdv.Uni-Mainz.DE>
NNTP-Posting-Host: perdita.zdv.uni-mainz.de
Keywords: unused variables
X-Newsreader: TIN [version 1.2 PL2]