Compiler Explorer's Avatar

Compiler Explorer

@compiler-explorer.com

A website for exploring the output of compilers. aka godbolt.org Supports C, C++, Rust, Fortran, COBOL and many many more. Support us at https://patreon.com/mattgodbolt

1,340
Followers
30
Following
15
Posts
11.11.2024
Joined
Posts Following

Latest posts by Compiler Explorer @compiler-explorer.com

Preview
Compiler Explorer The official Compiler Explorer shop! Come show your support for CE and get cool gear!

Of course this series will demonstrate ways to use Compiler Explorer - and is part of a fund raiser too. shop.compiler-explorer.com and www.patreon.com/cw/mattgodbolt

13.11.2025 21:11 ๐Ÿ‘ 8 ๐Ÿ” 2 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Matt Godboltโ€™s blog

This December, I'll be posting an article & video each day until Christmas in the Advent of Compiler Optimisations! #AoCO2025
Each day we'll explore a fun optimisation in C or C++; some low-level, x86 or ARM-specific, some high-level. Hope you'll join me!
YT: youtube.com/mattgodbolt
Blog: xania.org

13.11.2025 19:51 ๐Ÿ‘ 64 ๐Ÿ” 16 ๐Ÿ’ฌ 3 ๐Ÿ“Œ 0

And we're back. A temporary misconfiguration - we have fixed it and all is well..sorry for the problem! -mg

07.10.2025 14:55 ๐Ÿ‘ 8 ๐Ÿ” 2 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

Investigating why Windows compilers are down! Watch this space, and sorry for any inconvenience -mg

07.10.2025 14:30 ๐Ÿ‘ 8 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
Compiler Explorer - C++ (x86-64 clang 21.1.0) // setup constexpr auto valid_chars = "0123456789abcdef"; bool is_valid_id(std::string_view maybe_id) { if (maybe_id.size() != 16) { return false; } if (maybe_id.find_first_not_of(valid_ch...

LLM-explanation is now live in @compiler-explorer.com - An example: compiler-explorer.com/z/rvvx7MxKq

* LLMs make mistakes and are overconfident
* We'll never force LLMs or AI on you, it's opt in (like clang-tidy, PVS Studio or other tools)
* It is *beta* quality

Initial results are promising(1/3)

21.09.2025 22:54 ๐Ÿ‘ 33 ๐Ÿ” 5 ๐Ÿ’ฌ 5 ๐Ÿ“Œ 2
CEFS: Finally Solving CE's Mount(ing) Problems โ€” Matt Godboltโ€™s blog In which CE's boot times are finally brought under control

@compiler-explorer.com is now running with a completely new storage mechanism in the back end. It's taken me quite a long time to get to the point where I felt confident enough to switch over to it and it seems like it's gone without a hitch. Details:
xania.org/202509/cefs

11.09.2025 21:35 ๐Ÿ‘ 30 ๐Ÿ” 6 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Hey folks! @compiler-explorer.com is free & open for everyone, but if you're planning to use our API for bulk executions though, please ping us! CE is a shared resource and heavy use can slow things down for the whole community. DM me to chat - happy to help figure out what works for everyone! :)

22.08.2025 20:18 ๐Ÿ‘ 34 ๐Ÿ” 6 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Support friend of the site Jason by going to one of his excellent courses! Jason was instrumental in publicising CE in the early days and his courses are awesome too! -mg

22.08.2025 22:47 ๐Ÿ‘ 1 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

CE relies on your support! How you can help:

* Submit PRs & report issues: github.com/compiler-exp...
* Become a Patron: patreon.com/mattgodbolt
* Sponsor us: github.com/sponsors/com...
* Buy CE swag: shop.compiler-explorer.com
* Join our Discord: discord.gg/B5WacA7

23.07.2025 23:21 ๐Ÿ‘ 3 ๐Ÿ” 3 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

I've been getting more anecdotal reports that @compiler-explorer.com is slow. Seems to be folks' simple code taking a while, likely queued up behind a longer compile. We've done some digging and it seems to have gotten worse since December last year. Doesn't seem to be bot traffic. Have you noticed?

19.07.2025 23:08 ๐Ÿ‘ 15 ๐Ÿ” 1 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

Huge news! AWS has approved Compiler Explorer for their Open Source Credits program, covering our infrastructure costs for the next year!
Thank you AWS for supporting open source! This means faster compiles, better queuing & more improvements coming. Exciting times ahead!

30.06.2025 18:37 ๐Ÿ‘ 94 ๐Ÿ” 11 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Compiler Explorer Cost Transparency โ€” Matt Godboltโ€™s blog In which I try and show how we spend your kind Patreon donations

