This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C] Fix PR57258: unused variable warning is emitted for volatile variables
- From: Mingjie Xing <mingjie dot xing at gmail dot com>
- To: "Joseph S. Myers" <joseph at codesourcery dot com>, Richard Biener <richard dot guenther at gmail dot com>
- Cc: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 8 Nov 2013 09:13:28 +0800
- Subject: Re: [C] Fix PR57258: unused variable warning is emitted for volatile variables
- Authentication-results: sourceware.org; auth=none
- References: <CADNgcEwhF9u2S=f3GdLtWo98BBQs-BVdzRh7-mspQHBAHhUYaw at mail dot gmail dot com> <CAFiYyc1OtvdCoawpsSStPF=qZJN+DHJUy_Hn=6a=9Tmk0uPp6g at mail dot gmail dot com> <CADNgcEzv0gdtADDwE1V4yn1ruwVE32eOocXk_HmLtcPhDiWu3w at mail dot gmail dot com> <Pine dot LNX dot 4 dot 64 dot 1311071335560 dot 17103 at digraph dot polyomino dot org dot uk>
2013/11/7 Joseph S. Myers <joseph@codesourcery.com>:
> On Thu, 7 Nov 2013, Mingjie Xing wrote:
>
>> 2013/11/6 Richard Biener <richard.guenther@gmail.com>:
>> > You miss a testcase.
>> >
>> > Also why should the warning be omitted for unused automatic
>> > volatile variables? They cannot be used in any way.
>> >
>> > Richard.
>>
>> Thanks. I've updated the patch with a test case.
>
> You don't seem to have answered Richard's question about why the change is
> desirable in the first place.
Well, it is my understanding that the warning should be emitted for a
volatile variable only if it is not accessed. Initialization means
accessing, even though it is not used anywhere.
Mingjie