https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081
--- Comment #3 from rguenther at suse dot de <rguenther at suse dot de> --- On Tue, 7 Jul 2020, jbeulich at suse dot com wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96081 > > --- Comment #2 from jbeulich at suse dot com --- > I wasn't even aware of -fno-toplevel-reorder, this suffices as a workaround > here. Thanks. > > If nevertheless you're still interested in a testcase, please let me know; for > the moment I'll assume this is intended behavior, even if such a change seems > somewhat odd to make between minor version releases. Yes, it's intended behavior and the order is not exactly random but it may indeed appear so - there certainly wasn't an intention to change it. You have to use -fno-toplevel-reorder if the order of asms, functions and variables matter.