On June 8, 2026, clonker, a developer on the core Solidity team, uncovered a critical bug residing deep within the analysis phase of the Solidity compiler. The flaw is triggered under specific circumstances when the compiler emits Warning 3495, an alert designed to notify developers when a custom storage layout is situated dangerously close to the absolute end of the available storage space. While the intent behind the warning is to safeguard upgradeability and prevent storage collision risks, the internal implementation of the warning introduced a dangerous side effect: it inadvertently reversed the C3-linearized list of base contracts for the contract undergoing analysis. Because this meticulous linearization process serves as the backbone for inheritance-dependent decisions across nearly every downstream phase of the compiler, the accidental reversal can result in severe miscompilations, unexpected code generation, or internal compiler errors.
The Solidity development team has assigned this vulnerability a severity rating of medium on their internal scale. Because the bug exists directly within the language frontend’s core analysis logic, it is entirely independent of the selected compilation pipeline. Consequently, both the modern IR (Intermediate Representation) and the legacy evmasm code generation pipelines are affected. Pure Yul code, however, remains completely unaffected by the issue. Similarly, transient storage is untouched, primarily because custom storage layouts are formally implemented exclusively for persistent storage within the Ethereum Virtual Machine ecosystem.
An analysis of the version history reveals that the bug was inadvertently introduced in Solidity 0.8.29, the exact release that originally rolled out the storage-end warning feature. As a result, every single compiler version ranging from 0.8.29 up through 0.8.35 is impacted. Fortunately, the Solidity team acted swiftly upon discovery, and the bug has been fully addressed and resolved in Solidity version 0.8.36.
To gauge the real-world prevalence of the issue, the development team conducted broad automated searches. A thorough GitHub query scanning for Foundry configuration files explicitly suppressing Warning 3495 returned zero results, strongly indicating that intentionally positioning storage variables at exceptionally high addresses near the edge of the 2-to-the-256th-power storage space is an extremely rare practice among smart contract developers. This observation was further corroborated by a comprehensive scan performed using Sourcify across verified smart contracts, which similarly yielded no instances of affected contracts currently residing on-chain.
Understanding the Technical Anatomy of the Bug
For developers and systems engineers interested in the deep implementation-level root cause of the vulnerability, the issue stems directly from how the compiler handles AST (Abstract Syntax Tree) annotations regarding base contracts. The linearizedBaseContracts annotation stores the precise C3 linearization of an inheritance hierarchy, a critical sequence consulted continuously during both semantic analysis and machine code generation.
The specific helper function responsible for generating Warning 3495 was designed to walk the list in a reversed order to pinpoint the exact state variable located closest to the storage boundary. However, instead of safely instantiating a separate copy or utilizing a non-destructive iteration view, the implementation mistakenly performed the reversal directly in-place. This altered the persistent state of the annotation data structure, permanently modifying the inheritance order as viewed by every subsequent phase of the compiler.
Under the hood, this misbehavior was traced back to the misuse of the actions::reverse helper function sourced from the ranges-v3 library, substituting what was supposed to be the non-mutating views::reverse helper. While the views variant merely generates a reversed iteration view over a container, the actions variant actively mutates the underlying container in-place. Because both template-based helpers share nearly identical signatures and interfaces, the C3-linearization container was modified directly without raising compiler warnings or errors.
Compounding this issue was the underlying design philosophy of the compiler’s internal annotation architecture, where annotations are traditionally kept mutable to facilitate flexible compiler passes. This design choice bypassed const-correctness checks that would have otherwise prevented the C3-linearization list from being mutated in-place by a routine intended purely to emit an analytical warning message. Because the offending helper is only invoked when the specific warning condition is met, the structural data corruption was isolated strictly to contracts that triggered Warning 3495.
Wide-Ranging Effects on the Compiler Pipeline
The downstream consequences of a corrupted linearizedBaseContracts annotation can be severe. Because the C3 linearization dictates the resolution order for everything tied to multi-inheritance, reversing the list distorts any language feature that relies on inheritance hierarchy. Confirmed ramifications of this bug include a completely reversed state-variable initialization order, an incorrect constructor invocation sequence, broken resolution of super and virtual functions, flawed virtual modifier resolution, and improper resolution of virtual fallback and receive functions. Furthermore, this inverted sequence would propagate directly into the AST JSON export files generated by the compiler.
Depending on the complexity of the smart contract’s architecture, these anomalies manifest in different ways. In simpler contracts, they materialize as silent miscompilations, where the deployed bytecode executes code in an unintended sequence without throwing a compile-time error. In more complex, interconnected inheritance hierarchies—particularly those leveraging intricate constructor parameters, explicit super calls, or tightly coupled storage dependencies—the disrupted sequence frequently triggers internal compiler errors or generates invalid IR, halting the build process and alerting the developer before deployment can occur.
Demonstrating the Flaw Through Minimal Reproducers
To clearly illustrate how the bug manifests in practice, the Solidity team provided a minimal reproducer contract that satisfies all necessary triggering conditions. Consider a primary contract A declaring a public state variable x initialized to 1 within its constructor. Next, a derived contract B inherits from A and multiplies x by 10 in its own constructor. Finally, a third contract C inherits from B while appending a custom layout clause specifying layout at 2**256 - 2**40, with its constructor adding 5 to x.
In a standard, uncorrupted compilation, the inheritance hierarchy flows logically from A to B to C, executing constructors from left to right. Deploying contract C should result in x evaluating to 15, calculated as one multiplied by ten, plus five. However, when compiled under an affected version of Solidity where the storage-end warning is triggered by the high-address layout clause, the reversed linearization forces constructors to execute in the wrong order. Under the bug’s influence, deploying contract C results in x evaluating to 5 instead, demonstrating a silent and dangerous miscompilation of initialization logic. Without the layout clause—and consequently without the warning—the exact same code compiles correctly and yields the expected result of 15.
Severity Assessment and Real-World Risk
While the theoretical impact of the bug is undeniably high due to the potential for silent miscompilations of inheritance-dependent logic, the practical likelihood of encountering it in production environments remains exceptionally low. The vulnerability is strictly gated behind the conditions required to trigger Warning 3495, meaning a codebase must utilize custom storage layouts overlapping with the final 2**64 slots of the Ethereum storage space.
Given that advanced storage layouts are typically managed using deterministic hashing patterns such as ERC-7201 namespaced storage slots—where the probability of landing near the absolute end of storage is vanishingly small—legitimate use cases for placing variables in these high address ranges do not exist in standard development workflows. Moreover, contracts that do not employ custom storage layouts or multi-inheritance are entirely immune to the bug, regardless of the compiler version used.
Resolution and Recommended Developer Actions
The Solidity core team has officially resolved the issue in version 0.8.36 by replacing the erroneous ranges::actions::reverse call with the safe, non-mutating ranges::views::reverse utility, ensuring that analytical warnings can inspect data structures without altering their underlying state.
Developers currently utilizing any compiler version from 0.8.29 through 0.8.35 are strongly advised to upgrade their toolchain to Solidity 0.8.36 or higher as soon as possible. Teams maintaining codebases that make use of custom storage layouts near the end of the address space should review their compilation outputs and verify that inheritance structures and constructor execution orders behave precisely as intended.

