on master help sign in
Merge pull request #1549 from fatho/fix/master/c-codegen-closing-parenthesis

Added missing parenthesis in C code generation.

commit4694a3695995fd4591dad3cb2bad43ef8b7f4a15 authorEdwin Brady <edwin.brady@gmail.com> dateTue 30 Sep 2014, 23:29 (12 years ago) parent840c2cc10662e8
4 files changed+14−1
src/IRTS/CodegenC.hs+1−1 test/reg052/expected+1 test/reg052/reg052.idr+8 test/reg052/run+4
src/IRTS/CodegenC.hs+1−1
@@ -438,7 +438,7 @@ doOp v (LSExt (ITFixed from) ITChar) [x]
438438doOp v (LSExt (ITFixed from) (ITFixed to)) [x]
439439 | nativeTyWidth from < nativeTyWidth to = bitCoerce v "S" from to x
440440doOp v (LZExt ITNative (ITFixed to)) [x]
441− = v ++ "idris_b" ++ show (nativeTyWidth to) ++ "const(vm, (uintptr_t)GETINT(" ++ creg x ++ ")"
441+ = v ++ "idris_b" ++ show (nativeTyWidth to) ++ "const(vm, (uintptr_t)GETINT(" ++ creg x ++ "))"
442442doOp v (LZExt ITChar (ITFixed to)) [x]
443443 = doOp v (LZExt ITNative (ITFixed to)) [x]
444444doOp v (LZExt (ITFixed from) ITNative) [x]
test/reg052/expectednew file+1
@@ -0,0 +1 @@
1+42
test/reg052/reg052.idrnew file+8
@@ -0,0 +1,8 @@
1+impure_op : Bits64 -> IO Bits64
2+impure_op foo = return $ foo + 1
3+
4+impure_int : IO Int
5+impure_int = return 41
6+
7+main : IO ()
8+main = impure_int >>= impure_op . prim__zextInt_B64 >>= print
test/reg052/runnew file+4
@@ -0,0 +1,4 @@
1+#!/usr/bin/env bash
2+idris $@ -o reg052 reg052.idr
3+./reg052
4+rm -f reg052 *.ibc