[GHC] #5188: Runtime error when allocating lots of memory

GHC ghc-devs at haskell.org
Tue Sep 3 23:05:05 CEST 2013


#5188: Runtime error when allocating lots of memory
---------------------------------+---------------------------
        Reporter:  knyblad       |            Owner:
            Type:  bug           |           Status:  patch
        Priority:  low           |        Milestone:  7.6.2
       Component:  GHCi          |          Version:  6.12.1
      Resolution:                |         Keywords:
Operating System:  Linux         |     Architecture:  x86
 Type of failure:  None/Unknown  |       Difficulty:  Unknown
       Test Case:                |       Blocked By:
        Blocking:                |  Related Tickets:
---------------------------------+---------------------------

Comment (by rwbarton):

 Right, the issue is that on amd64/Linux, `sizeof(nat)` is 4 and
 `sizeof(W_)` is 8, so overflow can never occur, which gcc warns about, and
 validate builds with `-Wextra -Werror`.  Annoying.

 Austin and I discussed this on IRC and here are a couple possible
 workarounds we came up with.

 1. Wrap the test in an `#if` that tests `sizeof(nat)` and `sizeof(W_)` to
 determine whether overflow is possible.  Portable, but fiddly.

 2. Disable gcc warnings using `#pragma GCC diagnostic` pragmas around the
 test, themselves conditionalized to gcc.  Less fiddly, but GHC doesn't
 currently use this method to disable any warnings and I somewhat hesitate
 to be the first.  I also haven't tested that this really works.

-- 
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/5188#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler




More information about the ghc-tickets mailing list