You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Eric Lemings (JIRA)" <ji...@apache.org> on 2007/03/14 18:28:09 UTC

[jira] Created: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

[gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
---------------------------------------------------------------

                 Key: STDCXX-359
                 URL: https://issues.apache.org/jira/browse/STDCXX-359
             Project: C++ Standard Library
          Issue Type: Bug
          Components: Build, Tests
    Affects Versions: 4.1.2, 4.1.3
            Reporter: Eric Lemings
             Fix For: 4.2


The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.

     65 struct FmtSpec
     66 {
     67     // optional flags
     68     unsigned fl_minus  : 1;
...
     73 
     74     // optional length modifier
     75     enum Modifier {
     76         mod_none = 0,
     77         mod_h,       // short modifier
...
     86         mod_ext_I    // extension: int as ios::iostate
     87     };
     88 
     89     Modifier mod : 5;

(That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.

   2885     case 'S':   // %{S}, %{lS}, %{#*S}
   2886         if (   spec.mod == spec.mod_l
   2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
   2888             // std::wstring

This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.

Index: tests/src/printf.cpp
===================================================================
--- tests/src/printf.cpp        (revision 517771)
+++ tests/src/printf.cpp        (working copy)
@@ -2883,8 +2883,8 @@
         break;
 
     case 'S':   // %{S}, %{lS}, %{#*S}
-        if (   spec.mod == spec.mod_l
-            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
+        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
+            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
             // std::wstring
             spec.param.ptr_ = PARAM (ptr_, pva);
 


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481223 ] 

Eric Lemings commented on STDCXX-359:
-------------------------------------

It's the gcc-4.2 20070307 snapshot.  It's quite possible GCC developers could have made bitfield/boolean/enumeration conversions/promotions more stringent in the 4.2 series.

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481316 ] 

Eric Lemings commented on STDCXX-359:
-------------------------------------

Confirmed.  GCC 4.1.1 does not have a problem with the bitfield.  GCC 4.2 does.


> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Closed: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor closed STDCXX-359.
-------------------------------

    Resolution: Fixed

Assuming the committed patch successfully works around the gcc bug. If not, please reopen.

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Sebor reassigned STDCXX-359:
-----------------------------------

    Assignee: Martin Sebor

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481315 ] 

Eric Lemings commented on STDCXX-359:
-------------------------------------

Correction:

enum E { e };
struct S {
  E v:5;
};
S s;
int main() { if (!s.v) return 0; }


> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Eric Lemings updated STDCXX-359:
--------------------------------

    Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386

Forgot to fill in the Environment field.

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12480974 ] 

Martin Sebor commented on STDCXX-359:
-------------------------------------

The code is correct. It must be a gcc bug. What version of gcc are you using?

I think changing the code as you suggest would be fine, except that we want (spec.mod == FmtSpec::mod_none). It pays to run the test(s) after making a change ;-)

Index: tests/src/printf.cpp
===================================================================
--- tests/src/printf.cpp        (revision 517272)
+++ tests/src/printf.cpp        (working copy)
@@ -2883,8 +2883,8 @@
         break;
 
     case 'S':   // %{S}, %{lS}, %{#*S}
-        if (   spec.mod == spec.mod_l
-            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
+        if (   spec.mod == spec.mod_l || spec.mod == FmtSpec::mod_none
+            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
             // std::wstring
             spec.param.ptr_ = PARAM (ptr_, pva);


> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481306 ] 

Martin Sebor commented on STDCXX-359:
-------------------------------------

Sounds like the snapshot should give the same error for the well-formed program below:

enum E { e };
int main () { if (!e) return 0; }

Can you confirm? If that's so, the snapshot is buggy.

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481318 ] 

Martin Sebor commented on STDCXX-359:
-------------------------------------

Okay, great, thanks for the confirmation. You might want to open a bug report against gcc for this (and let us know the bug number/link for reference).

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12481313 ] 

Eric Lemings commented on STDCXX-359:
-------------------------------------

Well, to be more accurate:

enum E { e };
E v:5;
int main () { if (!v) return 0; } 


> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Martin Sebor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483630 ] 

Martin Sebor commented on STDCXX-359:
-------------------------------------

Thanks for the update. Here's a link to the gcc bug: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31273

> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (STDCXX-359) [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.

Posted by "Eric Lemings (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/STDCXX-359?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483629 ] 

Eric Lemings commented on STDCXX-359:
-------------------------------------

FYI.  GCC bug #31273 was opened for this issue.  The GCC maintainers have fixed it and are in the process of testing it for 4.2 release.


> [gcc/Mac OS X 10.4.8 Tiger] Can't convert FmtSpec::mod to bool.
> ---------------------------------------------------------------
>
>                 Key: STDCXX-359
>                 URL: https://issues.apache.org/jira/browse/STDCXX-359
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Build, Tests
>    Affects Versions: 4.1.3, 4.1.2
>         Environment: Darwin host.local 8.8.1 Darwin Kernel Version 8.8.1: Mon Sep 25 19:42:00 PDT 2006; root:xnu-792.13.8.obj~1/RELEASE_I386 i386 i386
>            Reporter: Eric Lemings
>         Assigned To: Martin Sebor
>             Fix For: 4.2
>
>
> The mod data member of the FmtSpec structure is defined in the tests/src/fmt_defs.h header file as shown below.
>      65 struct FmtSpec
>      66 {
>      67     // optional flags
>      68     unsigned fl_minus  : 1;
> ...
>      73 
>      74     // optional length modifier
>      75     enum Modifier {
>      76         mod_none = 0,
>      77         mod_h,       // short modifier
> ...
>      86         mod_ext_I    // extension: int as ios::iostate
>      87     };
>      88 
>      89     Modifier mod : 5;
> (That may be the first time I've ever seen a bitfield defined in terms of an enumeration.  But I digress...)  This member is checked in the tests/src/printf.cpp source file as shown here and fails to compile on Darwin platforms.
>    2885     case 'S':   // %{S}, %{lS}, %{#*S}
>    2886         if (   spec.mod == spec.mod_l
>    2887             || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>    2888             // std::wstring
> This should probably be coded as an explicit equality/comparison to the Modifier enumerators.  (Also there should probably be parentheses for explicit grouping around the logical OR (||) operands and the logical AND (&&} operands.  IIRC, the logical AND operator has precedence over the logical OR operator but I'm not sure.)  A patch is shown below.
> Index: tests/src/printf.cpp
> ===================================================================
> --- tests/src/printf.cpp        (revision 517771)
> +++ tests/src/printf.cpp        (working copy)
> @@ -2883,8 +2883,8 @@
>          break;
>  
>      case 'S':   // %{S}, %{lS}, %{#*S}
> -        if (   spec.mod == spec.mod_l
> -            || !spec.mod && spec.fl_pound && sizeof (wchar_t) == spec.width) {
> +        if (   spec.mod == spec.mod_l || spec.mod != FmtSpec::mod_none
> +            && spec.fl_pound && sizeof (wchar_t) == spec.width) {
>              // std::wstring
>              spec.param.ptr_ = PARAM (ptr_, pva);
>  

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.