Announcement

Collapse
No announcement yet.

ARM Proposes Changing GCC's Default Optimization Level To -Og

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ARM Proposes Changing GCC's Default Optimization Level To -Og

    Phoronix: ARM Proposes Changing GCC's Default Optimization Level To -Og

    The GNU Compiler Collection currently uses -O0 as the default optimization level when no other optimization level is passed. An ARM developer is proposing the default optimization level be changed to -Og...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    I find that -Og optimizes too much out to be useful for debugging. I'm frequently met with <optimized out> after triggering a rare state, only to have to try again after rebuilding with -O0.

    That said, I always set it explicitly, so this wouldn't hurt my debugging experience. Either way, -Og isn't flawless.

    Comment


    • #3
      Originally posted by microcode View Post
      I find that -Og optimizes too much out to be useful for debugging. I'm frequently met with <optimized out> after triggering a rare state, only to have to try again after rebuilding with -O0.
      Same here, the last thing you want when hunting bugs is the important parts missing.

      TBH, the default should be -Os or -O2, thats the most sensible for everything except the pieces you are working on.
      For debug builds there is usually more involved then just compiler settings, like preventing the build system to strip out debug-info and often some switches enabling asserts and more throughout checks and reporting.

      Comment


      • #4
        each Makefile and everything has some -O flag specified, totally irrelevant and very much not noteworthy, ...

        Comment


        • #5
          Originally posted by rene View Post
          each Makefile and everything has some -O flag specified, totally irrelevant and very much not noteworthy, ...
          You're forgetting who does use the defaults, the new comers to programming. When speaking about the defaults you have to see the issues from the perspective of a noob. Because they are after all who do use the defaults.

          That said no shame in being new to programming or using GCC, everyone has to start somewhere.

          Comment


          • #6
            When not specifying a particular optimization level, the compiler doesn't optimize? Surely changing that will make for a much more intuitive experience. /s

            Comment


            • #7
              Tbh I never even knew what's the default optimization. Defaults are prone to change, it's simpler to set options explicitly than guessing whether something is different in the particular version of particular distro you happen to use or not.

              Comment


              • #8
                Originally posted by danieru View Post

                You're forgetting who does use the defaults, the new comers to programming. When speaking about the defaults you have to see the issues from the perspective of a noob. Because they are after all who do use the defaults.

                That said no shame in being new to programming or using GCC, everyone has to start somewhere.
                If you're new to programming in C/C++, I think the optimization level is your least concern. If anything -O0 is important there for when debugging.

                Comment


                • #9
                  I was trying to debug code for HiFive1 board which runs the RISC-V processor and spent an hour trying to figure out why it's missing instructions as I am trying to learn RISC-V architecture. Turned out it was due to -O2 flag that I missed. Roll that back to -O0 and everything is there again, but I can see how massively inefficient it was. Fun for learning though!

                  Comment


                  • #10
                    Originally posted by danieru View Post

                    You're forgetting who does use the defaults, the new comers to programming. When speaking about the defaults you have to see the issues from the perspective of a noob. Because they are after all who do use the defaults.

                    That said no shame in being new to programming or using GCC, everyone has to start somewhere.
                    I have the feeling especially newcomers will not run gcc/g++ directly, and instead click something together in some kind of IDE, which certainly has some default settings for this, anyways, too ;-)

                    Comment

                    Working...
                    X