This is a product-specific issue so it's best dealt with on the saxon-help list or forum at sourceforge.net. Please supply a complete stylesheet that demonstrates the problem, it's impossible to debug code when you only have fragments.
saxon:assign is a somewhat dubious extension because it breaks the declarative nature of the language, and there can certainly be cases where optimization of the surrounding code causes it not to behave in the way you might expect. The amount of rewrite optimization that Saxon is doing these days is steadily making this problem worse. There's usually a better way of coding the transformation.
Author, XSLT Programmer's Reference and XPath 2.0 Programmer's Reference