I'm frequently asked "how much does @compiler-explorer.com cost to run". I've done some digging and posted xania.org/202506/compi... which is a high-level breakdown of the costs (and revenue); and links to a more in depth report if you want all the gory details.

11.06.2025 13:07 ๐Ÿ‘ 52 ๐Ÿ” 14 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

I'm half way through my career break, and taking stock. Plan was to do conf talks (check), work on @compiler-explorer.com (check), spend time with family (sort of) and even do some hobby code (also sort of). Higher level goal still is to get CE "on its feet" a bit...

08.06.2025 14:27 ๐Ÿ‘ 40 ๐Ÿ” 2 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1
Get More Out of Compiler-Explorer ('godbolt') :: Ofek Shilon
Get More Out of Compiler-Explorer ('godbolt') :: Ofek Shilon YouTube video by CoreCppIL

A fantastic walk through of some @compiler-explorer.com features by one of our core maintainers @ofekshilon.bsky.social . Thanks Ofek!

youtu.be/_9sGKcvT-TA

05.06.2025 22:17 ๐Ÿ‘ 19 ๐Ÿ” 4 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
How Compiler Explorer Works in 2025 โ€” Matt Godboltโ€™s blog How we handle 92 million compilations a year without everything catching fire

It's been a while since I've written about the innards of @compiler-explorer.com. xania.org/202506/how-c... has the details, some statistics and some fun war stories.

03.06.2025 21:41 ๐Ÿ‘ 57 ๐Ÿ” 17 ๐Ÿ’ฌ 3 ๐Ÿ“Œ 0
Compiler Explorer and the Promise of URLs That Last Forever โ€” Matt Godboltโ€™s blog How we're preserving 12,000 legacy links as Google's URL shortener rides into the sunset

On @compiler-explorer.com URLs and another Google product sunsetting: xania.org/202505/compi...

28.05.2025 15:32 ๐Ÿ‘ 85 ๐Ÿ” 24 ๐Ÿ’ฌ 3 ๐Ÿ“Œ 2
A screenshot of Compiler Explorer showing an "AI Explain this" view. The source code is: 

bool isspc(char c) { 
    return c == '\n' || c == '\r' || c == '\t' || c == ' ';
}

The asm is:
isspc(char):
        mov     ecx, edi
        cmp     cl, 33
        setb    dl
        movabs  rax, 4294977024
        shr     rax, cl
        and     al, dl
        ret

Below is a "Claude Explain" window with:

The function isspc(char) is compiled to an efficient bit manipulation technique to check for whitespace characters. Let's break down the assembly instructions:

mov ecx, edi

Copies the input character from the edi register (first function argument) to ecx
cl will contain the lowest 8 bits (the character)
cmp cl, 33

Compares the character against decimal 33
This is a preliminary check to quickly filter out non-whitespace characters
setb dl

Sets the dl register to 1 if the character is below 33 (space, tab, newline, etc.)
Uses a conditional set instruction
movabs rax, 4294977024

Loads a pre-computed 64-bit constant
This constant represents a bit mask for whitespace detection
shr rax, cl

Shifts the bit mask right by the character's value
This dynamically positions the mask based on the input character
and al, dl

Performs a bitwise AND between the shifted mask and the previous condition
Produces the final boolean result in al
ret

Returns the result (0 or 1) in al
This implementation is a highly optimized branchless method for checking whitespace characters, using bit manipulation instead of multiple comparisons. It avoids conditional jumps, which can be slower on modern CPUs.

The code checks for space (' '), newline ('\n'), carriage return ('\r'), and tab ('\t') in a single, efficient operation.

A screenshot of Compiler Explorer showing an "AI Explain this" view. The source code is: bool isspc(char c) { return c == '\n' || c == '\r' || c == '\t' || c == ' '; } The asm is: isspc(char): mov ecx, edi cmp cl, 33 setb dl movabs rax, 4294977024 shr rax, cl and al, dl ret Below is a "Claude Explain" window with: The function isspc(char) is compiled to an efficient bit manipulation technique to check for whitespace characters. Let's break down the assembly instructions: mov ecx, edi Copies the input character from the edi register (first function argument) to ecx cl will contain the lowest 8 bits (the character) cmp cl, 33 Compares the character against decimal 33 This is a preliminary check to quickly filter out non-whitespace characters setb dl Sets the dl register to 1 if the character is below 33 (space, tab, newline, etc.) Uses a conditional set instruction movabs rax, 4294977024 Loads a pre-computed 64-bit constant This constant represents a bit mask for whitespace detection shr rax, cl Shifts the bit mask right by the character's value This dynamically positions the mask based on the input character and al, dl Performs a bitwise AND between the shifted mask and the previous condition Produces the final boolean result in al ret Returns the result (0 or 1) in al This implementation is a highly optimized branchless method for checking whitespace characters, using bit manipulation instead of multiple comparisons. It avoids conditional jumps, which can be slower on modern CPUs. The code checks for space (' '), newline ('\n'), carriage return ('\r'), and tab ('\t') in a single, efficient operation.

Experimenting with something like this for @compiler-explorer.com - wondering what your thoughts are? AI is getting everywhere, and can be divisive. I'm hoping something like this - so long as I can get the output quality high enough - is a net benefit to help folks learn more about their code.

23.05.2025 20:09 ๐Ÿ‘ 49 ๐Ÿ” 6 ๐Ÿ’ฌ 21 ๐Ÿ“Œ 1

Thrilled to share that @compiler-explorer.com has received a $10K grant from NVIDIA's FOSS Fund! This support will help keep our GPU instances running and allow developers worldwide to experiment with CUDA code. Thank you NVIDIA AI Dev for supporting open source tools! #NVIDIAGrant

23.04.2025 22:23 ๐Ÿ‘ 87 ๐Ÿ” 8 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1
Bernie once again meme with

I am once again asking

you to remember that if turning on optimizations changes the behavior of your program, it is likely you are missing some undefined behavior

Bernie once again meme with I am once again asking you to remember that if turning on optimizations changes the behavior of your program, it is likely you are missing some undefined behavior

Once again

#programming

08.02.2025 19:51 ๐Ÿ‘ 69 ๐Ÿ” 9 ๐Ÿ’ฌ 5 ๐Ÿ“Œ 0

Does passing `-m32` to generate 32-bit code work? -mg

06.02.2025 20:49 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0
A screenshot of the site showing all the x86 gccs

A screenshot of the site showing all the x86 gccs

This is what I'm seeing anyway, as I'd expect. -mg

06.02.2025 20:41 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

I see them; can you elaborate on what you're seeing?

06.02.2025 20:39 ๐Ÿ‘ 1 ๐Ÿ” 0 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 0

First I've heard that it's not there

...taking a look -mg

06.02.2025 20:39 ๐Ÿ‘ 0 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0

We just blocked a TW-based IPv6 address from making many many back-to-back requests, most of which seemed to hit our caches (and thus were duplicates). If this affected you, please DM us or reply and we can help diagnose what went wrong. -mg

06.01.2025 00:22 ๐Ÿ‘ 5 ๐Ÿ” 1 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Compiler Explorer in 2024 | Matt Godbolt Get more from Matt Godbolt on Patreon

Compiler Explorer in 2024!

0.017 cents per compilation for 190M compilations. Tons of new features, Matt takes stock:

www.patreon.com/posts/compil...

31.12.2024 12:51 ๐Ÿ‘ 19 ๐Ÿ” 4 ๐Ÿ’ฌ 1 ๐Ÿ“Œ 1

Sent my first proper Patreon/GitHub sponsor update for @compiler-explorer.com work today. Surreal experience, I'm kinda giving my first update to my new boss(es) :-)

07.12.2024 20:40 ๐Ÿ‘ 28 ๐Ÿ” 2 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
Preview
Compiler Explorer Compiler Explorer is an interactive online compiler which shows the assembly output of compiled C++, Rust, Go (and many more) code.

Godbolt now has Slang support!

godbolt.org
@compiler-explorer.com

05.12.2024 17:56 ๐Ÿ‘ 41 ๐Ÿ” 13 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 1

So, after over 5 years at Aquatic, I made the tough call to leave and try something else. I had a wonderful time there, enjoyed the work and made some great friends. I'll be taking some time between jobs and will be working on @compiler-explorer.com and other OSS projects. I'm excited!

22.11.2024 21:06 ๐Ÿ‘ 81 ๐Ÿ” 3 ๐Ÿ’ฌ 9 ๐Ÿ“Œ 0
Preview
Compiler Explorer Support Compiler Explorer by buying awesome branded kit!

Only 2 days left 15% off stuff at the CE shop. I just uploaded a dark-friendly logo too! Get some stuff to show off your love of CE and know you're helping the site at the same time!
compiler-explorer.myspreadshop.com

23.11.2024 22:48 ๐Ÿ‘ 10 ๐Ÿ” 2 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0
A graph of "5xx errors" showing a recent peak for some time, followed by a drop even more recently.

A graph of "5xx errors" showing a recent peak for some time, followed by a drop even more recently.

Looks like it's worked:

17.11.2024 02:30 ๐Ÿ‘ 2 ๐Ÿ” 0 ๐Ÿ’ฌ 0 ๐Ÿ“Œ 0