edA-qa mort-ora-y via llvm-dev
2016-Jul-03 10:34 UTC
[llvm-dev] clib `open` writes a linefeed to stdout when used in the JIT
I'm having a problem with my code generating empty lines and it appears to be the CLib `open` function generating an empty line when used within the JIT-VM. If I compile my program to an exe file it doesn't happen. I also have a lot of other code running in the VM without this problem, it's somehow particular to `open`. A chunk of my IR that calls `open`: defer_body_26: ; preds = %defer_end_11 %59 = load i8*, i8** %f8686688__enc_n %60 = getelementptr inbounds i8, i8* %59, i64 16 %61 = call i32 @open(i8* %60, i32 577, i32 511) store i32 %61, i32* %f8686688__f br label %defer_block_25 Where elsewhere I have `declare i32 @open(i8*, i32, i32)`. Any ideas on what could possible be causing this? I'm using LLVM3.8 with GCC 5.3.1 on Ubuntu 16.04. -- edA-qa mort-ora-y http://mortoray.com/ Leaf - the language we always wanted http://leaflang.org/
edA-qa mort-ora-y via llvm-dev
2016-Jul-03 10:43 UTC
[llvm-dev] clib `open` writes a linefeed to stdout when used in the JIT
Okay, at least it's not the execution but building causing the problem. I'm trying to locate the precise point (maybe I have an errant print statement). On 03/07/16 12:34, edA-qa mort-ora-y via llvm-dev wrote:> I'm having a problem with my code generating empty lines and it appears > to be the CLib `open` function generating an empty line when used within > the JIT-VM. If I compile my program to an exe file it doesn't happen. I > also have a lot of other code running in the VM without this problem, > it's somehow particular to `open`. > > A chunk of my IR that calls `open`: > > defer_body_26: ; preds = %defer_end_11 > %59 = load i8*, i8** %f8686688__enc_n > %60 = getelementptr inbounds i8, i8* %59, i64 16 > %61 = call i32 @open(i8* %60, i32 577, i32 511) > store i32 %61, i32* %f8686688__f > br label %defer_block_25 > > > Where elsewhere I have `declare i32 @open(i8*, i32, i32)`. > > Any ideas on what could possible be causing this? > > I'm using LLVM3.8 with GCC 5.3.1 on Ubuntu 16.04. >-- edA-qa mort-ora-y http://mortoray.com/ Leaf - the language we always wanted http://leaflang.org/
edA-qa mort-ora-y via llvm-dev
2016-Jul-03 10:45 UTC
[llvm-dev] clib `open` writes a linefeed to stdout when used in the JIT
It was my mistake. A leftover debug printing end empty line near the IR generation code that happens to only be invoked on a function like `open`. On 03/07/16 12:43, edA-qa mort-ora-y via llvm-dev wrote:> Okay, at least it's not the execution but building causing the problem. > I'm trying to locate the precise point (maybe I have an errant print > statement). > > On 03/07/16 12:34, edA-qa mort-ora-y via llvm-dev wrote: >> I'm having a problem with my code generating empty lines and it appears >> to be the CLib `open` function generating an empty line when used within >> the JIT-VM. If I compile my program to an exe file it doesn't happen. I >> also have a lot of other code running in the VM without this problem, >> it's somehow particular to `open`. >> >> A chunk of my IR that calls `open`: >> >> defer_body_26: ; preds = %defer_end_11 >> %59 = load i8*, i8** %f8686688__enc_n >> %60 = getelementptr inbounds i8, i8* %59, i64 16 >> %61 = call i32 @open(i8* %60, i32 577, i32 511) >> store i32 %61, i32* %f8686688__f >> br label %defer_block_25 >> >> >> Where elsewhere I have `declare i32 @open(i8*, i32, i32)`. >> >> Any ideas on what could possible be causing this? >> >> I'm using LLVM3.8 with GCC 5.3.1 on Ubuntu 16.04. >> >-- edA-qa mort-ora-y http://mortoray.com/ Leaf - the language we always wanted http://leaflang.org/