In spring 618, with the Sui state embroiled in agrarian rebellions, Emperor Yang was at Jiangdu (江都, in modern Yangzhou, Jiangsu), when the general Yuwen Huaji led a coup against Emperor Yang. After Yuwen's soldiers trapped Emperor Yang in the palace, Yuwen ordered Feng to publicly denounce Emperor Yang for his crimes. Emperor Yang told Feng, "You are well-learned. Why are you doing this?" Feng, in shame, withdrew from Emperor Yang's presence. Yuwen subsequently killed Emperor Yang and declared Emperor Yang's nephew Yang Hao the Prince of Qin emperor.