[GHC] #9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.9 Keywords: | Operating System: Windows Architecture: Unknown/Multiple | Type of failure: Difficulty: Unknown | None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- swprintf has different signatures in mingw32, where it does not include the buffer size, and in mingw-w64, where it does. That of course breaks the code as mingw-w64 treats the pointer to the format string as a size_t. Bummer: C:/.../inplace/mingw/i686-w64-mingw32/include/swprintf.inl:30:5: note: expected 'size_t' but argument is of type 'short unsigned int *' int swprintf (wchar_t *__stream, size_t __count, const wchar_t *__format, ...) ^ rts\Linker.c:1986:12: warning: passing argument 2 of 'swprintf' makes integer from pointer without a cast [enabled by default] swprintf(buf, L"lib%s.DLL", dll_name); I have a fix pending to use snwprintf instead. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
Another variant is to #define _CRT_NON_CONFORMING_SWPRINTFS for this (I use it). Cheers, Kyra On 10/26/2014 1:21 AM, GHC wrote:
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: Runtime System | Version: 7.9 Keywords: | Operating System: Windows Architecture: Unknown/Multiple | Type of failure: Difficulty: Unknown | None/Unknown Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- swprintf has different signatures in mingw32, where it does not include the buffer size, and in mingw-w64, where it does. That of course breaks the code as mingw-w64 treats the pointer to the format string as a size_t. Bummer:
C:/.../inplace/mingw/i686-w64-mingw32/include/swprintf.inl:30:5: note: expected 'size_t' but argument is of type 'short unsigned int *' int swprintf (wchar_t *__stream, size_t __count, const wchar_t *__format, ...) ^
rts\Linker.c:1986:12: warning: passing argument 2 of 'swprintf' makes integer from pointer without a cast [enabled by default] swprintf(buf, L"lib%s.DLL", dll_name);
I have a fix pending to use snwprintf instead.
-- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler _______________________________________________ ghc-tickets mailing list ghc-tickets@haskell.org http://www.haskell.org/mailman/listinfo/ghc-tickets
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.9 System | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: Windows | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Comment (by awson): {{{#define _CRT_NON_CONFORMING_SWPRINTFS}}} also solves the problem. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.9 System | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: Windows | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D372 | -------------------------------------+------------------------------------- Changes (by gintas): * differential: => Phab:D372 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: new Priority: normal | Milestone: Component: Runtime | Version: 7.9 System | Keywords: Resolution: | Architecture: Unknown/Multiple Operating System: Windows | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D372 | -------------------------------------+------------------------------------- Comment (by Austin Seipp <austin@…>): In [changeset:"5ce1266a7d323fd4fe4262f07be908d65e5b5b43/ghc"]: {{{ #!CommitTicketReference repository="ghc" revision="5ce1266a7d323fd4fe4262f07be908d65e5b5b43" Use snwprintf instead of swprintf in rts/Linker.c. Summary: swprintf has different signatures in mingw32, where it does not include the buffer size, and in mingw-w64, where it does. That of course breaks the code as mingw-w64 treats the pointer to the format string as a size_t. snwprintf is available in both environments and is consistent, so use that instead. Reviewers: simonmar, austin Reviewed By: austin Subscribers: #ghc_windows_task_force, thomie, carter, simonmar Differential Revision: https://phabricator.haskell.org/D372 GHC Trac Issues: #9726 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#9726: Linker.c uses of swprintf() fail to compile on gcc 4.8.3 -------------------------------------+------------------------------------- Reporter: gintas | Owner: gintas Type: bug | Status: closed Priority: normal | Milestone: Component: Runtime | Version: 7.9 System | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: Windows | Difficulty: Unknown Type of failure: | Blocked By: None/Unknown | Related Tickets: Test Case: | Blocking: | Differential Revisions: Phab:D372 | -------------------------------------+------------------------------------- Changes (by gintas): * status: new => closed * resolution: => fixed Comment: Thanks. I slightly prefer using swnprintf() to the #define since it's safer and generally seems cleaner... -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9726#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (2)
-
GHC -
kyra