Depomed reports second-quarter loss but tops expectations