Republican Donald Trump’s lawyers questioned the legality of a maneuver that enabled him to avoid paying taxes on hundreds of millions of dollars. The New York Times reported Monday it had obtained documents indicating Trump was warned his failure to report forgiven debt as income on his Atlantic City, New Jersey, casinos could be questioned by the Internal Revenue Service.

Trump has been chortling for weeks his use of tax loopholes make him smart and berating Hillary Clinton for failing to close those loopholes during her time in the Senate. He apparently used tax laws to use a $916 million loss to cancel future income, presumably allowing him to avoid taxes for as long as 18 years. That, however, cannot be confirmed because Trump has refused to release his tax returns.

Trump spokeswoman Hope Hicks called the New York Times report “pure speculation” and said the Times showed “either a fundamental misunderstanding or an intentional misreading of the law.”

Trump’s Atlantic City casinos were saddled with $1.3 billion in debt, and by 1992 all three had filed for bankruptcy. Bondholders forgave hundreds of millions of dollars in debt.

The Times said it combed the bankruptcy filings. The Times said Trump employed a strategy known as a “stock-for-debt” swap, meaning investors take stock, regardless of market value, instead of the money owed so the forgiven debt would not have to be reported as taxable income.

Since Trump’s casinos were owned by partnerships, he swapped debt for partnership equity, putting a new spin on the maneuver. Before employing it, however, Trump sought a formal tax opinion letter. Trump was warned in the letter there was no “definitive judicial or administrative authority” for the partnership gambit, and there was a “substantial” chance of tax consequences for the plan.

Congress and the IRS tried to curb the practice in the 1980s. Stock-for-debt was finally banned in 1993 and the equity-for-debt swap by partnerships in 2004. Clinton was among those who voted to close the loophole.

It is unclear if the IRS ever challenged Trump’s maneuver. Trump’s accountants said in a financial disclosure statement Trump had been under audit as of 1993, a year after the debt was forgiven. Results of the audit have not been released.