<OriansJ>mihi: The only thing that would cause floating-point exception would be integer divides and mod operations; usually with an unsigned operation <mihi>ah ok, I noticed I can replace all integer divides by bitshifts and now I have a segfault :-O <OriansJ>that issue was supposed to be fixed with commit: 358b6cfb96e1685891a705a0bb31eda499d57974 <OriansJ>well M2-Planet doesn't allocate memory until told to do so; so if it is segment faulting it means only 1 of 2 things: 1) You are beyound the bounds of your array or 2) using a pointer that points outside of allocated memory. a stupid way to quickly check is just print to stderr the array index variable and compare the outputs of gcc and M2-Planet (They should be identical) and then it gets a bit harder to track down bad pointers <OriansJ>I'll try to take a more indepth look when I can get some free time tonight. <mihi>OriansJ, thanks :) Time for sleep now here :) <stikonas>hmm, looks like I can't build autoconf-2.54 yet... <stikonas>Makefile.am:21: require version 1.6c, but have 1.6.3 <stikonas>I guess that's pre-release of automake 1.7 <stikonas>argh, and automake 1.7 again requires autoconf 2.54... <stikonas>ok, at least automake 1.7 is almost trivial to patch to build with autoconf 2.53... <Hagfish>is there something unique about their release process that causes them to have almost self-referential dependencies? <OriansJ>My bet is shared developer who doesn't want to deal with backwards compatibility <stikonas>and I guess they thought, that everybody else can just run configure <OriansJ>midi: The goodnews is that the division issue is in :FOR_END_main_25 at 0x804bdac <OriansJ>which is the line: rsiz = 200 - algorithm / 4; <OriansJ>which becomes the segment fault when the line becomes: rsiz = 200 - (algorithm / 4); <OriansJ>which is in :FOR_THEN_sha3_keccakf_0 at the movsbl (%eax),%eax at address 0x804ab27 where it attempts to read from address 0 <OriansJ>that segfault is caused on line: v = cast_uint8_t_p(&st[i]); <OriansJ>and the next one is: v = cast_uint8_t_p(&st[i]); <OriansJ>(I purged whitespace characters too) <OriansJ>and // /* and //*/ are no longer needed with M2-Planet (unless you are in --bootstrap-mode or need to be built by cc_*) <OriansJ>as #if #else and #endif behave correctly now (Thanks to yt for giving M2-Planet a basic C preprocessor) <OriansJ>now unfortunately the hashes don't match with M2-Planet (really close though) <OriansJ>also c = fgetc(ff)) != EOF doesn't do what you would think it would in M2-Planet (hint: c = (fgetc(ff)) != EOF) ) <OriansJ>unless (c =fgetc(ff)) != EOF but oh well <OriansJ>The second set of hashes are very different <OriansJ>So now you have a non-segfaulting or floating point exception program that passes the first test but probably does the sha rounds wrong but should be something you would be able to solve 1 round at a time. ***ChanServ sets mode: +o rekado_
<mihi>OriansJ, thank you. I was not aware that I have to take extra care of operator precedence. In fact, after your two patches, the first hash still differs in one bit, but after adding some more &0xff, the first *two* hashes match :-) <mihi>the change in https://paste.debian.net/1189784/ is not preserving behaviour, as you copy a value and take a pointer to the copy, you need to copy the value back after the copy is altered through the pointer. But since the whole loop is a no-op on little-endian anyway... <stikonas>Hagfish: yes, we are using it a bit in live-bootstrap <stikonas>I'm struggling to go much further, starting to get more and more errors (I think due to old libtool which is not easy to upgrade at the moment) <stikonas>so after this #72 (and possibly updated gawk/tar, although, they are optional) I think we should try to get gcc/glibc <mihi>OriansJ, and the only issue remaining, when the file contains a 0xff byte, fgetc returns -1 which is treated as EOF... And that also happens when not cuddling the fgets into the loop expression. <mihi>patching fgetc in stdio.c to return ret & 0xff; fixes this as well. <mihi>now I have some work removing all the debug outputs again :) <mihi>OriansJ, do you want a pull request for the M2libc oneliner fix?