This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/56546] Using the divide operator on unsigned int produces incorrect code on AVR
- From: "kpet at free dot fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 10 Mar 2013 17:23:18 +0000
- Subject: [Bug target/56546] Using the divide operator on unsigned int produces incorrect code on AVR
- Auto-submitted: auto-generated
- References: <bug-56546-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56546
--- Comment #2 from kpet at free dot fr 2013-03-10 17:23:18 UTC ---
(In reply to comment #1)
> AVR has no divide instruction and / 60 is performed by a multiplication and
> some adjustment.
Thank you for this explanation.
> > gcc-4.7.2, binutils 2.23.1 and avr-libc 1.8.0 give the same result.
>
> Is this an unpatched avr-gcc?
In fact I discovered the issue on a toolchain built with Gentoo's crossdev
tool. They are using a good number of patches but these are not the source of
the problem. After digging a little deeper I discovered that the problem comes
from the build options they use. After a good number of builds on an unpatched
gcc-4.7.2 I've been able to determine that the --disable-multilib option they
use is the source of the issue.
Building with
../configure --prefix=/mnt/work/avr-gentoo-p14-nopie/ --target=avr
--enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
gives a toolchain that does not have the issue reported, whereas building with
../configure --prefix=/mnt/work/avr-gentoo-p14-nopie/ --target=avr
--enable-languages=c,c++ --disable-nls --disable-libssp --with-dwarf2
--disable-multilib
allows to reproduce the issue.
I don't know if building with --disable-multilib is correct and am not sure
anymore this is an upstream bug...