f



ACE Core Typo Bug

ACE VERSION: 6.4.0

HOST MACHINE: ALL

SYNOPSIS:
Typo bitwise and instead of logical and.

DESCRIPTION:
https://fossies.org/dox/ACE+TAO-src-6.4.0/Time__Value_8inl_source.html

The =E2=80=9Cbitwise and=E2=80=9D (i.e. &) at line 61 should be a =E2=80=9C=
logical and=E2=80=9D (i.e &&)

REPEAT BY:
Code Review

SAMPLE FIX:
From 6cfd75bc1a5c717739f37a369ab82be4089c1a3d Mon Sep 17 00:00:00 2001
From: GaryN4=20
Date: Thu, 15 Sep 2016 15:43:46 +0100
Subject: [PATCH] Update Time_Value.inl

---
 ACE/ace/Time_Value.inl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
index 98459b4..f748f21 100644
--- a/ACE/ace/Time_Value.inl
+++ b/ACE/ace/Time_Value.inl
@@ -58,7 +58,7 @@ ACE_Time_Value::set (time_t sec, suseconds_t usec)
   this->tv_.tv_sec =3D sec;
   this->tv_.tv_usec =3D usec;
 #if __GNUC__ && !(__GNUC__ =3D=3D 3 && __GNUC_MINOR__ =3D=3D 4)
