News for hackers. Stuff that matters.
Re:Undefined Behavior Is Really Undefined by saagarjha on Sunday December 02, 2018 @08:23AM (#18582195)
There’s really no need to pass -O9 to GCC. Anything over -O3 should become -O3 anyways.
Re:Undefined Behavior Is Really Undefined by pornin on Monday December 03, 2018 @10:26AM (#18589435)
In older times (around the GCC 2.7 series, I think), "-O9" was documented to be the "future-proof" setting that selects the maximum optimization level, whatever it is. In practice, GCC never defined anything beyond -O3, but I still use -O9 when I want to make GCC do its best (or worst). Call it force of habit from a lengthening experience. (With Clang I use -O3 because if I write -O9 it screams at me.)

(Note that -O3 is usually not that good an idea: aggressive loop unrolling can sometimes decrease performance because of cache issues, for instance. To optimize code properly, you have to make benchmarks and adjust both the code and compiler flags accordingly, in a well-thought feedback cycle. The use of aggressive optimizations in the blog post is to make the examples trip UB more clearly.)

Re:Undefined Behavior Is Really Undefined by jibal on Sunday December 02, 2018 @10:28AM (#18582690)
It doesn't hurt.
Re:Undefined Behavior Is Really Undefined by johnisgood on Monday December 03, 2018 @08:02AM (#18588409)
It puts the article in a different light. Makes you wonder what else he is incompetent or negligent about. In this sense it does hurt: it hurts him, it makes him less credible.
Re:Undefined Behavior Is Really Undefined by baby on Monday December 03, 2018 @08:28PM (#18595026)
you realize who the author of the article is do you?
Re:Undefined Behavior Is Really Undefined by johnisgood on Tuesday December 04, 2018 @07:32AM (#18598807)
What are you trying to say? That because he is an authority figure to you and perhaps to other people, it is somehow OK to be ignorant about certain things? Last time I did something similar it was due to sheer ignorance and placebo. It might be a bad mistake, or a terrible habit, but it is what it is. It is silly regardless of who it comes from. :)
Re:Undefined Behavior Is Really Undefined by baby on Tuesday December 04, 2018 @12:24PM (#18601479)
He is competent, and he wrote a blogpost to share something he knows on the web. It's a bit goofy to start claiming things about a character you don't know from a free publication.
Re:Undefined Behavior Is Really Undefined by johnisgood on Tuesday December 04, 2018 @01:01PM (#18601882)
Let me repeat: it is silly regardless of who it comes from. Everything else is irrelevant. You appear to be biased to the point of completely ignoring everything I have said. I get it, you like him. It does not change anything.

I merely suggested the possibility that he might be negligent or wrong about other relevant things. Do you think that this is impossible?

Re:Undefined Behavior Is Really Undefined by jibal on Thursday December 06, 2018 @03:14PM (#18621701)
The author is competent and not at all silly. And the author explicitly stated what -O9 does and why he used it.

> You appear to be biased to the point of completely ignoring everything I have said.

This is in violation of you usage agreement with ycombinator.

> I merely suggested the possibility that he might be negligent or wrong about other relevant things.

No, that's not true.

> Do you think that this is impossible?

Strawman.

I see that you created your account just a few days ago ... you might want to be careful with it. In any case, I won't be engaging with you further, and I doubt that I'm the only one.

Re:Undefined Behavior Is Really Undefined by johnisgood on Friday December 07, 2018 @09:46PM (#18633564)
> This is in violation of you usage agreement with ycombinator.

I do not see how it would be the case.

> No, that's not true.

Care to elaborate as to why you think that it is impossible for him to be negligent or wrong?

> I see that you created your account just a few days ago

What does it have to do with anything?

> you might want to be careful with it

Are you threatening me?

> I won't be engaging with you

Okay.

> I doubt that I'm the only one

Perhaps.

Re:Undefined Behavior Is Really Undefined by jnurmine on Sunday December 02, 2018 @11:46AM (#18583045)
I wonder if it does anything useful at all, since it -O9 is not defined, unless the compiler is some kind of special version.
Re:Undefined Behavior Is Really Undefined by yjftsjthsd-h on Sunday December 02, 2018 @12:32PM (#18583314)
IIRC, the code is actually `if O>2` or so; 3 and up are literally identical.

EDIT: Per https://wiki.gentoo.org/wiki/GCC_optimization#What_about_-O_... it's `enabled = (level >= 3);`