[GHC] #14267: CLong is not what it seems on Windows

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Keywords: | Operating System: Windows Architecture: | Type of failure: Documentation Unknown/Multiple | bug Test Case: | Blocked By: Blocking: | Related Tickets: #14262 Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- [https://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-C-Types.html#... The docs of CLong] say {{{ newtype CLong = CLong Int64 Haskell type representing the C long type. }}} But on 64-bit Windows, [https://stackoverflow.com/questions/384502/what- is-the-bit-size-of-long-on-64-bit-windows#384672 long is 32 bits]. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): I've marked it "documentation bug" for now but we should probably check all places where types are converted to `CLong`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:1 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by slyfox): I wonder if it's just how haddock expands INTEGRAL_TYPE on amd64-linux: {{{#!hs -- | Haskell type representing the C @long@ type. INTEGRAL_TYPE(CLong,HTYPE_LONG) }}} I suspect on i386-linux haddock would say Int32. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by bgamari): * cc: Phyx- (added) * milestone: => 8.4.1 -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:3 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Phyx-): These types are generated by configure checks, so they're dependent on the machine that builds the docs. On a Windows machine it says {{{ /* Define to Haskell type for long */ #define HTYPE_LONG Int32 }}} so the types are fine, and the documentation would be correct if it was generated on Windows. This is a short coming of the haddock infrastructure and the main reason I do not like configure based packages. Also this isn't the biggest problem at all, the documentation of the Win32 package is mostly always wrong, since it's generated on Linux, so it points to base documentation for Linux. I have added disclaimers to the primitive types on Win32. Maybe one should be added here as well. Internally these types are to be avoided and instead use fixed width C99 types, which is what the majority of the Windows code is being converted to. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:4 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by nh2): Phew, that is great to hear.
Maybe one should be added here as well.
That sounds like a great idea; improved the documentation for the `Foreign.C.Types` module that makes this obvious would have saved us some worry over in `#ghc` :) -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:5 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): Replying to [comment:5 nh2]:
That sounds like a great idea; improved the documentation for the `Foreign.C.Types` module that makes this obvious would have saved us some worry over in `#ghc` :)
It //is// documented. See http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-C-Types.html#g... -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:6 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#14267: CLong is not what it seems on Windows -------------------------------------+------------------------------------- Reporter: nh2 | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.2.1 Resolution: invalid | Keywords: Operating System: Windows | Architecture: Type of failure: Documentation | Unknown/Multiple bug | Test Case: Blocked By: | Blocking: Related Tickets: #14262 | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by nh2): * status: new => closed * resolution: => invalid Comment: Replying to [comment:6 RyanGlScott]:
It //is// documented. See http://hackage.haskell.org/package/base-4.10.0.0/docs/Foreign-C-Types.html#g...
Oops, nevermind then. My mistake, I didn't spot it. Closing. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14267#comment:7 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler
participants (1)
-
GHC