You have to realize the loss. That means you have some final determination that it is worthless. Maybe the company buys it back for 1 cent. Or, the company declares bankruptcy and, per the terms of the bankruptcy, the bondholders are paid zero. However, until there is some kind of final determination, you can't take a loss. For example, if the company restructures its debt and pays the bondholders 20 cents on the dollar, then you have realized an 80 cent loss, and you would report the loss by reporting the sale of the bond for less than you paid for it, as of the date you were paid. As long as the there is a possibility of being paid something, the loss can't be taken.
Per the iRS
If you own securities and they become totally worthless, you have a capital loss but not a deduction for bad debt. Worthless securities also include securities that you abandon. To abandon a security, you must permanently surrender and relinquish all rights in the security and receive no consideration in exchange for it.
Treat worthless securities as though they were capital assets sold or exchanged on the last day of the tax year.
You must determine the holding period to determine if the capital loss is short term (one year or less) or long term (more than one year).
Report worthless securities on Part I or Part II of Form 8949, and indicate as a worthless security deduction by writing Worthless in the applicable column of Form 8949.
when the IRS says worthless they mean not even worth 1/2 cent. some securities that are nearly worthless trade off the exchanges so you can't get a current quote. talk to your broker to see if the security is totally worthless.
also see IRS pUB 550 see pages 36 and 55 (this is the 2019 version . the 2020 version hasn't been released)