Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Stephen White
I put a drive-by comment on the bug, but here's my understanding: gcc 4.4 now has -fstrict-aliasing on by default, whereas it was off by default in 4.2. gcc's behaviour, while annoying, is actually correct in this case: the C++ spec says that pointers to different types may not alias, and gcc

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Dan Kegel
On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org wrote: 2)  Most of the supposed performance advantage of strict aliasing rules is probably taken care of by memory disambiguation in modern (ie., Core2 and later) CPUs. I kind of doubt that. Disallowing aliasing lets the

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Mark Mentovai
Dan Kegel wrote: On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org wrote: 2)  Most of the supposed performance advantage of strict aliasing rules is probably taken care of by memory disambiguation in modern (ie., Core2 and later) CPUs. I kind of doubt that.  

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Evan Martin
On Wed, Jan 13, 2010 at 9:22 AM, Mark Mentovai m...@chromium.org wrote: Dan Kegel wrote: On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org wrote: 2)  Most of the supposed performance advantage of strict aliasing rules is probably taken care of by memory disambiguation

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Dan Kegel
On Wed, Jan 13, 2010 at 9:42 AM, Evan Martin e...@chromium.org wrote: With that in mind I think we should explicitly use -fno-strict-aliasing until someone is willing to take the time to run buildbots, track down regressions, etc. +1 for -fno-strict-aliasing until someone fixes most/all of the

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Wan-Teh Chang
On Wed, Jan 13, 2010 at 9:42 AM, Evan Martin e...@chromium.org wrote: With that in mind I think we should explicitly use -fno-strict-aliasing until someone is willing to take the time to run buildbots, track down regressions, etc. for the other configuration. I tend to agree. Many

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Craig Schlenter
On Wed, Jan 13, 2010 at 7:42 PM, Evan Martin e...@chromium.org wrote: [snip] With that in mind I think we should explicitly use -fno-strict-aliasing until someone is willing to take the time to run buildbots, track down regressions, etc. for the other configuration. I have a patch to do this

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Stephen White
On Wed, Jan 13, 2010 at 12:19 PM, Dan Kegel d...@kegel.com wrote: On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org wrote: 2) Most of the supposed performance advantage of strict aliasing rules is probably taken care of by memory disambiguation in modern (ie., Core2

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Antoine Labour
On Wed, Jan 13, 2010 at 10:06 AM, Stephen White senorbla...@chromium.orgwrote: On Wed, Jan 13, 2010 at 12:19 PM, Dan Kegel d...@kegel.com wrote: On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org wrote: 2) Most of the supposed performance advantage of strict aliasing

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Peter Kasting
On Wed, Jan 13, 2010 at 9:42 AM, Evan Martin e...@chromium.org wrote: At the code level I think it's not too hard for us to be aliasing correct (people like Craig have already fixed all of the places where we were wrong, and we have tools like bit_cast in basictypes.h to make it not too

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Craig Schlenter
On Wed, Jan 13, 2010 at 8:34 PM, Antoine Labour pi...@google.com wrote: On Wed, Jan 13, 2010 at 10:06 AM, Stephen White senorbla...@chromium.org wrote: On Wed, Jan 13, 2010 at 12:19 PM, Dan Kegel d...@kegel.com wrote: On Wed, Jan 13, 2010 at 9:12 AM, Stephen White senorbla...@chromium.org

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Antoine Labour
On Wed, Jan 13, 2010 at 10:53 AM, Craig Schlenter craig.schlen...@gmail.com wrote: On Wed, Jan 13, 2010 at 8:34 PM, Antoine Labour pi...@google.com wrote: On Wed, Jan 13, 2010 at 10:06 AM, Stephen White senorbla...@chromium.org wrote: On Wed, Jan 13, 2010 at 12:19 PM, Dan Kegel

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Peter Kasting
On Wed, Jan 13, 2010 at 10:53 AM, Craig Schlenter craig.schlen...@gmail.com wrote: I'm one try-server run away from possibly turning -fno-strict-aliasing on for all linux/bsd gcc: http://codereview.chromium.org/519034 From a process standpoint, given that there is some disagreement here is

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Mark Mentovai
I don't think that a firing squad will materialize over this change, but if one does, I'll quell them for you. LGTM in principle (but I haven't seen the actual change). Mark Craig Schlenter wrote: On Wed, Jan 13, 2010 at 9:00 PM, Peter Kasting pkast...@google.com wrote: On Wed, Jan 13, 2010

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Peter Kasting
On Wed, Jan 13, 2010 at 11:22 AM, Craig Schlenter craig.schlen...@chromium.org wrote: Other than the immediate gain of hiding crbug.com/28749, Which you have a patch (actually two, but one with r+) for, right? I think the biggest benefit is that end users relying on 4.4 builds are likely

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Evan Martin
On Wed, Jan 13, 2010 at 11:00 AM, Peter Kasting pkast...@google.com wrote: On Wed, Jan 13, 2010 at 10:53 AM, Craig Schlenter craig.schlen...@gmail.com wrote: I'm one try-server run away from possibly turning -fno-strict-aliasing on for all linux/bsd gcc: http://codereview.chromium.org/519034

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Peter Kasting
On Wed, Jan 13, 2010 at 11:28 AM, Evan Martin e...@chromium.org wrote: PS: I'd be willing to flip the flag just after we do the next beta channel push and see how many more problems we get because of it. But in general, if it doesn't buy us any performance and it does cause hard-to-track-down

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Craig Schlenter
On Wed, Jan 13, 2010 at 9:28 PM, Peter Kasting pkast...@google.com wrote: On Wed, Jan 13, 2010 at 11:22 AM, Craig Schlenter craig.schlen...@chromium.org wrote: Other than the immediate gain of hiding crbug.com/28749, Which you have a patch (actually two, but one with r+) for, right? True. I

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-13 Thread Peter Kasting
On Wed, Jan 13, 2010 at 12:07 PM, Craig Schlenter craig.schlen...@gmail.com wrote: Do we have other aliasing problems? If so my opinion changes. There are some aliasing issues still in play. Off the top of my head: 1. unit_tests has what might be an issue in stl_tree.h or a compiler issue

[chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-12 Thread Evan Martin
In this bug http://code.google.com/p/chromium/issues/detail?id=28749 It seems we're running afoul of a more finicky compiler not liking some tricks we're playing with objects and memory in LazyInstance. (You can skip down to comment #30 or so to get to the meat of it -- above that point we were

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-12 Thread Antoine Labour
On Tue, Jan 12, 2010 at 10:15 AM, Craig Schlenter craig.schlen...@chromium.org wrote: On Tue, Jan 12, 2010 at 7:13 PM, Evan Martin e...@chromium.org wrote: In this bug http://code.google.com/p/chromium/issues/detail?id=28749 It seems we're running afoul of a more finicky compiler not

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-12 Thread Craig Schlenter
On Wed, Jan 13, 2010 at 8:07 AM, Antoine Labour pi...@google.com wrote: On Tue, Jan 12, 2010 at 10:15 AM, Craig Schlenter craig.schlen...@chromium.org wrote: On Tue, Jan 12, 2010 at 7:13 PM, Evan Martin e...@chromium.org wrote: In this bug  

Re: [chromium-dev] seeking c++ expertise for a tiny tricky bit of code

2010-01-12 Thread Peter Kasting
On Tue, Jan 12, 2010 at 10:37 PM, Craig Schlenter craig.schlen...@chromium.org wrote: That makes the compiler toss an aliasing error immediately: cc1plus: warnings being treated as errors base/rand_util_posix.cc: In function ‘uint64 base::RandUint64()’: base/rand_util_posix.cc:32: error: