Article View: gnu.gcc.help
Article #49760Re: warnings about unused variables
From: michael butler
Date: Sun, 12 Dec 1993 15:59
Date: Sun, 12 Dec 1993 15:59
25 lines
1558 bytes
1558 bytes
Christoph Martin (martin@perdita) writes: : In the following code gcc and g++ both find the uninitialized variable : y but not i and j. [ .. code deleted .. ] : 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? No problem .. hint: add '-finline-functions' and no warnings will be issued at all :-). The optimizer (on which flow and usage analysis depends) has removed any instances of the variables because they are obviously (to the compiler) not being used for anything with any effect out of the 'local' context. Stated another way, this means that without the optimizer in play, the compiler doesn't have sufficient information to judge if something's initialized or not. With it, the variables cease to exist at all, michael
Technical Details
Message-ID:
<CHxJ3F.LFo@asstdc.scgt.oz.au>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!news.belwue.de!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!spool.mu.edu!sgiblab!munnari.oz.au!metro!asstdc.scgt.oz.au!imbReferences:
<2e7jmn$cpu@bambi.zdv.Uni-Mainz.DE>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,6561dd7f31b36367 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-12-15 07:33:58 PST Newsgroups: gnu.gcc.help Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!news.belwue.de!zib-berlin.de!netmbx.de!Germany.EU.net!EU.net!howland.reston.ans.net!spool.mu.edu!sgiblab!munnari.oz.au!metro!asstdc.scgt.oz.au!imb From: imb@asstdc.scgt.oz.au (michael butler) Subject: Re: warnings about unused variables References: <2e7jmn$cpu@bambi.zdv.Uni-Mainz.DE> Organization: Assorted C Software, Sydney NSW Date: Sun, 12 Dec 1993 15:59:38 GMT X-Newsreader: TIN [version 1.2 PL2] Message-ID: <CHxJ3F.LFo@asstdc.scgt.oz.au> Lines: 25