On June 8, 2026, developer clonker from the core Solidity engineering team uncovered a significant bug residing within the analysis phase of the Solidity compiler. The flaw, which has been assigned a medium severity rating on the team’s internal scale, directly impacts how the compiler handles inheritance-dependent decisions when specific custom storage layouts are employed. Because the issue originates within the language frontend’s core analysis mechanisms, it is entirely independent of the chosen compilation pipeline. Consequently, both the modern Intermediate Representation (IR) and the legacy evmasm pipelines are affected by the flaw. In contrast, pure Yul code remains completely unaffected, and transient storage is likewise untouched because custom storage layout definitions are exclusively implemented for persistent storage within the Solidity ecosystem.
The introduction of this software defect can be traced back to Solidity version 0.8.29, a release that notably introduced the storage-end warning feature designed to alert developers when custom storage definitions approach critical capacity thresholds. Due to the persistence of this faulty internal helper function, every single release ranging from Solidity 0.8.29 through version 0.8.35 contains the vulnerability. Fortunately, the core development team moved swiftly to address the issue, and a definitive fix has been incorporated into Solidity version 0.8.36.
To gauge the real-world exposure of this bug, the Solidity team conducted preliminary checks across public development repositories and smart contract registries. A comprehensive GitHub search looking specifically for Foundry configuration files that explicitly suppress Warning 3495 yielded zero results. This lack of suppression flags strongly indicates that intentionally placing storage variables at exceptionally high memory addresses is an exceedingly rare practice among smart contract developers. Furthermore, this empirical observation was reinforced by a broad Sourcify scan targeting affected contracts, which similarly returned no matching instances in deployed codebases.
Which Contracts Are Affected?
Understanding the precise trigger conditions for this compiler bug is essential for developers auditing their codebases. A smart contract is only vulnerable if a very specific and uncommon set of criteria is met simultaneously. Specifically, the contract must utilize a custom storage layout clause positioned dangerously close to the absolute end of the available storage space, and it must incorporate a multi-contract inheritance structure.
Because custom storage layouts placed near the extreme end of the storage architecture are exceptionally uncommon, and because the compiler actively emits protective warnings when such layouts are detected, the pattern required to trigger the bug is rarely seen in professional development environments. As a fundamental rule for developers reviewing their systems, any smart contract that does not make use of a custom storage layout or a multi-contract inheritance hierarchy is entirely unaffected by this compiler anomaly, regardless of the Solidity version used for compilation.
Technical Details
For developers and systems engineers interested in the deep implementation-level root cause behind the vulnerability, the issue lies in how the compiler manages internal AST (Abstract Syntax Tree) annotations during static analysis. The storage-end warning feature was originally shipped in version 0.8.29 to warn developers about potential limitations regarding contract upgradability. Solidity permits developers to assign storage variables to a custom base slot using a specific layout syntax. When the static portion of that designated layout approaches the end of the monumental two to the power of 256 storage slots available in the Ethereum Virtual Machine, the compiler issues a warning. This warning serves to inform the user that they are restricting future upgrade pathways, as subsequent contract upgrades might cause the storage layout to expand beyond the remaining available slots, an action that the compiler would otherwise reject. The warning mechanism specifically triggers when the number of free slots remaining after the layout expression is calculated to be at most two to the power of 64. Because this threshold is triggered by hash-based layout expressions like erc7201, the mathematical probability of accidentally hitting it under normal development conditions is vanishingly small, roughly comparable to a mapping element landing on a predetermined, highly specific slot by sheer coincidence.
The actual root cause of the compiler misbehavior, however, stems from an unintended side effect within the code responsible for emitting this storage-end warning. When the compiler evaluates a contract to identify which variable sits closest to the storage boundary, it attempts to examine the base contracts. It does this by walking the list stored in the linearizedBaseContracts AST annotation, evaluating the entries in reversed order.
Instead of creating a safe, isolated copy of the list for this diagnostic operation, the underlying helper function unwittingly performed the reversal operation directly in place. This mutated the permanent AST annotation data structure, permanently altering the linearization order as it was perceived by every subsequent phase of the compiler.
Digging deeper into the C++ codebase, this unintended mutation was the direct result of utilizing the actions::reverse helper function from the widely adopted ranges-v3 library, instead of the intended views::reverse helper. While the actions variant aggressively modifies the underlying container in-place, the views variant merely produces a non-destructive, reversed view of the data. Unfortunately, because both helper functions share virtually identical signatures, the subtle distinction went completely unnoticed during code review and compilation.
This problematic helper function is invoked exclusively from the specific code path that emits the storage-end warning. Consequently, data corruption only occurs within contracts that actively trigger that particular warning. A significant contributing factor to this oversight was the underlying design philosophy of the compiler’s annotation system itself, where annotations are traditionally mutable by design. This design choice intentionally bypasses strict const-correctness principles, preventing the standard C++ compiler from flagging the destructive call to actions::reverse as an invalid operation.
Effect on the Rest of the Compiler
The linearizedBaseContracts annotation plays a foundational role throughout the entire compilation lifecycle, as it encodes the official C3 linearization of a contract’s inheritance hierarchy. This ordered list is consulted continuously during both semantic analysis and lower-level code generation. When this vital list is silently reversed in place, any downstream resolution dependent upon predictable inheritance order can produce catastrophic errors.
Confirmed consequences of this corruption include a completely reversed state-variable initialization order, incorrect constructor execution sequences, flawed resolution of super and virtual functions, broken virtual modifier resolution, and improper resolution of virtual fallback and receive functions. Furthermore, this reversed order improperly propagates directly into the exported AST JSON output files. Depending on the complexity of the contract architecture, these anomalies manifest either as silent, highly dangerous miscompilations in deployed bytecode or as abrupt internal compiler errors and invalid intermediate representations during the compilation process itself.
Example
To demonstrate how this bug manifests in actual source code, the Solidity team provided a minimal, highly structured reproducer contract designed to meet all necessary trigger conditions. Consider a primary contract A containing a simple public state variable and constructor initializing it to one, followed by a contract B inheriting from A and multiplying that variable by ten, and finally a contract C inheriting from B while introducing a layout clause positioned within the critical range near the end of storage.
In a correctly functioning compilation environment, the inheritance hierarchy flows logically from A to B to C, causing the constructors to execute in their proper, left-to-right sequence. Deploying contract C should result in the state variable holding a predictable value of fifteen. However, because the layout clause places the storage near the extreme end of the addressable space, it triggers the storage-end warning, which in turn invokes the flawed in-place list reversal.
Under the influence of the bug, deploying contract C yields an incorrect value due to the constructors running in a completely inverted order. Interestingly, removing the storage layout clause—and thereby avoiding the storage-end warning—allows the exact same contract hierarchy to compile correctly and yield the expected numerical result, proving that the layout-warning mechanism is the exclusive catalyst for the corruption.
Severity Assessment
While the theoretical impact of the bug is undeniably high—given that a reversed inheritance sequence can silently corrupt critical mechanics like constructor invocation order and state variable initialization—the real-world probability of encountering the issue remains remarkably low. The defect exclusively manifests in scenarios that the storage-end warning already strongly discourages, namely the deployment of custom storage layouts overlapping with the final portion of the storage space.
Furthermore, the corruption does not always manifest as a silent miscompilation. In more sophisticated contract hierarchies involving complex inheritance trees, explicit super calls, constructor parameters, or intricate dependencies between storage variables, the inverted order is statistically likely to trigger an internal compiler error or generate invalid intermediate representation. This forces the compilation process to fail explicitly at build time rather than allowing a compromised artifact to reach a production environment.
The Fix
The core engineering team resolved the issue swiftly by replacing the destructive ranges::actions::reverse call with the safe, non-mutating ranges::views::reverse implementation. This vital adjustment ensures that future diagnostic routines iterate over a cleanly reversed view of the inheritance list without modifying the underlying AST annotations or disrupting subsequent compilation phases.
Acknowledgements
The vulnerability was independently discovered and successfully resolved internally by members of the core Solidity development team, continuing their ongoing commitment to compiler safety and reliability within the broader Ethereum developer ecosystem.

