Forum Discussion
Altera_Forum
Honored Contributor
21 years agoBug in NIOS2 GCC ?
Could this be a bug in the NIOS2-GCC ? char testsub(void) {
return __builtin_ldbio (0x1000);
} Generates the following Assembly code (Using -O2 and -fomit-frame-pointer): movi r3...
Altera_Forum
Honored Contributor
21 years agoHi Sgan,
Thank you very much for finding this issue in the compiler. You are correct that there is a bug here, __builtin_ldbio() should be translating to a ldbio instruction, not a ldhio. This issue will be fixed for the next release of the compiler. If this is causing you a particular issue, I recommend either using __builtin_ldbuio() and sign extending it, or using extended assembly statements. That said, there is a related conversation elsewhere on the forum that you may be interested in. http://www.niosforum.com/forum/index.php?a...ct=st&f=2&t=435 (http://www.niosforum.com/forum/index.php?act=st&f=2&t=435) This discusses some of the other issues that you point out here, as even if this bug did not exist, the generated assembly would be:movi r3, 4096
ldbio r2, 0(r3)
slli r2, r2, 24
srai r2, r2, 24
ret in this case as __builtin_ldXio returns ints. Jonah