public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 1x -Werror=unused-variable happens :-)
@ 2018-06-23 12:10 U.Mutlu
  2018-06-23 17:14 ` U.Mutlu
  2018-06-23 19:25 ` Jonathan Wakely
  0 siblings, 2 replies; 7+ messages in thread
From: U.Mutlu @ 2018-06-23 12:10 UTC (permalink / raw)
  To: gcc

Hi,
when building the languages=c,c++ with "-g0 -DNDEBUG", then the following 
error happens:

../../../gcc_trunk/libitm/method-serial.cc: In member function 'void 
GTM::gtm_thread::serialirr_mode()':
../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok' 
[-Werror=unused-variable]
        bool ok = disp->trycommit (priv_time);
             ^~

Of course one can get rid of it by giving also -Wno-error=unused-variable.


But nevertheless, someone more knowledgeable should check & possibly fix that 
assert related error:

       bool ok = disp->trycommit (priv_time);
       // Given that we're already serial, the trycommit better work.
       assert (ok);

I think maybe so:

       // Given that we're already serial, the trycommit better work.
#ifndef NDEBUG
       const bool ok = disp->trycommit (priv_time);
       assert (ok);
#else
       disp->trycommit (priv_time);
#endif


Btw, this is svn trunk with the default supporting libs.


-- 
U.Mutlu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 12:10 1x -Werror=unused-variable happens :-) U.Mutlu
@ 2018-06-23 17:14 ` U.Mutlu
  2018-06-24  6:13   ` U.Mutlu
  2018-06-23 19:25 ` Jonathan Wakely
  1 sibling, 1 reply; 7+ messages in thread
From: U.Mutlu @ 2018-06-23 17:14 UTC (permalink / raw)
  To: gcc

Here's another one, but different error type, for further inspection, in the 
same library as before:

../../../gcc_trunk/libitm/method-ml.cc: In member function 'virtual bool 
{anonymous}::ml_wt_dispatch::supports(unsigned int)':
../../../gcc_trunk/libitm/method-ml.cc:650:35: error: comparison is always 
true due to limited range of data type [-Werror=type-limits]
      return (number_of_threads * 2 <= ml_mg::OVERFLOW_RESERVE);
              ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~


Btw, this happens on a x86_64 host/target.


-- 
U.Mutlu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 12:10 1x -Werror=unused-variable happens :-) U.Mutlu
  2018-06-23 17:14 ` U.Mutlu
@ 2018-06-23 19:25 ` Jonathan Wakely
  2018-06-23 21:11   ` U.Mutlu
  1 sibling, 1 reply; 7+ messages in thread
From: Jonathan Wakely @ 2018-06-23 19:25 UTC (permalink / raw)
  To: um; +Cc: gcc

On Sat, 23 Jun 2018 at 12:39, U.Mutlu wrote:
>
> Hi,
> when building the languages=c,c++ with "-g0 -DNDEBUG", then the following
> error happens:
>
> ../../../gcc_trunk/libitm/method-serial.cc: In member function 'void
> GTM::gtm_thread::serialirr_mode()':
> ../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok'
> [-Werror=unused-variable]
>         bool ok = disp->trycommit (priv_time);
>              ^~
>
> Of course one can get rid of it by giving also -Wno-error=unused-variable.
>
>
> But nevertheless, someone more knowledgeable should check & possibly fix that
> assert related error:
>
>        bool ok = disp->trycommit (priv_time);
>        // Given that we're already serial, the trycommit better work.
>        assert (ok);
>
> I think maybe so:
>
>        // Given that we're already serial, the trycommit better work.
> #ifndef NDEBUG
>        const bool ok = disp->trycommit (priv_time);
>        assert (ok);
> #else
>        disp->trycommit (priv_time);
> #endif

No, because now the statement has to be maintained twice. This is what
__attribute__((unused)) is for.

This belongs in bugzilla really, not this mailing list.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 19:25 ` Jonathan Wakely
@ 2018-06-23 21:11   ` U.Mutlu
  2018-06-23 21:42     ` U.Mutlu
  0 siblings, 1 reply; 7+ messages in thread
From: U.Mutlu @ 2018-06-23 21:11 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc

Jonathan Wakely wrote on 06/23/2018 07:14 PM:
> On Sat, 23 Jun 2018 at 12:39, U.Mutlu wrote:
>>
>> Hi,
>> when building the languages=c,c++ with "-g0 -DNDEBUG", then the following
>> error happens:
>>
>> ../../../gcc_trunk/libitm/method-serial.cc: In member function 'void
>> GTM::gtm_thread::serialirr_mode()':
>> ../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok'
>> [-Werror=unused-variable]
>>          bool ok = disp->trycommit (priv_time);
>>               ^~
>>
>> Of course one can get rid of it by giving also -Wno-error=unused-variable.
>>
>>
>> But nevertheless, someone more knowledgeable should check & possibly fix that
>> assert related error:
>>
>>         bool ok = disp->trycommit (priv_time);
>>         // Given that we're already serial, the trycommit better work.
>>         assert (ok);
>>
>> I think maybe so:
>>
>>         // Given that we're already serial, the trycommit better work.
>> #ifndef NDEBUG
>>         const bool ok = disp->trycommit (priv_time);
>>         assert (ok);
>> #else
>>         disp->trycommit (priv_time);
>> #endif
>
> No, because now the statement has to be maintained twice. This is what
> __attribute__((unused)) is for.

Yes, true, got it.

> This belongs in bugzilla really, not this mailing list.

Ok, I'll do it shortly, after getting an account there first :-)


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 21:11   ` U.Mutlu
@ 2018-06-23 21:42     ` U.Mutlu
  2018-06-24 14:46       ` Jonathan Wakely
  0 siblings, 1 reply; 7+ messages in thread
