https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119267
Jeffrey A. Law <law at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|SUSPENDED |RESOLVED Resolution|--- |INVALID --- Comment #4 from Jeffrey A. Law <law at gcc dot gnu.org> --- So we discussed this briefly in the RISC-V patchwork call last week. First others confirmed that we do expose LMUL as part of the fake vlen/vtype registers you can attach to an asm statement. That is the good news. The bad news is I totally missed that you had multiple asm statements in your C code. That is extradinarily bad. Nothing prevents code from moving between distinct asm statements except data dependencies. ie, you can have asm ("statement 1"); asm ("statement 2"); The asms will always be emitted in that order. But the compiler is free to insert any code it wants between those two asms as long as it doesn't break data dependencies. Your asms don't expose any of the vector configuration data dependencies and thus is subject to the kinds of behavior you're seeing.