Real-parameter square-integrable solutions and the spectrum of differential operators