From: U.Mutlu @ 2018-06-23 21:42 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: gcc

U.Mutlu wrote on 06/23/2018 09:25 PM:
> Jonathan Wakely wrote on 06/23/2018 07:14 PM:
>> On Sat, 23 Jun 2018 at 12:39, U.Mutlu wrote:
>>>
>>> Hi,
>>> when building the languages=c,c++ with "-g0 -DNDEBUG", then the following
>>> error happens:
>>>
>>> ../../../gcc_trunk/libitm/method-serial.cc: In member function 'void
>>> GTM::gtm_thread::serialirr_mode()':
>>> ../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok'
>>> [-Werror=unused-variable]
>>>          bool ok = disp->trycommit (priv_time);
>>>               ^~
>>>
>>> Of course one can get rid of it by giving also -Wno-error=unused-variable.
>>>
>>>
>>> But nevertheless, someone more knowledgeable should check & possibly fix that
>>> assert related error:
>>>
>>>         bool ok = disp->trycommit (priv_time);
>>>         // Given that we're already serial, the trycommit better work.
>>>         assert (ok);
>>>
>>> I think maybe so:
>>>
>>>         // Given that we're already serial, the trycommit better work.
>>> #ifndef NDEBUG
>>>         const bool ok = disp->trycommit (priv_time);
>>>         assert (ok);
>>> #else
>>>         disp->trycommit (priv_time);
>>> #endif
>>
>> No, because now the statement has to be maintained twice. This is what
>> __attribute__((unused)) is for.
>
> Yes, true, got it.
>
>> This belongs in bugzilla really, not this mailing list.
>
> Ok, I'll do it shortly, after getting an account there first :-)

Ok, bug report has just been filed, together with the above hint on how to fix it:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86293

Btw, of course I could fix that simple thing also myself, but I'm a newbie 
here :-),
and I think I don't have svn write access as I haven't applied for it yet.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 17:14 ` U.Mutlu
@ 2018-06-24  6:13   ` U.Mutlu
  0 siblings, 0 replies; 7+ messages in thread
From: U.Mutlu @ 2018-06-24  6:13 UTC (permalink / raw)
  To: gcc

U.Mutlu wrote on 06/23/2018 02:10 PM:
> Here's another one, but different error type, for further inspection, in the
> same library as before:
>
> ../../../gcc_trunk/libitm/method-ml.cc: In member function 'virtual bool
> {anonymous}::ml_wt_dispatch::supports(unsigned int)':
> ../../../gcc_trunk/libitm/method-ml.cc:650:35: error: comparison is always
> true due to limited range of data type [-Werror=type-limits]
>       return (number_of_threads * 2 <= ml_mg::OVERFLOW_RESERVE);
>               ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
>
>
> Btw, this happens on a x86_64 host/target.


Ok, a bugzilla bug report entry for this has just been filed:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86294


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: 1x -Werror=unused-variable happens :-)
  2018-06-23 21:42     ` U.Mutlu
@ 2018-06-24 14:46       ` Jonathan Wakely
  0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Wakely @ 2018-06-24 14:46 UTC (permalink / raw)
  To: um; +Cc: gcc

On Sat, 23 Jun 2018 at 22:11, U.Mutlu <um@mutluit.com> wrote:
>
> U.Mutlu wrote on 06/23/2018 09:25 PM:
> > Jonathan Wakely wrote on 06/23/2018 07:14 PM:
> >> On Sat, 23 Jun 2018 at 12:39, U.Mutlu wrote:
> >>>
> >>> Hi,
> >>> when building the languages=c,c++ with "-g0 -DNDEBUG", then the following
> >>> error happens:
> >>>
> >>> ../../../gcc_trunk/libitm/method-serial.cc: In member function 'void
> >>> GTM::gtm_thread::serialirr_mode()':
> >>> ../../../gcc_trunk/libitm/method-serial.cc:309:12: error: unused variable 'ok'
> >>> [-Werror=unused-variable]
> >>>          bool ok = disp->trycommit (priv_time);
> >>>               ^~
> >>>
> >>> Of course one can get rid of it by giving also -Wno-error=unused-variable.
> >>>
> >>>
> >>> But nevertheless, someone more knowledgeable should check & possibly fix that
> >>> assert related error:
> >>>
> >>>         bool ok = disp->trycommit (priv_time);
> >>>         // Given that we're already serial, the trycommit better work.
> >>>         assert (ok);
> >>>
> >>> I think maybe so:
> >>>
> >>>         // Given that we're already serial, the trycommit better work.
> >>> #ifndef NDEBUG
> >>>         const bool ok = disp->trycommit (priv_time);
> >>>         assert (ok);
> >>> #else
> >>>         disp->trycommit (priv_time);
> >>> #endif
> >>
> >> No, because now the statement has to be maintained twice. This is what
> >> __attribute__((unused)) is for.
> >
> > Yes, true, got it.
> >
> >> This belongs in bugzilla really, not this mailing list.
> >
> > Ok, I'll do it shortly, after getting an account there first :-)
>
> Ok, bug report has just been filed, together with the above hint on how to fix it:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86293

Thanks!

> Btw, of course I could fix that simple thing also myself, but I'm a newbie
> here :-),
> and I think I don't have svn write access as I haven't applied for it yet.
>
>

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2018-06-24  6:13 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-23 12:10 1x -Werror=unused-variable happens :-) U.Mutlu
2018-06-23 17:14 ` U.Mutlu
2018-06-24  6:13   ` U.Mutlu
2018-06-23 19:25 ` Jonathan Wakely
2018-06-23 21:11   ` U.Mutlu
2018-06-23 21:42     ` U.Mutlu
2018-06-24 14:46       ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).