Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 466889
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T23:31:32+00:00 2026-05-12T23:31:32+00:00

How many GCC optimization levels are there? I tried gcc -O1, gcc -O2, gcc

  • 0

How many GCC optimization levels are there?

I tried gcc -O1, gcc -O2, gcc -O3, and gcc -O4

If I use a really large number, it won’t work.

However, I have tried

gcc -O100

and it compiled.

How many optimization levels are there?

  • 1 1 Answer
  • 5 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T23:31:33+00:00Added an answer on May 12, 2026 at 11:31 pm

    To be pedantic, there are 8 different valid -O options you can give to gcc, though there are some that mean the same thing.

    The original version of this answer stated there were 7 options. GCC has since added -Og to bring the total to 8.

    From the man page:

    • -O (Same as -O1)
    • -O0 (do no optimization, the default if no optimization level is specified)
    • -O1 (optimize minimally)
    • -O2 (optimize more)
    • -O3 (optimize even more)
    • -Ofast (optimize very aggressively to the point of breaking standard compliance)
    • -Og (Optimize debugging experience. -Og enables optimizations that do not interfere with debugging. It should be the
      optimization level of choice for the standard edit-compile-debug cycle, offering a reasonable level of optimization
      while maintaining fast compilation and a good debugging experience.)
    • -Os (Optimize for size. -Os enables all -O2 optimizations that do not typically increase code size. It also performs further optimizations
      designed to reduce code size.
      -Os disables the following optimization flags: -falign-functions -falign-jumps -falign-loops -falign-labels -freorder-blocks -freorder-blocks-and-partition -fprefetch-loop-arrays -ftree-vect-loop-version)

    There may also be platform specific optimizations, as @pauldoo notes, OS X has -Oz.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

many Places in the sample code i have seen 2 different way of @synthesize
Many threads have access to summary . Each thread will have an unique key
Many people use this method to add animation on switching views. When I try
Many ARIA demonstration websites use code such as: <label for=name id=label-name>Your Name</label> <input id=name
Many of my classes require access to a database to do their work. For
GNU Emacs 23.2.1 GCC 4.4.4 I am using gdb-many-windows to debug. I am just
gcc 4.4.3 c89 I have the following string sip:12387654345443222118765@xxx.xxx.xxx.xxx How can I extract just
gcc 4.4.1 c89 I have the following code snippet: #include <stdlib.h> #include <stdio.h> char
gcc 4.4.1 c89 I have the following code: static enum states { ACTIVE, RUNNING,
gcc 4.4.1 I am writing a server program where many clients will connect to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.