[filesystem.v3] v1.49 Path constructor issue in VS Debug configuration

Hello, The changes made to filesystem/v3/src/path.cpp between v1.48 and v1.49 seem to be causing a crash if I initialise a path as e.g. a global variable or as a static class member, but only for a Debug build. (I'm using VS10 on 64-bit Win 7). The following program exhibits this behaviour: |#include "boost/filesystem/v3/path.hpp" boost::filesystem::path p("p"); int main() { return 0; } | In Debug, I can see that the third path constructor calls |codecvt()|, which calls |wchar_t_codecvt_facet()|, which returns |codecvt_facet|. However, |codecvt_facet| hasn't been initialised at this point. This appears to only be the case for Debug builds though. I'm unclear as to whether this is an MSVC bug though. I thought that the Standard required |codecvt_facet| to have been initialised before |wchar_t_codecvt_facet()| since it comes earlier in the same translation unit. Could someone please clarify whether I should file a bug report with boost please? Thanks, Fraser.

On Sun, Mar 11, 2012 at 10:46:36AM +0000, Fraser Hutchison wrote:
Hello,
The changes made to filesystem/v3/src/path.cpp between v1.48 and v1.49 seem to be causing a crash if I initialise a path as e.g. a global variable or as a static class member, but only for a Debug build. (I'm using VS10 on 64-bit Win 7). The following program exhibits this behaviour:
|#include "boost/filesystem/v3/path.hpp" boost::filesystem::path p("p"); int main() { return 0; } | In Debug, I can see that the third path constructor calls |codecvt()|, which calls |wchar_t_codecvt_facet()|, which returns |codecvt_facet|. However, |codecvt_facet| hasn't been initialised at this point. This appears to only be the case for Debug builds though.
I've reproduced this after release but not had the time to jot together a bug report yet, just some ranting on IRC.
I'm unclear as to whether this is an MSVC bug though. I thought that the Standard required |codecvt_facet| to have been initialised before |wchar_t_codecvt_facet()| since it comes earlier in the same translation unit.
Could someone please clarify whether I should file a bug report with boost please?
Please do, and you could always make a Connect bug against MSVC. It should be possible to make a non-Boost standalone test case with use of codecvt() in the dynamic initialization phase. Poking STL (the person) might also be beneficial, as this probably falls under the standard library. -- Lars Viklund | zao@acc.umu.se

On 11/03/2012 12:17, Lars Viklund wrote:
On Sun, Mar 11, 2012 at 10:46:36AM +0000, Fraser Hutchison wrote:
Hello,
The changes made to filesystem/v3/src/path.cpp between v1.48 and v1.49 seem to be causing a crash if I initialise a path as e.g. a global variable or as a static class member, but only for a Debug build. (I'm using VS10 on 64-bit Win 7). The following program exhibits this behaviour:
|#include "boost/filesystem/v3/path.hpp" boost::filesystem::path p("p"); int main() { return 0; } | In Debug, I can see that the third path constructor calls |codecvt()|, which calls |wchar_t_codecvt_facet()|, which returns |codecvt_facet|. However, |codecvt_facet| hasn't been initialised at this point. This appears to only be the case for Debug builds though. I've reproduced this after release but not had the time to jot together a bug report yet, just some ranting on IRC.
I'm unclear as to whether this is an MSVC bug though. I thought that the Standard required |codecvt_facet| to have been initialised before |wchar_t_codecvt_facet()| since it comes earlier in the same translation unit.
Could someone please clarify whether I should file a bug report with boost please? Please do, and you could always make a Connect bug against MSVC. It should be possible to make a non-Boost standalone test case with use of codecvt() in the dynamic initialization phase. Poking STL (the person) might also be beneficial, as this probably falls under the standard library.
Looks like it's already in: https://svn.boost.org/trac/boost/ticket/6638 - I've just added a comment to that bug. If I get a chance, I'll submit a Connect bug also. Thanks, Fraser.
participants (2)
-
Fraser Hutchison
-
Lars Viklund