Building With -03 Flags. - BSD

This is a discussion on Building With -03 Flags. - BSD ; On 16 Jan 2007 11:35:53 -0800, JT wrote: : That is very space/time consuming and a lot of effort indeed. All the more reason to have another pair of eyes on it....

+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast
Results 21 to 40 of 46

Thread: Building With -03 Flags.

  1. Re: Building With -03 Flags.

    On 16 Jan 2007 11:35:53 -0800, JT wrote:
    : That is very space/time consuming and a lot of effort indeed.

    All the more reason to have another pair of eyes on it.

  2. Re: Building With -03 Flags.

    On Jan 16, 9:04 pm, Howard Goldstein wrote:
    > All the more reason to have another pair of eyes on it.


    Indeed, I totally agree.

    I was just pointing out to the original poster
    the efforts involved... that the new system can
    run fine for days until he executes a specific program.

    And that, at that time, he won't know if
    it's a -O3 problem unless he dual-boots and try again.
    (Not to mention that it would have to be a repeatable input...
    with no or little nondeterminism)

    - JT


  3. Re: Building With -03 Flags.

    On 16 Jan 2007 13:12:39 -0800, JT wrote:
    : And that, at that time, he won't know if
    : it's a -O3 problem unless he dual-boots and try again.
    : (Not to mention that it would have to be a repeatable input...
    : with no or little nondeterminism)

    Well that'd describe a bizarre problem that this fellow hasn't asked
    for help with. If he experiences it though, ISTM it could _really_
    use a lot of attention and loving care. If not then that's a useful
    bit of info too I guess.

    Y'know, I'm grateful to anyone who makes constructive input to this
    project. I thank the guy in advance for his willingness to try these
    configs out. For all I know he'll follow in the footsteps of the the
    talented folk(s) who fixed the breakage and made the "don't try -O2"
    warning go away. And wouldn't that be cool?


  4. Re: Building With -03 Flags.

    In article 5fIqh.124701$Pv5.63816@newsfe17.lga, dated Mon, 15 Jan 2007
    09:58:25 +0000, "Conrad J. Sabatier" wrote:
    >
    > I've been using the following for both CFLAGS and COPTFLAGS for quite
    > some time now under 7.0-CURRENT/amd64, with no ill effects:
    >
    > -O3 -pipe -Wno-error -fomit-frame-pointer -DNO_MALLOC_EXTRAS


    Wouldn't you just know it, the very next day, as I was updating my local
    docs (building under /usr/doc), I got a segfault from the pnmtopng
    program. :-)

    Rebuilding the netpbm and png ports with -O2 did no good at
    all. Apparently, it was caused by either one of the system libraries used
    by the pnmtopng program (libz, libm, or libc) , or by something within the
    kernel itself. After rebuilding world and kernel with -O2, the problem
    disappeared.

    Luckily, I've been using FreeBSD now for close to 11 years, so analyzing
    the problem was not too terribly difficult, but for newbies or relative
    novices, I would have to concur with the advice offered by others in this
    thread: just don't do it. :-)

    --
    Conrad J. Sabatier
    "In Unix veritas"

  5. Re: Building With -03 Flags.

    Howard Goldstein wrote:
    > Well that'd describe a bizarre problem that this fellow
    > hasn't asked for help with.


    No, it's not bizarre at all,
    as Conrad Sabatier just discovered today:

    Conrad Sabatier wrote:
    > ... segfault from the pnmtopng
    > ... Rebuilding the netpbm and png ports with -O2 did no good
    > ... rebuilding world and kernel with -O2, the problem disappeared.


    Howard Goldstein wrote:
    > If he experiences it though, ISTM it could _really_
    > use a lot of attention and loving care.


    No, it does not. We know -O3 *will almost certainly* break.
    And FreeBSD project's official stance is
    they will not fix any error caused by -O3.

    - JT


  6. Re: Building With -03 Flags.

    On 16 Jan 2007 14:57:47 -0800, JT wrote:
    : Howard Goldstein wrote:
    : > Well that'd describe a bizarre problem that this fellow
    : > hasn't asked for help with.
    :
    : No, it's not bizarre at all,

    How do you know it's not bizarre?

    : as Conrad Sabatier just discovered today:

    So what? He just posted that he's been using freebsd for 11 years and
    has a documented work around but he too doesn't care to, or can't, fix
    it. I'm not going to fix it either, but I believe it'd be helpful if
    someone would. Why you don't believe it'd be helpful to have it fixed
    is even more bizarre.

    Why don't you believe it would be helpful?


    : > If he experiences it though, ISTM it could _really_
    : > use a lot of attention and loving care.
    :
    : No, it does not. We know -O3 *will almost certainly* break.
    : And FreeBSD project's official stance is
    : they will not fix any error caused by -O3.

    Is the project's official stance to reject patches that fix it? Of
    course not. Get real.



  7. Re: Building With -03 Flags.

    Howard Goldstein wrote:
    > Well that'd describe a bizarre problem...


    I assumed you meant "my description of a system
    that mysterious malfunctions once in a blue moon"
    was unusual and unlikely.

    Howard Goldstein wrote:
    > How do you know it's not bizarre?


    So my reply basically was to say that it is *not* unusual.
    Every once in a awhile, people report -O3 causes
    inter-mitten non-reproducible failures.
    Must be I misunderstood you, or you misunderstood me.

    > He just posted that he's been using freebsd for 11 years and
    > has a documented work around


    What??? "documented work around"???
    FreeBSD's handbook and manpages say
    to only use -O2 on kernel and buildworld. Period.
    It's not a documented work around.
    It's a fact.

    > Why you don't believe it'd be helpful to have it fixed
    > is even more bizarre.


    Because it's GCC's problem!!! Try looking at GCC source code,
    and its bug database, and it's riddled with completely
    bizarre failures cases at -O3.
    The bug is *not* in FreeBSD, since we write (mostly) legal C code
    that should compile and run fine as-is.
    But GCC makes assumptions about what values can
    be in which variables... and these faulty assumptions cause failure.

    > Is the project's official stance to reject patches that fix it?


    It's not a bug in FreeBSD.
    To fix it, you'd need to find the part of BSD C code
    that are perfectly legal, but somehow cause GCC to
    become stupid. And then you rewrite it to avoid
    causing GCC to become stupid.

    And the next month, GCC changes some optimization
    technique, and the whole thing starts over again...

    Enough is enough. That's why FreeBSD specifically
    says in make.conf(5) that we only support -O2.
    And you can check the bug database, and see
    whenever people complain that -O3 breaks, they always
    say to report the bug again only if -O2 also breaks.

    Please check your facts (about FreeBSD vs GCC).

    - JT


  8. Re: Building With -03 Flags.

    On 16 Jan 2007 15:54:18 -0800, JT wrote:
    : Howard Goldstein wrote:
    : > Well that'd describe a bizarre problem...
    :
    : I assumed you meant "my description of a system
    : that mysterious malfunctions once in a blue moon"
    : was unusual and unlikely.

    That describes a bizarre problem.

    : Howard Goldstein wrote:
    : > How do you know it's not bizarre?
    :
    : So my reply basically was to say that it is *not* unusual.
    : Every once in a awhile, people report -O3 causes
    : inter-mitten non-reproducible failures.
    : Must be I misunderstood you, or you misunderstood me.

    I'll be more specific. I don't get the whole biting the n00b thing.
    And, I don't understand the motivation behind discouraging
    experimentation that might lead to fixes. Could someone explain how
    either would be helpful or constructive?

    :
    : > He just posted that he's been using freebsd for 11 years and
    : > has a documented work around
    :
    : What??? "documented work around"???
    : FreeBSD's handbook and manpages say
    : to only use -O2 on kernel and buildworld. Period.
    : It's not a documented work around.
    : It's a fact.

    In what way is avoiding -O3 not a workaround for -O3 breakage? Seems
    to naturally follow.

    : > Why you don't believe it'd be helpful to have it fixed
    : > is even more bizarre.
    :
    : Because it's GCC's problem!!! Try looking at GCC source code,

    I suppose you'd reject a gcc fix. Are you still building kernels with -O?


  9. Re: Building With -03 Flags.

    On Jan 17, 12:33 am, hgold...@mpcs.com (Howard Goldstein) wrote:
    > That describes a bizarre problem.


    Ah, so I did not misunderstand you.
    My original comments stand then:
    it occurs *all the time* with -O3 and kernel.

    > I'll be more specific. I don't get the whole biting the n00b thing.


    Huh? I wasn't biting the original poster.
    In fact, the original poster sounded like
    he might be willing to run at -O3 to test it,
    and I was trying to spare him the mountain of pain.

    > And, I don't understand the motivation behind discouraging
    > experimentation that might lead to fixes.


    You are obviously not a C programmer.
    Running BSD kernel+world (massive number of
    lines of code), and then every once in a while,
    your browser crash, or your graphics viewer,
    or your email client... only because O3.
    How *would* you "lead to fixes"???????????

    > In what way is avoiding -O3
    > not a workaround for -O3 breakage?


    No, the product, as-advertised, says to use O2 or below.
    It'd be like saying *not stabbing yourself with a knife*
    is a workaround for the pain of cutting yourself
    with a finger.

    > I suppose you'd reject a gcc fix.


    You're obviously not a C programmer.
    And you've obviously haven't dealt with GCC or
    its community.

    GCC is at 4.x now.
    FreeBSD kernel+world cannot even *compilie* using GCC4.
    And GCC3 is very, very complicated.
    Any effort to find the corner case in GCC3
    is really not our business.

    We got real problems (bgfsck crashes,
    soft-update + qouta crashes, NFS problems....)
    that result from FreeBSD code.

    - JT


  10. Re: Building With -03 Flags.

    In article <1168994027.25284@news.queue.to>,
    hgoldste@mpcs.com (Howard Goldstein) writes:
    > On 16 Jan 2007 15:54:18 -0800, JT wrote:
    > :
    > : So my reply basically was to say that it is *not* unusual.
    > : Every once in a awhile, people report -O3 causes
    > : inter-mitten non-reproducible failures.
    > : Must be I misunderstood you, or you misunderstood me.
    >
    > I'll be more specific. I don't get the whole biting the n00b thing.
    > And, I don't understand the motivation behind discouraging
    > experimentation that might lead to fixes. Could someone explain how
    > either would be helpful or constructive?


    Someone new to FreeBSD will most likely have insufficient
    knowledge to properly diagnose a problem caused by -O3.
    In additional, someone new to FreeBSD should RTFM about
    -O2 and -O3, and the numerous web posts that warn of the
    problem. I have no problems with someone experimenting with
    compilers option, but the person should do their homework and
    be prepare for advise that recommends against such experiments.

    For the record, here's the documentation for -O3.

    Optimize yet more. `-O3' turns on all optimizations specified
    by `-O2' and also turns on the `-finline-functions',
    `-funswitch-loops' and `-fgcse-after-reload' options.

    Guess what happens when you inline a function that may have
    a side effect and the other optimizers merrily eliminate that
    function.

    > : > Why you don't believe it'd be helpful to have it fixed
    > : > is even more bizarre.
    > :
    > : Because it's GCC's problem!!! Try looking at GCC source code,
    >
    > I suppose you'd reject a gcc fix. Are you still building kernels with -O?


    Well, actually, the FreeBSD developers will reject a patch to
    the gcc sources. They do not like to take source code off the
    vendor branch with local patches because it makes upgrading
    much more difficult. The developers will tell you to send your
    patch directly to the GCC developers. Now, the fun begins
    because gcc in FreeBSD is version 3.4.6, and GCC no longer
    supports that version. So, the only chance you'll have to
    get a gcc patch committed to the FreeBSD source tree is if the
    patch addresses an exploitable security problem.

    --
    Steve
    http://troutmask.apl.washington.edu/~kargl/

  11. Re: Building With -03 Flags.

    On 16 Jan 2007 16:43:45 -0800, JT wrote:
    : You're obviously not a C programmer.

    OK, I can barely manage shutting down my friend's system properly.
    Are there one or two good reasons even I could understand as to why
    it'd be _bad_ if everything worked at -O3?

  12. Re: Building With -03 Flags.

    X-No-Archive:

    On Jan 17, 1:52 am, Howard Goldstein wrote:
    > Are there one or two good reasons even I could understand as to why
    > it'd be _bad_ if everything worked at -O3?


    You're not following. Here are my main points
    at a glance. I'll ellaborate more if need be:
    1) GCC4 cannot compile BSD kernel+world yet.
    2) GCC3 has bugs that cause -O3 to blow up
    3) GCC team no longer accepts patches for GCC3
    4) It's very difficult for end-user to diagnose O3 bugs

    - JT


  13. Re: Building With -03 Flags.

    On 16 Jan 2007 18:13:41 -0800, JT wrote:
    :
    : On Jan 17, 1:52 am, Howard Goldstein wrote:
    : > Are there one or two good reasons even I could understand as to why
    : > it'd be _bad_ if everything worked at -O3?
    :
    : You're not following. Here are my main points

    Holy crap you're amazingly arrogant for one who refuses to admit the
    obvious fact that yes, yes indeed, there are no ways around it, it
    would definitely be A Very Good Thing to have a functional and useful
    -O3 in the only gcc we have for the system.

  14. Re: Building With -03 Flags.

    In article <1169006888.38630@news.queue.to>,
    hgoldste@mpcs.com (Howard Goldstein) writes:
    > On 16 Jan 2007 18:13:41 -0800, JT wrote:
    > :
    > : On Jan 17, 1:52 am, Howard Goldstein wrote:
    > : > Are there one or two good reasons even I could understand as to why
    > : > it'd be _bad_ if everything worked at -O3?
    > :
    > : You're not following. Here are my main points
    >
    > Holy crap you're amazingly arrogant for one who refuses to admit the
    > obvious fact that yes, yes indeed, there are no ways around it, it
    > would definitely be A Very Good Thing to have a functional and useful
    > -O3 in the only gcc we have for the system.


    After reviewing the thread, I'd say you're missing the point.
    -O3 can be and is known to be dangerous. There is no way to
    make it functional in the general case. It is also known that
    -O3 provides little to no benefits over -O2 in compiling the
    kernel and world.

    You're beginning to sound like Spinal Tap. Their amplifiers
    went to 11, which must be better than 10.

    --
    Steve
    http://troutmask.apl.washington.edu/~kargl/

  15. Re: Building With -03 Flags.

    On Tue, 16 Jan 2007 19:13:41 -0800, JT wrote:

    > X-No-Archive:
    >
    > On Jan 17, 1:52 am, Howard Goldstein wrote:
    >> Are there one or two good reasons even I could understand as to why
    >> it'd be _bad_ if everything worked at -O3?

    >
    > You're not following. Here are my main points
    > at a glance. I'll ellaborate more if need be:
    > 1) GCC4 cannot compile BSD kernel+world yet.


    You have to be specific, and say FreeBSD kernel+world, here. NetBSD and
    OS-X (I don't know about OpenBSD or Dragonfly) have both been running very
    nicely on GCC4 for some considerable time, now. I suspect that
    the EOL and consequent lack of up-stream support for GCC3.x was a
    motivator. So, there are existence proofs that the task is do-able. I
    haven't tried to compile the FreeBSD kernel or world with GCC4 to see what
    would break, but I certainly hope that *someone* is working in that
    direction. At this stage (GCC4 has been stable for a *long* time), you
    would have to bet on breakage being kernel or world's fault, rather than
    GCC4. I use GCC4 exclusively for my own work and have experienced no
    problems. It does find more (and more subtle) bugs than GCC3 did...

    > 2) GCC3 has bugs that cause -O3 to blow up
    > 3) GCC team no longer accepts patches for GCC3
    > 4) It's very difficult for end-user to diagnose O3 bugs


    All true. Also, as has been mentioned, for things like the kernel, -O3
    often leads to a performance *decrease* as a result of code size
    expansion. It is almost always only useful for performance-critical
    numerical code. Things like the ATLAS BLAS libraries and audio and
    graphics applications.

    Cheers,

    --
    Andrew


  16. Re: Building With -03 Flags.

    Andrew Reilly wrote:
    > You have to be specific, and say FreeBSD kernel+world, here.


    Yes, you're absolutely right. Sorry about that.

    Howard Goldstein wrote:
    > [you] refuses to admit the obvious fact ...
    > it would definitely be A Very Good Thing to
    > have a functional and useful -O3 in the only gcc we have for the system.


    I did not refute that. There are now 5 facts:
    Fact#1: It would be good to have reliable -O3 with FreeBSD kernel+world
    with GCC3.

    My Facts #2..#5 still stand.

    I was merely pointing out that
    FreeBSD developers don't want to work on #1;
    GCC developers don't want to work on #1.
    End user (without proficiency with kernel debugger) has 0 chance
    of actually finding the bug in #1.

    -

    It's clear you don't know C. Let me give an analogy:

    Suppose your email program crashes every time
    you put two "the" in the same sentence.
    You complain to the email program developer,
    but they say they're working on the next version.
    So you eventually swallow your bride,
    and learn to deliberately break up your sentences.
    Then later you discover that putting "the" and "pen"
    together also crash. So you change...
    And so on.. and so on...

    What you cannot seem to understand is that
    the FreeBSD developers are writing perfectly legal code.
    It's GCC3's O3 optimizations that are causing the problem.

    - JT


  17. Re: Building With -03 Flags.

    In article ,
    Steven G. Kargl wrote:

    % You're beginning to sound like Spinal Tap. Their amplifiers
    % went to 11, which must be better than 10.

    Well, it's not so much that it's better, it's just louder. Sometimes
    you need the amp to be a little bit louder.

    --

    Patrick TJ McPhee
    North York Canada
    ptjm@interlog.com

  18. Re: Building With -03 Flags.

    Begin <12qrbpbs64gjc80@corp.supernews.com>
    On 2007-01-17, Patrick TJ McPhee wrote:
    > In article ,
    > Steven G. Kargl wrote:
    >
    > % You're beginning to sound like Spinal Tap. Their amplifiers
    > % went to 11, which must be better than 10.
    >
    > Well, it's not so much that it's better, it's just louder. Sometimes
    > you need the amp to be a little bit louder.


    My toaster goes to eleven. Only. It's also a fire hazard.

    I like my toaster, because it was a gift, and because its dual-drawbridge
    design makes fabulous toast if you time turning the toast just right, but
    you *cannot* leave it alone, not for a minute, as it doesn't have any
    safety whatsoever.

    But! It goes to eleven.


    --
    j p d (at) d s b (dot) t u d e l f t (dot) n l .
    This message was originally posted on Usenet in plain text.
    Any other representation, additions, or changes do not have my
    consent and may be a violation of international copyright law.

  19. Re: Building With -03 Flags.

    Howard Goldstein wrote:
    > On 16 Jan 2007 18:13:41 -0800, JT wrote:
    > :
    > : On Jan 17, 1:52 am, Howard Goldstein wrote:
    > : > Are there one or two good reasons even I could understand as to why
    > : > it'd be _bad_ if everything worked at -O3?
    > :
    > : You're not following. Here are my main points
    >
    > Holy crap you're amazingly arrogant for one who refuses to admit the
    > obvious fact that yes, yes indeed, there are no ways around it, it
    > would definitely be A Very Good Thing to have a functional and useful
    > -O3 in the only gcc we have for the system.


    Really you don't understand.
    - in few months, the standard compiler in FreeBSD will be gcc4
    - so any effort in fixing gcc3 -O3 is time completely lost
    - and i insist on that since i do some numerical computations, in many
    cases gcc -O3 produces *slower* code than gcc -O2, even in some cases
    gcc -O is faster.

    As a conclusion, it is not only a loss of time, but most probably a loss
    of performance to compile FreeBSD at -O3. A completely different case
    would be the use of icc (the Intel compiler) to compile the kernel. In
    fact, an effort has been done so that the kernel is compilable by icc,
    and this may be valuable since icc does inded produce in general much
    faster code than gcc. Still i am convinced that such optimizations are
    totally useless for a kernel, and will produce a negligible performance
    gain. You *never* do that for a program whose main aim is *reliability*
    (the kernel), particularly when it is known that -O3 has bugs, and
    especially when the expected performance gain is negligible.

    When you are doing numerical computations the situation is different. You
    can test your program on reduced size with -O2 and -O3, check that you
    find the same result, and check that -O3 runs faster. Then it is
    reasonable to run the full size computation at -O3.

    --

    Michel TALON


  20. Re: Building With -03 Flags.

    On 16 Jan 2007 14:57:47 -0800 in <1168988265.155050.151390@38g2000cwa.googlegroups.c om> JT wrote:
    >
    > No, it does not. We know -O3 *will almost certainly* break.
    > And FreeBSD project's official stance is
    > they will not fix any error caused by -O3.


    What about -Os?
    --
    Chris Dukes
    < elfick> willg: you can't use dell to beat people, it wouldn't stand up
    to the strain... much like attacking a tank with a wiffle bat

+ Reply to Thread
Page 2 of 3 FirstFirst 1 2 3 LastLast