https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116504
--- Comment #10 from Zdenek Sojka <zsojka at seznam dot cz> --- (In reply to Jeffrey A. Law from comment #9) > I should have caught this earlier. > > When you specify -mcpu=sifive-x280 you're picking up the vector length for > that design, specifically 512 bits. The code is not guaranteed to run on > designs with a smaller vlen. > > QEMU defaults to a vector length of 128bits. So the code misbehaves. > Similarly the BPI is a 256 bit unit, so it misbehaves there too. > > If you tell QEMU to use a 512 bit vector the test passes fine: > > > jlaw@x11-dpi:~/test/obj/rv/gcc/gcc$ ./a.out > Aborted > jlaw@x11-dpi:~/test/obj/rv/gcc/gcc$ QEMU_CPU=rv64,v=true,vlen=512 ./a.out > jlaw@x11-dpi:~/test/obj/rv/gcc/gcc$ Thank you for the explanation Jeff, and also for the guidance! I am sorry for the invalid PRs, and the wasted time; I would expect the minimal vector length would be part of the ELF header, and qemu would either configure the emulation accordingly, or refuse to execute the binary.
