| --- Thu Jan 24 2013 | 00:00 | |
| LunaVorax | Hi | 06:47 |
|---|---|---|
| wpwrak | hmm. seems that i've found a code generation bug in gcc :-( (cross-compiling for the ben) | 06:57 |
| wpwrak | given a code fragment tricky = foo; if (blah) tricky = bar; is adds the equivalent of else tricky = tricky; | 06:58 |
| wpwrak | unfortunately, "tricky" is a register (with volatile and all that) ... | 06:59 |
| wpwrak | ... PDFUNS, to be precise. and it very much resents this sort of treatment. | 07:05 |
| whitequark | wpwrak: sounds like an optimizer gone wrong | 07:59 |
| whitequark | I'm fairly sure that volatile semantics (apart from being inapplicable for I/O memory) forbids that | 08:00 |
| larsc | wpwrak: can you paste the code? | 09:31 |
| wpwrak | whitequark: yes, looks like the optimizer got confused. i think my code indicates things correctly. need to see if i may have been a bit overzealous with the volatile, though. (not that this would be an excuse, but it may have made life unnecessarily hard for the poor compiler.) | 11:50 |
| wpwrak | but first the morning mails and some caffeine ... | 11:50 |
| wpwrak | i need a senility check. given this code fragment: http://pastebin.pl/72768 | 13:28 |
| wpwrak | if you compile it with gcc 4.6.3 or gcc 4.7.2, e.g., for amd64 or mipsel, gcc reads from *ptr. my understanding is that it's not supposed to do that. anyone disagrees ? | 13:30 |
| wpwrak | btw, with llvm 3.0, i get the code i expect. in fact, llvm is a bit too zealous and treats "ptr" as volatile as well | 13:31 |
| wpwrak | (compiling with -O9) | 13:32 |
| Fallenou | hum it seems gcc should only write to ptr | 13:44 |
| wpwrak | 2:1 against gcc's interpretation :) or 3:1 if we count llvm. | 13:53 |
| larsc | there is probably a clause somewhere in the standard that permits this | 13:57 |
| larsc | and gcc sticks to the standard and not to what is practical | 13:57 |
| wpwrak | the standard is pretty fuzzy about "volatile" | 13:58 |
| wpwrak | and gcc's documentation is more confusing than helpful there. http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/Volatiles.html | 13:59 |
| wpwrak | particularly the memory barrier example is puzzling. it would seem that just making that pointer volatile ought to do the trick. yet ... | 14:00 |
| larsc | I even get the problem without the first *ptr = 1; | 14:07 |
| larsc | ah, no misread the generated cod | 14:08 |
| larsc | e | 14:08 |
| larsc | It's a bit strange anyway on ARM it generates "movne r2, #2; ldreq r2, [r3]; str r2, [r3]" while the shorter "movne r2, #2; strne r2, [r3]" would be correct | 14:10 |
| wpwrak | yeah, it really really wants to do that read :) | 14:12 |
| wpwrak | an obsessive-compulsive anti-optimization | 14:13 |
| larsc | whitequark: ruby got almost 50% https://github.com/search?p=&q=path:.ssh/id_rsa&type=Repositories | 14:14 |
| wpwrak | grmbl. in 2010, this was a theoretical issue. seems that we've progressed beyond that. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44943 | 14:21 |
| whitequark | larsc: compare with total count of repositories by language | 14:26 |
| whitequark | idiots are distributed roughly evenly ;) | 14:26 |
| whitequark | larsc: what actually worries me is Puppet. because sysadmins gotta know it better. | 14:27 |
| larsc | whitequark: turns out I copy pasted the link to fast, the path: filter doesn't seem to work | 14:27 |
| larsc | it's just text somewhere in a readme file | 14:27 |
| whitequark | larsc: the actual link has the majority in ruby too | 14:28 |
| whitequark | larsc: btw I'm not even sure why does it has the same distribution or shows ruby at all. That stuff should be in dotfiles theoretically... | 14:35 |
| qi-bot | [commit] Werner Almesberger: ubb-la/Makefile (CFLAGS): -O9 is currently unsafe; use -O1 (master) http://qi-hw.com/p/ben-blinkenlights/e1eea4f | 18:37 |
| qi-bot | [commit] Werner Almesberger: ubb-patgen/Makefile (CFLAGS): -O9 is currently unsafe; use -O1 (master) http://qi-hw.com/p/ben-blinkenlights/00ef01a | 18:37 |
| wpwrak | of course, now my delay measurements are probably off ... | 18:37 |
| larsc | can't you just work around the bug? | 19:08 |
| wpwrak | i could change the API. e.g., instead of PDFUNS = foo; it would become write_reg(PDFUNS, foo), etc. | 19:12 |
| wpwrak | but i kinda like to keep those register accesses nice and simple. besides, a lot of other people are probably using quite similar things. | 19:12 |
| wpwrak | so the work-around for now is to drop the optimization level | 19:13 |
| wpwrak | (API change) or do things like #define PDFUNS(x) write_reg(__PDFUNS, x). a little less ugly, but still. also, there may be other registers outside the GPIO group that don't have nice *ptr = *ptr semantics either | 19:18 |
| wpwrak | only that those might be even harder to spot | 19:18 |
| wpwrak | hmm. still getting trouble despite the -O1 :-( | 20:20 |
| qi-bot | [commit] Werner Almesberger: ubb-la/Makefile (CFLAGS): even -O1 isn't safe; use -O0 instead (master) http://qi-hw.com/p/ben-blinkenlights/bac21bf | 20:38 |
| Action: wpwrak hates compiler bugs | 20:38 | |
| larsc | hates bugs | 20:39 |
| larsc | some can be amusing though | 20:39 |
| wpwrak | especially those you find in other people's code :) (and even more so if what you do doesn't depend on their code) | 20:41 |
| wpwrak | well, this one has quite interesting effects. what happens is that the bad accesses to PDFUNS mess up the keyboard. in ubb-la, this means that the "press key to abort" functionality i'm adding mis-fires. (and of course, the keyboard in general doesn't behave very well after that involuntary reconfiguration) | 20:43 |
| wpwrak | i also saw this earlier in ubb-patgen, but didn't realize what it was. there, it caused Enter to repeat endlessly. that's why the invocation of ubb-patgen at the end of http://downloads.qi-hardware.com/people/werner/ubb/patgen/ubb-patgen-demo.jpg | 20:45 |
| wpwrak | wasn't actually run (the waveform is from an earlier run) | 20:46 |
| wpwrak | well, at least that's the theory. haven't verified yet whether this is really what happened there. | 20:46 |
| qi-bot | [commit] Werner Almesberger: ubb-la/ubb-la.c: add command-line options, keyboard abort (master) http://qi-hw.com/p/ben-blinkenlights/62284fb | 21:27 |
| qi-bot | [commit] Maarten ter Huurne: Changed text color of warnings from yellow to magenta (packages) http://qi-hw.com/p/gmenu2x/a18730e | 22:29 |
| qi-bot | [commit] Maarten ter Huurne: Made GMenu2X::menu private (packages) http://qi-hw.com/p/gmenu2x/e4d78be | 22:29 |
| qi-bot | [commit] Maarten ter Huurne: Ignore OPK files of which the name starts with a dot (packages) http://qi-hw.com/p/gmenu2x/90ec4b9 | 22:29 |
| qi-bot | [commit] Werner Almesberger: ubb-patgen/Makefile (CFLAGS): even -O1 isn't safe; use -O0 instead (master) http://qi-hw.com/p/ben-blinkenlights/fc4b8e7 | 23:09 |
| qi-bot | [commit] Werner Almesberger: ubb-la/ubb-la.c (do_buf): skip over the first 122 samples (master) http://qi-hw.com/p/ben-blinkenlights/4ce6866 | 23:09 |
| qi-bot | [commit] Werner Almesberger: ubb-la/README: brief description of ubb-la (master) http://qi-hw.com/p/ben-blinkenlights/0702675 | 23:09 |
| --- Fri Jan 25 2013 | 00:00 | |
Generated by irclog2html.py 2.9.2 by Marius Gedminas - find it at mg.pov.lt!