jemc changed the topic of #ponylang to: Welcome! Please check out our Code of Conduct => https://github.com/ponylang/ponyc/blob/master/CODE_OF_CONDUCT.md | Public IRC logs are available => http://irclog.whitequark.org/ponylang | Please consider participating in our mailing lists => https://pony.groups.io/g/pony
jemc has quit [Ping timeout: 240 seconds]
Praetonus has quit [Quit: Leaving]
jmiven has quit [Quit: co'o]
jmiven has joined #ponylang
jemc has joined #ponylang
jemc has quit [Ping timeout: 258 seconds]
Matthias247 has quit [Read error: Connection reset by peer]
kulibali has quit [Quit: Going offline, see ya! (www.adiirc.com)]
jemc has joined #ponylang
jemc has quit [Ping timeout: 246 seconds]
amclain has quit [Quit: Leaving]
jemc has joined #ponylang
doublec has quit [Quit: leaving]
c355e3b has quit [Quit: Connection closed for inactivity]
jemc has quit [Ping timeout: 260 seconds]
jemc has joined #ponylang
doublec has joined #ponylang
TwoNotes has joined #ponylang
avsej has quit [Ping timeout: 250 seconds]
avsej has joined #ponylang
avsej has joined #ponylang
TwoNotes has quit [Quit: Leaving.]
jemc has quit [Ping timeout: 245 seconds]
otremblay has quit [Ping timeout: 258 seconds]
otremblay has joined #ponylang
unbalanced has joined #ponylang
omarkj_ has joined #ponylang
SeanTAllen_ has joined #ponylang
omarkj has quit [Ping timeout: 258 seconds]
Fuuzetsu has quit [Ping timeout: 258 seconds]
unbalancedparen has quit [Read error: Connection reset by peer]
srenatus[m] has quit [Ping timeout: 258 seconds]
SeanTAllen has quit [Ping timeout: 258 seconds]
ohir has quit [Ping timeout: 258 seconds]
SeanTAllen_ is now known as SeanTAllen
omarkj_ is now known as omarkj
ohir has joined #ponylang
ohir has joined #ponylang
Fuuzetsu has joined #ponylang
srenatus[m] has joined #ponylang
_andre has joined #ponylang
c355e3b has joined #ponylang
jemc has joined #ponylang
Praetonus has joined #ponylang
TwoNotes has joined #ponylang
<TwoNotes> Re issue #1445, what is the correct syntax combining cstring, _offset, and _unsafe to do the fix for this?
Perelandric has joined #ponylang
<Perelandric> jemc: Do string literals not produce a null terminated string?
<TwoNotes> There was a recent change to the way Strings are stored.
<Praetonus> Perelandric: String literals are null terminated
<Praetonus> TwoNotes: cstring()._unsafe()._offset(...) should do the trick
<TwoNotes> Hmm, that did not help.
<TwoNotes> I edited the file in /usr/local/lib/pony
<TwoNotes> I notice that the string "1.00" has a _size of 4 and an _alloc of 5
<Perelandric> Thanks Praetonus. If the string is terminated, and `cstring()` just returns the `_ptr` in that case, I'm not seeing the difference it would make.
<Praetonus> There are some strange things happening here
<Perelandric> I get _size=4 _space=4 is_null_terminated=true. Definitely weird.
<Perelandric> That is, size() and space() are 4.
<TwoNotes> Version 0.9.0?
<TwoNotes> I am running ponyc 0.9.0 on Ubuntu 16.04 on arm7hf
<Perelandric> I'm using: 0.9.0-e8b6604 [release], built yesterday, LinuxMint 18
<Perelandric> I should point out that I have LLVM 3.8.0, which I know is a no-no.
<Perelandric> Oh wait, that's not weird since it subtracts out the null pointer byte.
<Perelandric> TwoNotes: Are you using the tagged release of 0.9.0, or a master branch build?
<TwoNotes> I compiled it myself - it says 0.9.0-de0c867
<TwoNotes> I just did a 'git pull'
<TwoNotes> It is compiled with LLVM 3.7.1
<TwoNotes> Looking at the float value as hex, it is 0x00800000
<TwoNotes> I will checkout "0.9.0" so I get a consistent set of sources and try again
emancu has joined #ponylang
TwoNotes has quit [Quit: Leaving.]
TwoNotes has joined #ponylang
<TwoNotes> After rebuilding using the tagged 0.9.0, I get the same result.
Matthias247 has joined #ponylang
<TwoNotes> I confirm that there actually are null bytes at the end of the strings. Yet @strtof returns the wrong value
<Praetonus> TwoNotes: Maybe that's a locale issue
amclain has joined #ponylang
<TwoNotes> Locale is en_US.UTF-8
emancu has quit []
_andre has quit [Quit: leaving]
<TwoNotes> @strtof( "1.00".cstring(), 0) returns 1.17549e-38
<SeanTAllen> what's the actual code TwoNotes ?
<SeanTAllen> ie
<SeanTAllen> the full line
<TwoNotes> fi = @strtof( "1.00".cstring(), 0 )
<TwoNotes> Where 'fi' is a var F32
<TwoNotes> If I change what is in the string, the value returned is different, but still tiny
<SeanTAllen> that shouldnt comple
<jemc> could it be that the string issue is a red herring? maybe we have a problem with FFI functions that return F32 on ARM?
<SeanTAllen> you should get an error about that 0
<SeanTAllen> 'Cannot pass number literals as unchecked FFI arguments'
<TwoNotes> jemc I was thinkg the same thing, but this code of mine USED to work. Then I rebuilt the system switching from Arch to Ubuntu
<jemc> SeanTAllen: not if he has a `use` declaration for his FFI function that gives the type of each arg and return value
<SeanTAllen> do you have that TwoNotes ?
<TwoNotes> Yes. I copied the use deifnition out of string.pony
<jemc> in `string.pony`, the declaration is `use @strtof[F32](nptr: Pointer[U8] box, endptr: USize)`
<TwoNotes> I changed 'box' to 'tag' is all, sincee that is what cstring returns
<TwoNotes> I just wanted to eliminate the complexity of what the whole F32 function was doing.
<jemc> weirdly enough, strtof documentation seems to say the second arg should be a `char**` - maybe this is the underlying issue
<TwoNotes> jemc, but NULL is a legal value there
<TwoNotes> Read further down under 'Parameters'
<jemc> okay, makes sense - and as a sanity check, is it guaranteed that `sizeof(size_t) == sizeof(char**)` on all platforms - I *think* so, but just wanted to raise the question
<jemc> pretty sure `size_t` means integer-the-same-size-as-a-pointer, but just wanted to confirm
<TwoNotes> It is a 32 bit platform
kulibali has joined #ponylang
prose[m] has quit [Remote host closed the connection]
M-Ingo has quit [Remote host closed the connection]
M-hrjet has quit [Remote host closed the connection]
srenatus[m] has quit [Read error: Connection reset by peer]
irx[m] has quit [Remote host closed the connection]
buchanon[m] has quit [Write error: Connection reset by peer]
<jemc> TwoNotes: can you try printing `USize.bitwidth()` on your ARM platform?
<jemc> (and tell us what is being used)
<jemc> I just want to confirm that we are getting the size of `USize` right for your platform.
<TwoNotes> 32
<TwoNotes> uname identifies it as an arm7l
<TwoNotes> 32 is correct. Ubuntu runs the Rpi3 in 32bit mode
<TwoNotes> All this works correctly on x86_64 by the way. It is something specific to ARM, or the ubuntu libraries there
<TwoNotes> The is a difference in the behavior of @strtof. And several months ago before I rebuilt the system, this same code worked
<jemc> TwoNotes: if you write a small C program that calls strtof, does it work correctly?
<jemc> if it's also broken from C, then the solution is simply to remove the strtof dependency and implement the functions in pure pony, which I've already captured as a goal here: https://github.com/ponylang/ponyc/issues/1449
<jemc> however, it would be good to know if this is a more insidious problem with our FFI
<TwoNotes> It works correctly in C
<TwoNotes> I took the sample code from that Debian page, and put "1.00" in as the string
<TwoNotes> So maybe the problem in is in the FFI mechanism. Are there platform ifdefs in there?
<TwoNotes> The C code gets identical rusults on the two platforms. The Pony code does not
<Praetonus> TwoNotes: Can you get the assembly code for both String.f32 and your C program that calls strtof?
<Praetonus> And the LLVM IR if you're using Clang
<Praetonus> You might need to compile the Pony program with --extfun if you're doing an optimised build
<TwoNotes> I will do that. Later tonight tho
irx[m] has joined #ponylang
Lordovos has joined #ponylang
srenatus[m] has joined #ponylang
prose[m] has joined #ponylang
M-Ingo has joined #ponylang
M-hrjet has joined #ponylang
buchanon[m] has joined #ponylang
Praetonus has quit [Quit: Leaving]
TwoNotes has quit [Quit: Leaving.]
jemc has quit [Ping timeout: 265 seconds]