-  if ((__builtin_constant_p(sec) &
+  if ((__builtin_constant_p(sec) &&
        __builtin_constant_p(usec)) &&
       (sec >=3D 0 && usec >=3D 0 && usec < ACE_ONE_SECOND_IN_USECS))
     return;
0
gary
9/16/2016 9:44:54 AM
comp.soft-sys.ace 20326 articles. 1 followers. marlow.andrew (167) is leader. Post Follow

3 Replies
545 Views

Similar Articles

[PageSpeed] 16

Hi,

This is intended, see the history of this change, it is correct, if you hav=
e an use case where this fails, please extend ACE_wrappers/tests/Time_Value=
_Test.cpp and make a github pull request

Johnny

On Friday, September 16, 2016 at 11:45:08 AM UTC+2, gary wrote:
> ACE VERSION: 6.4.0
>=20
> HOST MACHINE: ALL
>=20
> SYNOPSIS:
> Typo bitwise and instead of logical and.
>=20
> DESCRIPTION:
> https://fossies.org/dox/ACE+TAO-src-6.4.0/Time__Value_8inl_source.html
>=20
> The =E2=80=9Cbitwise and=E2=80=9D (i.e. &) at line 61 should be a =E2=80=
=9Clogical and=E2=80=9D (i.e &&)
>=20
> REPEAT BY:
> Code Review
>=20
> SAMPLE FIX:
> From 6cfd75bc1a5c717739f37a369ab82be4089c1a3d Mon Sep 17 00:00:00 2001
> From: GaryN4=20
> Date: Thu, 15 Sep 2016 15:43:46 +0100
> Subject: [PATCH] Update Time_Value.inl
>=20
> ---
>  ACE/ace/Time_Value.inl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
> index 98459b4..f748f21 100644
> --- a/ACE/ace/Time_Value.inl
> +++ b/ACE/ace/Time_Value.inl
> @@ -58,7 +58,7 @@ ACE_Time_Value::set (time_t sec, suseconds_t usec)
>    this->tv_.tv_sec =3D sec;
>    this->tv_.tv_usec =3D usec;
>  #if __GNUC__ && !(__GNUC__ =3D=3D 3 && __GNUC_MINOR__ =3D=3D 4)
> -  if ((__builtin_constant_p(sec) &
> +  if ((__builtin_constant_p(sec) &&
>         __builtin_constant_p(usec)) &&
>        (sec >=3D 0 && usec >=3D 0 && usec < ACE_ONE_SECOND_IN_USECS))
>      return;

0
Johnny
9/16/2016 5:21:04 PM
Hi Johnny,

I found this bug from a clang warning:
#include "ace/Time_Value.h"

int main(int, char **)
{
  ACE_Time_Value tv;
  tv.set(100, 100);
}
-bash-4.2$  clang -Weverything -I <>/include/ test_ace.cpp

In file included from <>/include/ace/Time_Value.h:539:
<>/include/ace/Time_Value.inl:63:8: warning: will never be
      executed [-Wunreachable-code]
      (sec >=3D 0 && usec >=3D 0 && usec < ACE_ONE_SECOND_IN_USECS))


Gary

On Friday, September 16, 2016 at 6:21:07 PM UTC+1, Johnny Willemsen wrote:
> Hi,
>=20
> This is intended, see the history of this change, it is correct, if you h=
ave an use case where this fails, please extend ACE_wrappers/tests/Time_Val=
ue_Test.cpp and make a github pull request
>=20
> Johnny
>=20
> On Friday, September 16, 2016 at 11:45:08 AM UTC+2, gary wrote:
> > ACE VERSION: 6.4.0
> >=20
> > HOST MACHINE: ALL
> >=20
> > SYNOPSIS:
> > Typo bitwise and instead of logical and.
> >=20
> > DESCRIPTION:
> > https://fossies.org/dox/ACE+TAO-src-6.4.0/Time__Value_8inl_source.html
> >=20
> > The =E2=80=9Cbitwise and=E2=80=9D (i.e. &) at line 61 should be a =E2=
=80=9Clogical and=E2=80=9D (i.e &&)
> >=20
> > REPEAT BY:
> > Code Review
> >=20
> > SAMPLE FIX:
> > From 6cfd75bc1a5c717739f37a369ab82be4089c1a3d Mon Sep 17 00:00:00 2001
> > From: GaryN4=20
> > Date: Thu, 15 Sep 2016 15:43:46 +0100
> > Subject: [PATCH] Update Time_Value.inl
> >=20
> > ---
> >  ACE/ace/Time_Value.inl | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >=20
> > diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
> > index 98459b4..f748f21 100644
> > --- a/ACE/ace/Time_Value.inl
> > +++ b/ACE/ace/Time_Value.inl
> > @@ -58,7 +58,7 @@ ACE_Time_Value::set (time_t sec, suseconds_t usec)
> >    this->tv_.tv_sec =3D sec;
> >    this->tv_.tv_usec =3D usec;
> >  #if __GNUC__ && !(__GNUC__ =3D=3D 3 && __GNUC_MINOR__ =3D=3D 4)
> > -  if ((__builtin_constant_p(sec) &
> > +  if ((__builtin_constant_p(sec) &&
> >         __builtin_constant_p(usec)) &&
> >        (sec >=3D 0 && usec >=3D 0 && usec < ACE_ONE_SECOND_IN_USECS))
> >      return;

0
garynicholls
9/19/2016 3:15:31 PM
Hi,

Please create a pull request at https://github.com/DOCGroup/ACE_TAO

Johnny

On Friday, September 16, 2016 at 11:45:08 AM UTC+2, gary wrote:
> ACE VERSION: 6.4.0
>=20
> HOST MACHINE: ALL
>=20
> SYNOPSIS:
> Typo bitwise and instead of logical and.
>=20
> DESCRIPTION:
> https://fossies.org/dox/ACE+TAO-src-6.4.0/Time__Value_8inl_source.html
>=20
> The =E2=80=9Cbitwise and=E2=80=9D (i.e. &) at line 61 should be a =E2=80=
=9Clogical and=E2=80=9D (i.e &&)
>=20
> REPEAT BY:
> Code Review
>=20
> SAMPLE FIX:
> From 6cfd75bc1a5c717739f37a369ab82be4089c1a3d Mon Sep 17 00:00:00 2001
> From: GaryN4=20
> Date: Thu, 15 Sep 2016 15:43:46 +0100
> Subject: [PATCH] Update Time_Value.inl
>=20
> ---
>  ACE/ace/Time_Value.inl | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>=20
> diff --git a/ACE/ace/Time_Value.inl b/ACE/ace/Time_Value.inl
> index 98459b4..f748f21 100644
> --- a/ACE/ace/Time_Value.inl
> +++ b/ACE/ace/Time_Value.inl
> @@ -58,7 +58,7 @@ ACE_Time_Value::set (time_t sec, suseconds_t usec)
>    this->tv_.tv_sec =3D sec;
>    this->tv_.tv_usec =3D usec;
>  #if __GNUC__ && !(__GNUC__ =3D=3D 3 && __GNUC_MINOR__ =3D=3D 4)
> -  if ((__builtin_constant_p(sec) &
> +  if ((__builtin_constant_p(sec) &&
>         __builtin_constant_p(usec)) &&
>        (sec >=3D 0 && usec >=3D 0 && usec < ACE_ONE_SECOND_IN_USECS))
>      return;

0
Johnny
9/23/2016 6:45:16 AM
Reply: