Commit Graph

2759 Commits

Author SHA1 Message Date
Matt Godbolt (bot acct)
132f308ea4 Don't rewrite the URL in embedded mode; fixes embeds regressing to the front page (#8897)
Fixes #8896.

### What was happening

`SharingBase.ensureUrlIsNotOutdated()` replaces the page URL with
`httpRoot` (`/`) once the layout state diverges from the state recorded
after load. That rewrite exists for the main site, so an outdated
shortlink path (`/z/...`) doesn't linger in the address bar after you
edit the code.

Since #8166 started running the shared state-tracking (`SharingBase`) in
embedded mode too — to keep the "Edit on Compiler Explorer" link in sync
— the rewrite also fires inside `/e` iframes. There, `location.pathname`
(`/e`) never equals `httpRoot` (`/`), so the first state change after
load (an edit, or just layout churn) silently rewrites the iframe's URL
to `/` — dropping both the `/e` path **and** the state hash. Reproduced
with a `history.replaceState` spy: after two edits in an embed, the
iframe's location is `/` with an empty hash.

The visible symptoms are then browser-dependent, which is why it looked
intermittent: Firefox restores an iframe's *session-history* URL when
the parent page reloads, so the iframe comes back as `godbolt.org/` —
the full site, showing the default language example, and (because
cookies are unreadable in a cross-site iframe, per the `privacy_status`
SameSite console error in the report) the privacy-policy popup. Chrome
reloads iframes from their `src` attribute, so it never showed the
problem.

### The fix

Skip the rewrite entirely in embedded mode — the iframe's URL *is* the
embedded state and must never be touched. The `a.link` "Edit on Compiler
Explorer" state tracking from #8166 is unaffected.

### Tests

New `cypress/e2e/embed.cy.ts`:
- the embedded state's code loads (not the default example),
- the `/e#state` URL survives state changes (fails before this fix:
pathname becomes `/`, hash emptied),
- the "Edit on Compiler Explorer" link still picks up edits (locks in
#8166's behaviour).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 17:17:10 -05:00
Matt Godbolt (bot acct)
3d5a62fe6b Re-add CI check enforcing license header banners (#8883)
## What & why

We used to enforce the BSD-2-Clause license banner on every source file
via `eslint-plugin-header`. That check was lost when we migrated from
ESLint to Biome (#7033), which has no equivalent rule. This PR
reinstates it as a standalone node script, modelled on the existing
`etc/scripts/check-frontend-imports.js`.

### Why a script rather than a Biome rule
Biome 2.x has no built-in license/header rule and no plugin equivalent
to `eslint-plugin-header`; its experimental GritQL plugins aren't suited
to whole-file-prefix matching. A script needs zero new dependencies and
gives full control over scope and exemptions.

## The check (`etc/scripts/check-license-headers.js`)

A file "has an appropriate banner" if, ignoring an optional shebang, it
opens with a `// Copyright (c) …` line **and** contains the BSD-2-Clause
disclaimer body. The year and copyright holder are intentionally **not**
constrained — the tree legitimately has many holders (Compiler Explorer
Authors, Arm, Microsoft, HRT, individuals). The `(c)`/`(C)` marker is
matched case-insensitively.

**Scope:** `.ts/.js/.mjs/.cjs` under `lib/ static/ shared/ types/ test/
cypress/`.

**Exempt:** generated files (`lib/asm-docs/generated`), vendored
(`docenizer/vendor`), `.d.ts`, and three third-party ports that carry
their own upstream license — `static/ansi-to-html.ts` (MIT),
`lib/node-graceful.ts` (MIT), `shared/rison.ts` (Nanonid/rison port).

**Wired into:** CI (`test-and-deploy.yml`), `npm run check`, the `make
pre-commit` target, the husky pre-commit hook, and `lint-staged` (per
staged file).

Usage:
```
node ./etc/scripts/check-license-headers.js            # scan the tracked tree
node ./etc/scripts/check-license-headers.js <files...> # scan specific files (lint-staged)
```

## Backfill

The check surfaced **42 CE-authored files** missing the banner. This PR
backfills them all with the standard `Copyright (c) <year>, Compiler
Explorer Authors` banner, using each file's **git creation year**
(added-at-this-path, so no `--follow` rename artifacts).

## Verification

- `check-license-headers` → clean (was 42 failures)
- `biome check` on all source → no fixes needed (banner format matches
existing convention)
- `tsc` backend + frontend + tests → clean
- pre-commit gauntlet (lint, ts-check, related tests: 528 passed) ran on
commit

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-02 19:13:21 +01:00
Cedric
b0726beb5f Fix Triton MLIR source locations (#8718)
## Summary
- resolve nested named MLIR location aliases in the MLIR asm parser
- strip MLIR location metadata from displayed device output
- make Device Viewer source colours and hover linkage use the owning
source editor

## Testing
- npm run test -- test/asm-parser-tests.ts --reporter dot
- npm run ts-check:frontend
- npm run ts-check:backend
- npm run ts-check:tests
- npx biome check lib/parsers/asm-parser-mlir.ts
test/asm-parser-tests.ts static/panes/device-view.ts
- git diff --check -- lib/parsers/asm-parser-mlir.ts
test/asm-parser-tests.ts static/panes/device-view.ts
- pre-commit hook: npm run lint, npm run ts-check, vitest related passed

Note: a standalone npm run test-min run failed in unrelated
test/demangler-tests.ts Rust demangling expectations in this local
environment.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2026-07-02 18:52:31 +01:00
hkalbasi
9b47e07d14 Add co2 language (#8842)
This PR adds [CO2](https://github.com/hkalbasi/co2) which is a language
backward compatible with C, with some Rust interop features that
compiles to Rust's MIR.

I added two compiler `co2rustc` and `co2cc`, and a tool `co2miri` which
is Miri for CO2. I added `co2cc` under C compilers, to make it possible
to view diff of assembly for a C code compiled with CO2 and clang or
gcc. `co2cc` is a CO2 frontend which accepts gcc-like flags, and can (or
at least should) compile almost every ISO compatible C23 code.
`co2rustc` accepts Rust like flags, and added under a new `CO2`
language.

Tested locally and it seems to work.

I need some help in setting up artifacts (which, if I understand
correctly, needs to happen in `infra` or `compiler-workflows`). I make
an artifact `co2-multicall` in my CI, which needs to get symlinked in
`co2cc`, `co2rustc` and `co2miri`, and it needs to run a simple project
with miri to create the miri sysroot. If you show me a similar project,
I will do the job.

Disclaimer: Written partially by LLM.

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2026-07-02 18:26:35 +01:00
Ofek
2d074f870b Fix #8859: fix full recompilation in conformance-view (#8875) 2026-06-30 21:16:28 +03:00
Ofek
31db3a1ddc Fix #8859: trigger recompilation when a conformance-view is restored (#8860) 2026-06-25 12:24:25 +03:00
Ofek
73c9ecb01c Fix #8589: hide intel-asm for binary assembly different from x86/x64 (#8851) 2026-06-23 19:14:14 +03:00
Ofek
fa456a81f3 Fix #7870: use GCC pass-dump files to enumerate passes (#8826)
Following the discussion at #7870: `-fdump-passes` reports passes
enabled dynamically (e.g. loop2_unroll via `#pragma GCC unroll`) as OFF,
so they were missing from the pass dropdown although they were active.
Fixed by building the pass list from the dump files GCC actually wrote
instead.

While reworking this:
- Read all passes into a `passDumps` map shipped with the result, so
switching passes doesn't trigger a compile.
- Trim each dump to functions defined in the user's source, dropping
header/library functions; strip forced -lineno annotations from GIMPLE
(tree/IPA) dumps when Line Numbers is off, leaving RTL untouched.
- Exclude passes with empty output
- Add a GccDumpOutput type, backend unit tests and a cypress test.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-20 16:06:25 +03:00
Khanh Le
deb407a7ff Fix Clang AST linkage highlighting (#8835)
Fixes #8672

This adds a Clang AST Monaco mode for C++ AST output so Clang linkage
specifiers are highlighted as whole tokens without changing normal C++
source highlighting.

Validation:

- `npm run test -- --run static/tests/modes/clang-ast-mode-tests.ts`
  - Test Files 1 passed (1)
  - Tests 1 passed (1)
- `npm run ts-check`
  - passed
- `npm run lint-check`
  - Checked 798 files. No fixes applied.
- `npm run test-min -- --reporter dot`
  - Test Files 116 passed, 1 skipped
  - Tests 1708 passed, 743 skipped

Co-authored-by: Khanh Le <nkgotcode@users.noreply.github.com>
2026-06-18 12:09:23 +01:00
Lumi
938d42ae3f Add RazorForge language support (#8825)
This adds support for
[RazorForge](https://github.com/dj-lumiere/razorforge-suflae),
a precision-focused, ahead-of-time compiled language that lowers to LLVM
IR. It follows
  `docs/AddingALanguage.md`.

  ### What's included
- `lib/languages.ts` — language definition (`.rf`, Monaco mode
`razorforge`, disassembly `llvm-ir`)
  - `types/languages.interfaces.ts` — `razorforge` language key
- `lib/compilers/razorforge.ts` + `lib/compilers/_all.ts` — compiler
driver
- `static/modes/razorforge-mode.ts` + `static/modes/_all.ts` — Monarch
syntax highlighting
- `etc/config/razorforge.{defaults,amazon}.properties` — compiler config
  - `examples/razorforge/default.rf` — default example
  - `.github/labeler.yml` — `lang-razorforge` label

  ### Compiler behavior
RazorForge's CLI takes verbs + positional arguments only (all build
config lives in
`razorforge.toml`, not flags). The driver invokes the `build` verb,
which runs semantic
analysis and code generation and writes LLVM IR next to the source
(`example.rf` →
`example.ll`) without invoking `opt`/`clang`. The primary output is the
emitted LLVM IR,
  so `supportsIrView` is on and `supportsExecute` is off for now.

  ### Notes
  - Install recipe: compiler-explorer/infra#2177
  - No logo yet (`logoFilename: null`); happy to add one in a follow-up.
- Verified locally: `make`, `biome check`, `tsc`, and `vitest related`
all pass; the example
    compiles to valid LLVM IR with the released `v0.0.3-alpha` build.
2026-06-17 09:47:31 +01:00
AxelRay
8b6da01b91 fix: remove indentation from program execution output (#8801) 2026-06-07 18:16:05 +02:00
Francisco Giordano
a8ea0a9546 fix: Lean C view with lazy-loaded metadata (#8800) 2026-06-07 13:37:18 +02:00
Partouf
840215f120 fix: populate tools menu on initial compiler pane load
initPanerButtons() runs synchronously from the constructor and calls
initToolButtons() before postInit() resolves this.compiler, so the call
bailed out early and left the "Add tool..." menu empty until the compiler
was changed. Re-populate the menu in postInit() once the compiler is known.

Fixes #8795

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 10:51:29 +02:00
Partouf
b648fe4453 fix: apply shortlink libraries before compiling after lazy-load
The lazy-load change (#8549) made the LibsWidget fetch its available
library list from the API, so applying the saved state (selecting the
libraries from a shortlink) became asynchronous. The compiler/executor
panes called initLibraries without awaiting it and then immediately
compiled and persisted state, so the saved libraries were not yet
selected (e.g. /z/jMdjdahn6 loaded without beman_any_view selected).

Expose a stateLoaded promise on LibsWidget that resolves once loadState
has run, await it in initLibraries, and await initLibraries in postInit.
Also refresh the libraries button after loadState so its count is correct.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 00:18:44 +02:00
Partouf
2951afe164 fix: don't reset shortlink compiler to default during async pane init
The lazy-load change (#8549) moved the compiler pane's initLangAndCompiler
into an async postInit that awaits the compiler-list fetch, while the
languageChange listener is still registered synchronously in the constructor.
This opened a window where the editor's initial firstTime languageChange
broadcast arrives before currentLangId is resolved, causing onLanguageChange
to fall back to the language's default compiler and lose the compiler stored
in the shortlink (e.g. /z/4jh7rYMe9 loaded x86-64 gcc instead of
armv8-clang-trunk).

Guard onLanguageChange with an initialStateLoaded flag so the pane ignores
language broadcasts until it has resolved its own initial lang/compiler.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 17:46:04 +02:00
Patrick Quist
c432fcc478 feat: lazy-load languages, compilers, libraries, and tools from API (#8549) 2026-06-05 15:54:27 +02:00
narpfel
38758256bb Add [already open] hint to output and tree view button (#8689) 2026-06-05 01:53:26 +02:00
Puneet Dixit
6d664ba2ed Fix diff picker labels after option changes (#8777)
Fixes #8756.

## Summary
- Refresh existing TomSelect option data for diff picker entries when
compiler metadata changes
- Preserve the selected compiler while repainting the visible picker
label
- Add a Cypress regression for updating compiler options after the diff
view is open

## Testing
- npx biome check static/panes/diff.ts cypress/e2e/diff.cy.ts
- npm run ts-check:frontend
- npm run ts-check:cypress
- npm run check-frontend-imports
- CYPRESS_CACHE_FOLDER=/tmp/compiler-explorer-107-cypress-cache npx
cypress run --spec cypress/e2e/diff.cy.ts

Co-authored-by: Deepak kudi <deepakkudi23@adsl-172-10-9-116.dsl.sndg02.sbcglobal.net>
2026-06-03 23:21:20 -05:00
Francisco Giordano
a6cdc6a66d Add Lean (#8737)
Fixes
https://github.com/compiler-explorer/compiler-explorer/issues/5634.

Adds the Lean 4 language and compiler. 

> Lean is an open-source programming language and proof assistant that
enables correct, maintainable, and formally verified code

Since it was first requested in
https://github.com/compiler-explorer/compiler-explorer/issues/5634, it
has become increasingly relevant due to interest in AI-assisted theorem
proving, formalized mathematics, and verified software.

---

Lean compiles in two steps: first to C source code using the `lean`
executable, and then to assembly using the `leanc` compiler distributed
with Lean (I believe it's Clang).

The PR also includes a pane to visualize the emitted C source code that
was modelled after the panes for Rust and Haskell IRs and after the C
preprocessor pane for clang-format integration. Lean outputs mostly
unindented C code, so I enabled the formatter by default.

See companion infrastructure PR at
https://github.com/compiler-explorer/infra/pull/2130.



<img width="3024" height="1720" alt="image"
src="https://github.com/user-attachments/assets/5e7a1e91-e748-4599-8190-d3cb09fca503"
/>

---------

Co-authored-by: Matt Godbolt <matt@godbolt.org>
2026-06-02 12:19:29 -05:00
Matt Godbolt
861bbde8ca Update major dependencies (TypeScript 6, zod 4, webpack-cli 7, commander 15, …) (#8761)
Bumps the remaining major-version dependencies. **golden-layout is
deliberately excluded** (we depend on its internals too heavily for the
1.x → 2.x jump).

Each bump is its own commit, verified independently (ts-check, lint,
unit tests, and where relevant the webpack build + cypress).

## Included
- **TypeScript 6.0** — pin `ignoreDeprecations: "6.0"`
(downlevelIteration + the frontend's `es5` target are
deprecated-but-functional until TS7), pin the frontend to
`module=commonjs`/`moduleResolution=node` (TS6's new esnext/bundler
defaults break deep monaco esm imports), and declare `*.css`/`*.scss`
side-effect modules (`noUncheckedSideEffectImports` now defaults true).
- **marked 18** — no code changes; only use is the Claude-explain view.
- **Build chain**: webpack-cli 7 (renamed `--node-env` →
`--config-node-env` in the `webpack` script), webpack-dev-middleware 8,
sass-loader 17.
- **zod 4** — only used by the MCP tool schemas via stable primitives;
MCP SDK already supports `^3.25 || ^4.0`.
- **lint-staged 17** — dev tooling; pre-commit pipeline exercised.
- **commander 15** — both CLI entrypoints use options only; v15's
stricter excess-args default only tightens rejection of stray
positionals. Requires Node ≥22.12.
- **enhanced-ms 5**, **which 7** — small utilities, APIs unchanged.

## Node floor bump — split into its own PR
The first commit (`Bump Node floor to v22`: `engines >=22` + `find-node`
`NODE_MIN_VERSION=22`) is **isolated and intended to be cherry-picked
into a separate PR**. It aligns the declared floor with production (Node
22.13.1) and is a prerequisite for commander 15 (needs ≥22.12).

## Follow-ups (not in this PR)
- The `es5 → es2015` frontend migration, required before TS7 (currently
bridged by `ignoreDeprecations`).

## Testing
- Local: ts-check, lint, full unit suite, production webpack build, and
cypress (81 specs) all pass.
- Pre-existing: 13 `dontMaskFilenames` filter snapshots fail **locally
only** (a local /tmp path leaks into output where the snapshot expects a
clean `example.cpp`); they fail identically on `main` and pass in CI.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-01 18:50:47 -05:00
Ofek
133c8e6a10 Fix #8318: add missing cfg positioning constraints (#8734) 2026-06-01 15:21:30 +03:00
narpfel
843e70c278 Don’t discard overrides when cloning compiler (#8733)
Resolves #8732.
2026-05-26 22:35:19 +02:00
Ofek
f8f61746b9 Fix #8738: for a failed compilation, blocks can be undefined (#8739) 2026-05-23 18:32:44 +03:00
Ofek
41a59c0abb Fix optional-chain lint errors (#8735)
Biome started emitting 18 warnings like:
```
  ℹ Unsafe fix: Change to an optional chain.
  
    218 218 │   
    219 219 │       updateButtons() {
    220     │ - ········if·(!this.compiler·||·!this.compiler.optPipeline)·return;
        220 │ + ········if·(!this.compiler?.optPipeline)·return;
    221 221 │   
    222 222 │           const {supportedOptions, supportedFilters, initialOptionsState, initialFiltersState} =
```
This fixes them. Although the suggested fixes are labeled 'unsafe', in
these particular cases they in fact are.

Co-authored-by: Ofek Shilon <oshilon@speedata.io>
2026-05-23 14:47:16 +03:00
Steve
156f4b3542 Implement source mapping for .NET compilers (#8666)
This PR implements the source mapping for .NET compilers (C#, F#, VB.NET
and IL), supports CoreCLR, Crossgen2 and NativeAOT compilers.

- Add a parser that walks ECMA-335 metadata and Portable PDB sequence
points to build IL-offset-to-source mappings for .NET methods
- Load PDBs emitted by the .NET compiler after building the dll, and
then save the source mapping in the result
- Extend the .NET asm parser to match disassembly method signatures,
including generic types, generic methods, and inline root offsets, so
emitted asm lines inherit the correct source locations
- Use debug info emitted by the JIT `INLRT @ 0x##` as anchors to match
the offset

Showcase:


![image1](https://github.com/user-attachments/assets/5309fe70-be87-4f94-b70c-21bb91f745be)


![image2](https://github.com/user-attachments/assets/9d15741e-08ff-4f20-8a32-efa0d8307dea)
2026-05-10 09:15:36 -05:00
Matt Godbolt (bot acct)
90e742a5e7 Add VS Code / JetBrains keymap setting (default VS Code) (#8682)
## Summary
- Adds a **Settings → Keybindings → Keymap** dropdown with `VS Code`
(default) and `JetBrains` options.
- Previously CE unconditionally bound `Ctrl+D` to duplicate-selection —
a JetBrains habit that clobbered VS Code's
`editor.action.addSelectionToNextFindMatch` (multi-cursor). VS Code
users now keep their muscle memory; JetBrains users opt in.
- Under the JetBrains preset, also wires up `Ctrl+Y` → delete line and
`Ctrl+Shift+/` → block comment.
- Drive-by tidy of the existing **Ctrl+S behaviour** dropdown in the
same tab so it's full-width and consistent with every other settings
dropdown (it had its `<select>` nested inside the `<label>` and used a
`mb-3` typo that rendered as an unknown `<mb-3>` element).

## Audit notes
I went through every `addAction` / `addCommand` in
`static/panes/{editor,compiler,ir-view,device-view}.ts` and only
`Ctrl+D` was a clear VS Code/JetBrains conflict. The other custom
bindings (`Ctrl+Enter`, `Ctrl+Shift+Enter`, `Ctrl+F8/F9/F10`,
`Ctrl+Shift+F1`) are CE-feature-specific and don't conflict with either
editor's defaults, so they're untouched.

Considered but skipped:
- `Alt+Up/Down` (move line) — already the Monaco/VS Code default;
nothing to add.
- `Ctrl+W` / `Ctrl+Shift+W` (extend/shrink selection in JB) —
browser-reserved, can't be intercepted.
- `Ctrl+B` (go-to-declaration in JB) — Firefox steals it for the
bookmarks sidebar, and CE doesn't run language servers for compiled
languages so it'd be a near no-op anyway.

## UX
The Keymap label reads "Keymap *(refresh required)*" with the
parenthetical in `<em>` so it inherits the theme's foreground colour (no
black-on-black on dark mode when selected). The binding decision is read
at editor construction so a page reload is needed to pick up changes —
consistent with how `autoIndent` / `enableCodeLens` already behave.

## Test plan
- [x] Open Settings → Keybindings, see the new Keymap dropdown defaulted
to "VS Code", full-width and visually consistent with the Ctrl+S
dropdown below it.
- [x] Switch theme to dark and confirm the "(refresh required)" hint is
readable (and doesn't disappear when selected).
- [x] In default (VS Code) mode: `Ctrl+D` adds the next find match
(multi-cursor); `Ctrl+Y` redoes; `Ctrl+Shift+/` does nothing custom.
- [x] Switch to JetBrains, refresh: `Ctrl+D` duplicates the selection;
`Ctrl+Y` deletes the current line; `Ctrl+Shift+/` toggles a block
comment.
- [x] Existing users with stored settings (no \`keymap\` key) get the VS
Code default and lose the previous unconditional `Ctrl+D` binding
(intended — switch to JetBrains to restore it).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-07 10:51:01 -04:00
pietro
1dd89fb5fa Fix Algol 68 comments highlighting (#8681)
Fix the mode introduced in #8677 to correctly highlight nested and
multi-line comments on Algol 68.

Co-authored-by: Pietro Monteiro <pietro@sociotechnical.xyz>
2026-05-06 22:25:44 -04:00
narpfel
c3fbbe5ff1 Keep opt remarks sorted (#8664)
The compiler does not necessarily generate a sorted opt report. Unsorted
remarks make the selection jump around unintuitively when selecting
multiple (even visually adjacent) remarks.

See https://rust.godbolt.org/z/af6jzKTvv from #8654 for an example.
2026-05-06 10:37:28 -04:00
Copilot
3ab3880de5 Show actionable network error instead of "Compiler returned: -1" on connectivity loss (#8676)
When the browser loses network connectivity mid-compilation, the output
pane showed `Compiler returned: -1` — implying a code/compiler problem
when the request never reached the backend. This is especially
disruptive in demo/presentation settings.

## Changes

**Network error detection (`static/compiler-service.ts`)**
- HTTP status `0` on an `error` textStatus → network failure (request
never left the browser)
- Message varies by `navigator.onLine`:
- Online: `"Could not reach Compiler Explorer. Check your internet
connection and try again."`
- Offline: `"Could not reach Compiler Explorer: your browser appears to
be offline."`
- Sets `isNetworkError = true` on the rejected `Error`

**New `networkError` flag
(`types/compilation/compilation.interfaces.ts`)**
- Added `networkError?: boolean` to `CompilationResult` to propagate the
transport-failure signal through the result pipeline

**Compiler pane (`static/panes/compiler.ts`)**
- `sendCompile` / `sendCMakeCompile` catch blocks: when
`isNetworkError`, build a result with `networkError: true` and the
message in both `asm` (assembly pane) and `stderr` (output pane); stack
trace is not logged (expected, not a bug)

**Executor pane (`static/panes/executor.ts`)**
- Same `isNetworkError` detection in catch blocks
- `handleCompileRequestAndResponse`: suppresses "Could not execute the
program" and "Compiler returned: X" when `networkError` is true — only
the descriptive network message is shown

**Output pane (`static/panes/output.ts`)**
- Skips the `Compiler returned: N` line entirely when
`result.networkError` is true; the error message surfaced via
`result.stderr` is shown instead

> [!WARNING]
>
> <details>
> <summary>Firewall rules blocked me from connecting to one or more
addresses (expand for details)</summary>
>
> #### I tried to connect to the following addresses, but was blocked by
firewall rules:
>
> - `download.cypress.io`
> - Triggering command: `/usr/local/bin/node node dist/index.js --exec
install` (dns block)
>
> If you need me to access, download, or install something from one of
these locations, you can either:
>
> - Configure [Actions setup
steps](https://gh.io/copilot/actions-setup-steps) to set up my
environment, which run before the firewall is enabled
> - Add the appropriate URLs or hosts to the custom allowlist in this
repository's [Copilot coding agent
settings](https://github.com/compiler-explorer/compiler-explorer/settings/copilot/coding_agent)
(admins only)
>
> </details>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: mattgodbolt <633973+mattgodbolt@users.noreply.github.com>
2026-05-06 10:18:02 -04:00
pietro
fc25014d63 Add syntax highlighting for Algol 68 (#8677) 2026-05-06 00:04:16 +02:00
narpfel
2aa7ea731d Make opt remarks selectable (#8655)
Resolves #8654.
2026-05-02 08:07:10 -05:00
Sean Garwood
bb3a5d26d0 Fix AT&T warning showing for native langs w/ undefined intelAsm (#8576)
Fixes #8567 

Fix bug where `asmSyntax` returned 'att' for compilers that do not
define
`intelAsm` (e.g. Rust, Spice), but that do support Intel:

- The base compiler defaults `supportsIntel` property to
`!!this.compiler.intelAsm`
- Aforementioned compilers override this in [optionsForFilter
override](6b1ff666f2/lib/compilers/rust.ts (L272))

Before:

```typescript
// bug
const isAtt = /*...*/ !(this.filters.isSet('intel') && this.compiler.intelAsm.includes('intel'));
/*                            1                                 0                           */
/*                                                   0                                      */
/*                               !0 => 1                                                    */
```

Removing the check for intelAsm resolves this.

- Extracted the logic that determines the assembly syntax and added unit
tests
  that cover all possible inputs.
- Verified with local Rust.

## Miscellany

- **rm handling of 'last operand'**
- **fix: order-agnostic refCardinalityOfSrcDstOperands**
- Marked TODO: only show warnings where relevant, i.e. if the
cardinality of
src/dst operands is not shown in tooltip text but is shown in context
menu,
then the warning should only display in the context menu. Beyond scope
of
    this PR.
- **optional supportsIntel arg, test undefined supportsIntel**

<!-- THIS COMMENT IS INVISIBLE IN THE FINAL PR, BUT FEEL FREE TO REMOVE
IT
Thanks for taking the time to improve CE. We really appreciate it.
Before opening the PR, please make sure that the tests & linter pass
their checks,
  by running `make check`.
In the best case scenario, you are also adding tests to back up your
changes,
  but don't sweat it if you don't. We can discuss them at a later date.
Feel free to append your name to the CONTRIBUTORS.md file
Thanks again, we really appreciate this!
-->
2026-04-14 20:49:30 -05:00
Manu Linares
62b25f64b1 Add C3 compilers up to 0.7.11 (#8619)
- Add missing versions to group.c3c.compilers

https://github.com/compiler-explorer/infra/pull/2061
https://github.com/compiler-explorer/infra/pull/2067
2026-04-14 20:46:17 -05:00
Patrick Quist
6b1ff666f2 cmake support for asm (#8575) 2026-03-21 21:21:40 +01:00
Sean Garwood
9e23c1f8bb Fix AT&T Syntax Warning Behavior (#8571) 2026-03-20 21:03:57 +01:00
Matt Godbolt
18d019cc49 Update dependencies and bump webpack cache version (#8556)
## Summary
- Update all packages to latest within semver range (AWS SDK, biome,
sentry, vitest, cypress, sass, webpack, etc.)
- Major version bumps: `@types/jquery` 4.0, `@types/supertest` 7.2,
`copy-webpack-plugin` 14, `css-minimizer-webpack-plugin` 8
- Bump `webpackJsHack` from v65 to v66

All major bumps were either additive type changes or Node.js version
floor bumps — no code changes required. Golden layout intentionally left
as-is.

## Test plan
- [x] `npm run ts-check` passes
- [x] `npm run lint-check` passes
- [x] `npm run test-min` passes (105 test files, 1509 tests)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-13 10:37:40 +00:00
Matt Godbolt (bot acct)
e5fdc3be9b feat: add 'Compile' option to Ctrl+S behaviour setting (#8537)
Fixes #8536.

Adds a new **Compile** option to the *Ctrl+S behaviour* selector in
Settings (alongside the existing Save / Short Link / Reformat / Do
nothing options).

When selected, Ctrl+S behaves identically to Ctrl+Enter: it calls
`maybeEmitChange()` and, if compile-on-change is disabled, explicitly
fires `requestCompilation`.

*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)*

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-03-04 14:27:09 -05:00
Matt Godbolt (bot acct)
54572dfa4d Add LLVM IR filters for declarations and library function thunks (#8503)
Closes #6319
Closes #6320

Adds two new opt-in filter checkboxes to the LLVM IR view's **Filters**
dropdown:

### Hide Declarations (off by default)
Filters external function declaration lines (lines starting with
`declare`). These are forward declarations of external functions and are
often noise when focusing on user code.

**Off by default** — as noted in #6319, `declare` lines are part of
valid IR and are needed when copying output into other tools such as
`opt`, `llc`, `alive2`, etc.

### Hide Library Functions (off by default)
Filters compiler-generated library function thunks — specifically
function definitions whose name matches patterns like `@jfptr_*` (used
by Julia). These are boilerplate wrapper functions that aren't useful
when reading IR.

**Off by default** for the same reason — these are real function
definitions in the IR.

Both filters follow the same pattern as existing IR filters (debug info,
metadata, attributes, comments). Unit tests added in
`llvm-ir-parser-tests.ts` covering filter-on, filter-off, and
preservation of unaffected lines.

*(I'm Molty, an AI assistant acting on behalf of @mattgodbolt)*

---------

Co-authored-by: mattgodbolt-molty <mattgodbolt-molty@users.noreply.github.com>
2026-02-22 17:25:36 -06:00
Matt Godbolt
624c5c026e Update npm dependencies and fix tom-select type import (#8477)
Inline the escape_html type instead of importing from tom-select's
internal dist/types/ path, which was removed in v2.5.1. The type is just
(str: string) => string, so there's no need to depend on the package's
internal file layout.

Also fix missing iframe title attributes in test/embedding.html.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 15:12:07 -06:00
Matt Godbolt
a11ae0dd3a Update jQuery to v4.0.0 (#8402)
## Summary
- Updates jQuery from 3.7.1 to 4.0.0
- Adds `$.trim` polyfill for golden-layout compatibility (golden-layout
1.5.9 uses the removed `$.trim()` API and has an incorrectly vague
`"jquery": "*"` dependency)

Manually tested locally to verify golden-layout works correctly with the
polyfill.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-16 14:07:57 -06:00
jiakaiz-g
ac56744927 Add compiler overrides for dex2oat (#8435) 2026-02-09 19:27:57 +01:00
Matt Godbolt
1f118e6889 Update monaco-editor from 0.49 to 0.55 (#8426)
Bump `monaco-editor` from `^0.49.0` to `^0.55.1` (resolves to 0.55.1).

## What changed in Monaco 0.49 → 0.55

- **0.50–0.52**: Minor additions (placeholder, compactMode, new editor
options)
- **0.53**: AMD build deprecated (we use ESM via webpack — unaffected)
- **0.54**: New `mouseMiddleClickAction` option, bug fixes
- **0.55**: Nested language namespaces moved to top level
(`languages.typescript` → `typescript`, etc.) — we don't use any of
these

## No breaking changes affect our usage

- `deltaDecorations` still works (soft-deprecated since 0.34); existing
TODOs in ast-view and ir-view track migration to
`createDecorationsCollection`
- No removed APIs are used by CE
- `monaco-vim` 0.4.4 has a wildcard peer dep — works fine
- Webpack plugin stays pinned at 7.1.0 due to upstream bug
[microsoft/monaco-editor#5073](https://github.com/microsoft/monaco-editor/issues/5073)
— see #8214 for tracking

Closes #7881

## Testing

-  `npm run ts-check` — all 4 projects pass (backend, frontend, tests,
frontend-tests)
-  `npm run test-min` — 1382 tests passed
-  Dev server: UI renders, compilation works, source-to-asm line
mapping works, vim mode works
-  Zero browser console errors/warnings

---
🤖 *This PR was generated by an LLM (Claude, via OpenClaw)*
2026-02-03 20:25:34 -06:00
Matt Godbolt
53c7dd328b Configure Biome import organiser with grouped imports (#8431)
Enable Biome's `organizeImports` with groups matching the original
ESLint `import/order` configuration:

1. **Node builtins** (`node:fs`, `path`, etc.)
2. *(blank line)*
3. **Third-party packages** (`express`, `@sentry/node`, etc.)
4. *(blank line)*
5. **Local/relative imports** (`../foo.js`, `./bar.js`, aliases)

This resolves the inconsistency where Biome wasn't enforcing import
grouping, meaning new files would lose the blank-line separation that
the old ESLint config enforced.

### Impact
- **354 files** updated out of 738 checked (~48%)
- **+188 / -240 lines** (net -52) — almost entirely single blank line
additions/removals between import groups
- No import reordering; purely group separator consistency

Fixes #7373

🤖 Generated by LLM (Claude, via OpenClaw)
2026-02-01 20:50:46 -06:00
narpfel
2229a31480 Ignore click events when selecting text and the event handler would cancel selection (#8413)
Resolves #8405.
2026-01-31 17:34:26 -06:00
Tony Cook
3d4fc27de0 Add the perl language (#8351)
Based on
https://github.com/KaceCottam/compiler-explorer/commits/language-perl/
rebased, modernized and captures the generated perl op codes.

<img width="1569" height="878" alt="image"
src="https://github.com/user-attachments/assets/4d131097-d258-419b-86c9-1a56c16f9ce2"
/>

---------

Co-authored-by: Kace Cottam <kaceac1@hotmail.com>
2026-01-25 16:50:12 -05:00
Blake Ledden
a38dd5ec3a Revert "Add configurable tab width for assembly output (#8370)" (#8372) 2026-01-06 01:13:03 +01:00
Blake Ledden
598facb03b Add relative line numbers setting (#8366) 2026-01-06 00:08:44 +01:00
Blake Ledden
616c9d0152 Display helpful hints when compilation produces no assembly (#8369) 2026-01-06 00:01:47 +01:00
Blake Ledden
ccea70adf5 Fix CFG layout crash when graph has no blocks (#8371) 2026-01-06 00:01:26 +01:00
Blake Ledden
eebb15cbda Remove extra line spacing in stdout/stderr output (#8367) 2026-01-06 00:00:39 +01:00