[GHC] #14234: Enable -Wconversion for GHC's C code

GHC ghc-devs at haskell.org
Thu Sep 14 19:25:23 UTC 2017


#14234: Enable -Wconversion for GHC's C code
-------------------------------------+-------------------------------------
           Reporter:  nh2            |             Owner:  (none)
               Type:  task           |            Status:  new
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  8.2.1
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 Because apparently none of `-Wall`, `-Wextra` or `-pedantic` of GCC imply
 `-Wconversion` or its subset `-Wsign-conversion`:
 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=51625

 That means currently you can call a function taking an `unsigned int` with
 a `signed int` without getting any warning.

 That is very bad, because of course negative numbers will overflow.

 Having `-Wconversion` would have caught overflow errors such as this one:
 https://phabricator.haskell.org/D3955#110993

 We should probably have it for the C code.

 Turning it on everywhere will be quite some work though because it creates
 lots of complaints such as `long long int` not being the same as `long
 int` (which is technically correct but in practice they are typically the
 same).

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


More information about the ghc-tickets mailing list