You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by "Martin Sebor (JIRA)" <ji...@apache.org> on 2007/06/26 02:48:25 UTC

[jira] Created: (STDCXX-462) std::time_get example exposes undefined behavior

std::time_get example exposes undefined behavior
------------------------------------------------

                 Key: STDCXX-462
                 URL: https://issues.apache.org/jira/browse/STDCXX-462
             Project: C++ Standard Library
          Issue Type: Bug
          Components: Documentation
    Affects Versions: 4.1.2, 4.1.3
            Reporter: Martin Sebor
            Priority: Critical


The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:

Martin Sebor wrote:
> Farid Zaripov wrote:
[...]
>>   Btw below is a part of the conforming program (taken from
>> time_get.cpp)?
> 
> It's not a conforming program. The locale must stay around as
> long as the last reference to the facet obtained from it. The
> tests that fail to follow this rule should be changed.
> 
>>
>> -------------------
>>     const std::time_get<char, Iter> &tg =
>>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>>
>>     // Display time_base::dateorder value.
>>     std::cout << "time_base::dateorder == " << tg.date_order () <<
>> ".\n";
>> -------------------
>>
>>   This fragment fails on Dinkumware STL because of tg.date_order() uses
>> (internal)
>> pointer to the destroyed locale object.
> 
> Right, and that's allowed.


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


[jira] Resolved: (STDCXX-462) std::time_get example exposes undefined behavior

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

Farid Zaripov resolved STDCXX-462.
----------------------------------

    Resolution: Fixed

Documentation updated thus: http://svn.apache.org/viewvc?rev=570219&view=rev

> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.2, 4.1.3
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>             Fix For: 4.2
>
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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


[jira] Closed: (STDCXX-462) std::time_get example exposes undefined behavior

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

Farid Zaripov closed STDCXX-462.
--------------------------------


> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.2, 4.1.3
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>             Fix For: 4.2
>
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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


Re: [jira] Closed: (STDCXX-462) std::time_get example exposes undefined behavior

Posted by Martin Sebor <se...@roguewave.com>.
Farid Zaripov (JIRA) wrote:
>      [ https://issues.apache.org/jira/browse/STDCXX-462?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
> 
> Farid Zaripov closed STDCXX-462.
> --------------------------------

FYI, this is a documentation bug. We need to change the code
on the Class Reference page as well:
http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html

It sure would be nice to figure out a way to automate these
updates between the example sources and the code in the docs.
A couple of possible approaches are here:
http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03284.html

Any other ideas?

Martin

> 
> 
>> std::time_get example exposes undefined behavior
>> ------------------------------------------------
>>
>>                 Key: STDCXX-462
>>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>>             Project: C++ Standard Library
>>          Issue Type: Bug
>>          Components: Documentation
>>    Affects Versions: 4.1.3, 4.1.2
>>            Reporter: Martin Sebor
>>            Assignee: Farid Zaripov
>>            Priority: Critical
>>             Fix For: 4.2
>>
>>
>> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
>> Martin Sebor wrote:
>>> Farid Zaripov wrote:
>> [...]
>>>>   Btw below is a part of the conforming program (taken from
>>>> time_get.cpp)?
>>> It's not a conforming program. The locale must stay around as
>>> long as the last reference to the facet obtained from it. The
>>> tests that fail to follow this rule should be changed.
>>>
>>>> -------------------
>>>>     const std::time_get<char, Iter> &tg =
>>>>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
>>>>
>>>>     // Display time_base::dateorder value.
>>>>     std::cout << "time_base::dateorder == " << tg.date_order () <<
>>>> ".\n";
>>>> -------------------
>>>>
>>>>   This fragment fails on Dinkumware STL because of tg.date_order() uses
>>>> (internal)
>>>> pointer to the destroyed locale object.
>>> Right, and that's allowed.
> 


[jira] Closed: (STDCXX-462) std::time_get example exposes undefined behavior

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

Farid Zaripov closed STDCXX-462.
--------------------------------


> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.3, 4.1.2
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>             Fix For: 4.2
>
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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


[jira] Resolved: (STDCXX-462) std::time_get example exposes undefined behavior

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

Farid Zaripov resolved STDCXX-462.
----------------------------------

       Resolution: Fixed
    Fix Version/s: 4.2

Fixed thus: http://svn.apache.org/viewvc?view=rev&rev=550774

> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.3, 4.1.2
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>             Fix For: 4.2
>
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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


[jira] Reopened: (STDCXX-462) std::time_get example exposes undefined behavior

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

Martin Sebor reopened STDCXX-462:
---------------------------------


Reopened. From http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03786.html:

FYI, this is a documentation bug. We need to change the code on the Class Reference page as well:
http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html

> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.3, 4.1.2
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>             Fix For: 4.2
>
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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


[jira] Assigned: (STDCXX-462) std::time_get example exposes undefined behavior

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

Farid Zaripov reassigned STDCXX-462:
------------------------------------

    Assignee: Farid Zaripov

> std::time_get example exposes undefined behavior
> ------------------------------------------------
>
>                 Key: STDCXX-462
>                 URL: https://issues.apache.org/jira/browse/STDCXX-462
>             Project: C++ Standard Library
>          Issue Type: Bug
>          Components: Documentation
>    Affects Versions: 4.1.3, 4.1.2
>            Reporter: Martin Sebor
>            Assignee: Farid Zaripov
>            Priority: Critical
>
> The example program demonstrating the use of the std::time_get facet (http://incubator.apache.org/stdcxx/doc/stdlibref/time-get.html) exposes undefined behavior. Quoting from the following post http://www.mail-archive.com/stdcxx-dev@incubator.apache.org/msg03760.html:
> Martin Sebor wrote:
> > Farid Zaripov wrote:
> [...]
> >>   Btw below is a part of the conforming program (taken from
> >> time_get.cpp)?
> > 
> > It's not a conforming program. The locale must stay around as
> > long as the last reference to the facet obtained from it. The
> > tests that fail to follow this rule should be changed.
> > 
> >>
> >> -------------------
> >>     const std::time_get<char, Iter> &tg =
> >>         std::use_facet<std::time_get<char, Iter> >(std::locale ("C"));
> >>
> >>     // Display time_base::dateorder value.
> >>     std::cout << "time_base::dateorder == " << tg.date_order () <<
> >> ".\n";
> >> -------------------
> >>
> >>   This fragment fails on Dinkumware STL because of tg.date_order() uses
> >> (internal)
> >> pointer to the destroyed locale object.
> > 
> > Right, and that's allowed.

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