It's only UB if the pointed to object is actually const (in which case it might live in read-only memory).
[dead]
[dead]