[Pkg-haskell-maintainers] Bug#623067: Generated haskell code fails compiling with -Werror
Erik de Castro Lopo
erikd at mega-nerd.com
Sun Apr 17 05:50:22 UTC 2011
Package: alex
Version: 2.3.5-1
Severity: normal
Tags: patch
Generated code fails when compiled with ghc-7.0.3 as follows:
Warning: Bindings containing unlifted types should use an outermost bang pattern:
(base) = alexIndexInt32OffAddr alex_base s
In the expression:
let
(base) = alexIndexInt32OffAddr alex_base s
((I# (ord_c))) = ord c
(offset) = (base +# ord_c)
....
in
case new_s of {
-1# -> (new_acc, input)
_ -> alex_scan_tkn
user orig_input (len +# 1#) new_input new_s new_acc }
In a case alternative:
Just (c, new_input)
-> let
(base) = alexIndexInt32OffAddr alex_base s
((I# (ord_c))) = ord c
....
in
case new_s of {
-1# -> (new_acc, input)
_ -> alex_scan_tkn
user orig_input (len +# 1#) new_input new_s new_acc }
Bug has been reported and the attached patch has already been submitted
upstream as:
http://trac.haskell.org/haskell-platform/ticket/171
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=ANSI_X3.4-1968) (ignored: LC_ALL set to C)
Shell: /bin/sh linked to /bin/dash
Versions of packages alex depends on:
ii libc6 2.11.2-11 Embedded GNU C Library: Shared lib
ii libffi5 3.0.9-3 Foreign Function Interface library
ii libgmp10 2:5.0.1+dfsg-7 Multiprecision arithmetic library
alex recommends no packages.
alex suggests no packages.
-- no debconf information
-------------- next part --------------
# Author : Erik de Castro Lopo <erikd at mega-nerd.com>
# Description : Fix generated haskell code so it doesn't fail with -Werror.
# Debian Version : 2.3.5
# Date : Sun, 17 Apr 2011 15:45:41 +1000
Index: alex-2.3.5/templates/GenericTemplate.hs
===================================================================
--- alex-2.3.5.orig/templates/GenericTemplate.hs
+++ alex-2.3.5/templates/GenericTemplate.hs
@@ -9,7 +9,7 @@
#ifdef ALEX_GHC
#define ILIT(n) n#
-#define FAST_INT_BINDING(n) (n)
+#define FAST_INT_BINDING(n) (!(n))
#define IBOX(n) (I# (n))
#define FAST_INT Int#
#define LT(n,m) (n <# m)
@@ -57,10 +57,10 @@
ALEX_IF_BIGENDIAN
narrow16Int# i
where
- i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
- high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
- low = int2Word# (ord# (indexCharOffAddr# arr off'))
- off' = off *# 2#
+ !i = word2Int# ((high `uncheckedShiftL#` 8#) `or#` low)
+ !high = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
+ !low = int2Word# (ord# (indexCharOffAddr# arr off'))
+ !off' = off *# 2#
ALEX_ELSE
indexInt16OffAddr# arr off
ALEX_ENDIF
@@ -74,14 +74,14 @@
ALEX_IF_BIGENDIAN
narrow32Int# i
where
- i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`
+ !i = word2Int# ((b3 `uncheckedShiftL#` 24#) `or#`
(b2 `uncheckedShiftL#` 16#) `or#`
(b1 `uncheckedShiftL#` 8#) `or#` b0)
- b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))
- b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))
- b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
- b0 = int2Word# (ord# (indexCharOffAddr# arr off'))
- off' = off *# 4#
+ !b3 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 3#)))
+ !b2 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 2#)))
+ !b1 = int2Word# (ord# (indexCharOffAddr# arr (off' +# 1#)))
+ !b0 = int2Word# (ord# (indexCharOffAddr# arr off'))
+ !off' = off *# 4#
ALEX_ELSE
indexInt32OffAddr# arr off
ALEX_ENDIF
More information about the Pkg-haskell-maintainers
mailing list