Card 1 of 40
Front. Lexical Context. Why can a comment marker inside a quoted string not automatically start a source comment?
All 40 cards in this deck
1.Lexical Context
Why can a comment marker inside a quoted string not automatically start a source comment?
Lexical meaning depends on context. The scanner must preserve the language's string, escape, and comment rules before later compilation stages interpret the token stream.
2.Source Coordinates
A diagnostic is misaligned after a non-ASCII identifier. Which coordinate systems should be compared?
Stored byte offsets, decoded character positions, and display columns. They need not advance identically, so diagnostics need a consistent mapping back to the user's source view.
3.Binding Identity
What must a local-variable rename preserve?
Declaration/use binding and permitted observability. Equal spelling is not variable identity, and a rename must not capture a use belonging to another scope.
4.Representation Lowering
What must be preserved when a source type becomes a different IR representation?
The source value range, operations, and specified behavior. A narrower width or stronger IR precondition cannot silently replace valid source semantics.
5.Control Flow Edge
Why split an edge from a multi-successor block into a multi-predecessor block?
A new block provides a place for work that belongs only to that edge. Placing it in either endpoint might execute it on additional paths.
6.Dominance Meaning
What does it mean for block B to dominate block D?
Every relevant path from entry to D passes through B. This does not mean D executes on every path that reaches B.
7.Ssa Merge
What does an SSA merge select at a control-flow join?
The value associated with the actual incoming edge. After CFG changes, update merge inputs and affected analyses so that path/value relationships remain valid.
8.Escaping Address
Why can passing a local variable's address to an unknown call block simple scalar promotion?
The callee may access the variable through that address. Promotion must account for observable aliasing and effects rather than assuming all accesses are visible local loads/stores.
9.Speculation Effects
Why is an expression with invariant operands not automatically safe to execute earlier?
Moving it may add evaluation on paths that previously skipped traps, faults, exceptions, or effects. Legality includes when the operation executes, not only its operands.
10.Dead Store Evidence
When can an overwritten store be removed?
When no relevant execution observes its value before replacement, under the applicable memory/effect rules. Aliases, calls, control flow, and volatile semantics can matter.
11.Alias Conservatism
Two pointers have different names. Does that establish that their memory accesses are independent?
No. A valid alias analysis or contract must establish the needed relationship. Distinct expressions can reference the same underlying location.
12.Observable Access
Why are repeated volatile accesses not ordinary redundant loads?
The language may make access count or order observable. Preserve those specified access semantics rather than treating only the resulting value as significant.
13.Concurrent Ordering
What must memory motion around atomic operations respect?
The language memory model and synchronization requirements. A transformation that preserves single-threaded arithmetic can still change required inter-thread behavior.
14.Zero Trip Loop
What trap-related issue appears when hoisting work from a loop that may run zero times?
The hoisted work may execute and trap when the original loop body never ran. Prove safe speculation or otherwise preserve the execution condition.
15.Finite Width Arithmetic
Why can an algebraic strength reduction fail under checked arithmetic?
Intermediate operations can overflow or trap differently even when unbounded-integer formulas agree. Preserve the exact width and overflow contract, including boundary cases.
16.Wrapping Addition
What does 250 + 10 produce under explicitly wrapping unsigned 8-bit arithmetic?
Four: 260 modulo 256. A different source or IR overflow rule would require a different reasoning contract.
17.Semantic Flags
Why must a compiler justify a no-overflow flag rather than add it merely for optimization?
The flag promises a semantic precondition. If violating it changes defined wrapping into undefined behavior, a range proof or equivalent justification is required.
18.Floating Point Identities
Why are real-number identities insufficient for strict floating-point rewrites?
Rounding, signed zeros, NaNs, and specified exceptions can distinguish expressions that are identical over real numbers. Use the actual arithmetic permissions and contracts.
19.Fused Operation
Why may fused multiply-add differ from separate multiply and add?
A fused operation can round once rather than after each operation. Match contraction permissions and required behavior instead of assuming identical rounded results.
20.Vector Legality
What should be established before asking whether vectorization is profitable?
Dependencies, memory-access legality, arithmetic rules, and required effects. A favorable target cost estimate cannot authorize an otherwise invalid transformation.
21.Masked Tail
Why does blending away an inactive vector result not necessarily make its memory access safe?
The access may already have faulted or violated a memory rule. The actual masked operation must suppress forbidden inactive-lane effects under the target contract.
22.Loop Versioning
How can a vector fast path support arrays that sometimes overlap?
Check the fast path's required range assumptions and keep a correct fallback. The runtime test must cover the actual accessed ranges without introducing invalid behavior itself.
23.Analysis Fixed Point
Why can one dataflow sweep be insufficient for a loop?
Facts can circulate through loop backedges. Sound initialization and propagation must reach an appropriate stable solution of the analysis equations.
24.Conservative Join
A location may be written on one incoming path but not another. What must a may-write summary retain?
The possible write. A conservative join includes relevant possibilities instead of choosing the most frequent or textually latest path.
25.Analysis Lifetime
What must a pass do with analyses invalidated by its program edits?
Repair or invalidate them according to their contracts. Reusing a stale dominator tree or effect summary can turn later optimization decisions into unsound assumptions.
26.Register Interference
When do two values interfere for register allocation?
When their required live values conflict with sharing a physical register. Allocation must account for lifetimes, register classes, constraints, moves, and potential spilling.
27.Spill Profitability
Why can spilling a value used in a hot loop cost more than spilling a value on a cold path?
Dynamic loads/stores, frequency, target constraints, and rematerialization affect cost. Static instruction counts alone can misrepresent runtime impact.
28.Abi Boundary
What must separately compiled callers and callees agree on?
Argument/result transfer, register preservation, stack rules, representation, and other ABI obligations. Matching type or symbol names does not establish binary compatibility.
29.Closure Lifetime
What must happen when a returned closure needs a captured local after its creator returns?
Its environment must have a valid lifetime and preserve capture/mutation semantics. A pointer into an expired frame is not a correct representation.
30.Gc Metadata
Why must live-reference metadata track optimized code accurately?
A collector may need to locate and update references at safepoints. Incorrect maps can lose reachable objects or leave stale pointers despite otherwise valid ordinary value calculations.
31.Write Barrier Contract
Why can a pointer store require a runtime barrier even when the stored value is unchanged by the barrier?
The barrier maintains collector tracking invariants. Removing it requires proof that the runtime's mutation-observation contract remains satisfied.
32.Deoptimization State
What must a speculative-code guard failure reconstruct for fallback execution?
The valid language state at the chosen fallback point, including required values, control position, and effects. Physical register identity is not the goal.
33.Specialization Validity
What should happen when a JIT specialization's runtime assumption stops being true?
A correct guard, invalidation, or equivalent protocol must prevent subsequent invalid use. Cached optimized code remains valid only under its established assumptions.
34.Relocation Contract
Why are relocation type and addend important rather than just the referenced symbol's name?
They specify how linking/loading computes an address adjustment under target rules. Wrong width, base, or relative-address interpretation can produce incorrect references.
35.Compiler Cache
What must a compilation cache key represent?
All influential compilation inputs and settings, including dependencies, target features, flags, and toolchain identity. Identical source text alone may not imply reusable output.
36.Profile Objective
Why should a profile-guided cost decision state its workload objective?
Event frequency, request latency, startup, and total resource cost can weight executions differently. An unrepresentative or wrongly weighted profile can make valid code slower for the intended use.
37.Benchmark Observation
Why must a microbenchmark make the intended computation observable?
An optimizer may legally delete unused work. Verify that the measured executable performs the target computation without replacing the benchmark with an unrelated bottleneck.
38.Valid Differential Test
Why exclude undefined behavior from a compiler differential test's oracle?
Different outputs can be permitted when the source has no defined result. A valid mismatch claim needs an applicable semantic contract and a controlled execution environment.
39.Failure Predicate
What must a reduced compiler reproducer preserve?
The investigated failure, validity assumptions, target, and configuration. A smaller program that merely produces a different syntax error is not the original reproducer.
40.Release Argument
How should an engineer justify releasing an optimization?
Combine its semantic argument, regression/property evidence, representative target/workload measurements, and compilation/code-size costs. Neither one faster benchmark nor an IR verifier alone proves the whole claim.
