# panic: runtime error: invalid memory address or nil pointer dereference (atomic load)

- **ID:** `go/atomic-operation-misuse`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Using atomic operations on a nil pointer or unaligned memory, causing a panic.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.4 | active | — | — |
| 1.23 | active | — | — |

## Workarounds

1. **Ensure pointer is initialized before atomic operations** (95% success)
   ```
   var val int64
atomic.StoreInt64(&val, 42)
   ```
2. **Use atomic.Value for arbitrary types** (90% success)
   ```
   var v atomic.Value
v.Store(42)
val := v.Load().(int)
   ```

## Dead Ends

- **Using mutex instead of atomic but not initializing pointer** — Mutex also requires valid pointer; same issue. (60% fail)
- **Ignoring alignment requirements for atomic operations on struct fields** — Atomic operations require natural alignment; panic may occur on some architectures. (70% fail)
