This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Sun, 2015-11-15 02:49:03 -0500, Mike Frysinger <vapier@gentoo.org> wrote: > This code tries to shift an integer 31 bits which triggers a werror: > gas/config/tc-microblaze.c:742:21: error: integer overflow in expression [-Werror=overflow] > e->X_add_number |= -(1 << 31); > > Cast the 1 to offsetT to match X_add_number to fix things. > > 2015-11-15 Mike Frysinger <vapier@gentoo.org> > > * config/tc-microblaze.c (parse_imm): Add an offsetT cast. > gas/config/tc-microblaze.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/gas/config/tc-microblaze.c b/gas/config/tc-microblaze.c > index ac7c828..0ec24f8 100644 > --- a/gas/config/tc-microblaze.c > +++ b/gas/config/tc-microblaze.c > @@ -739,7 +739,7 @@ parse_imm (char * s, expressionS * e, offsetT min, offsetT max) > { > /* Special case: sign extend negative 32-bit values to 64-bits. */ > if ((e->X_add_number >> 31) == 1) > - e->X_add_number |= -(1 << 31); > + e->X_add_number |= -((offsetT) 1 << 31); > > if (e->X_add_number < min || e->X_add_number > max) > { Even with this cast in place, gcc111 still warns on this: jbglaw@power-aix:~$ gcc --version gcc (GCC) 4.8.1 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Build log can be found at http://toolchain.lug-owl.de/buildbot/show_build_details.php?id=484233 : gcc -DHAVE_CONFIG_H -I. -I/home/jbglaw/repos/binutils_gdb/gas -I. -I/home/jbglaw/repos/binutils_gdb/gas -I../bfd -I/home/jbglaw/repos/binutils_gdb/gas/config -I/home/jbglaw/repos/binutils_gdb/gas/../include -I/home/jbglaw/repos/binutils_gdb/gas/.. -I/home/jbglaw/repos/binutils_gdb/gas/../bfd -DLOCALEDIR="\"/home/jbglaw/build/microblaze-linux/_install_/share/locale\"" -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Werror -I/home/jbglaw/repos/binutils_gdb/gas/../zlib -g -O2 -MT tc-microblaze.o -MD -MP -MF .deps/tc-microblaze.Tpo -c -o tc-microblaze.o `test -f 'config/tc-microblaze.c' || echo '/home/jbglaw/repos/binutils_gdb/gas/'`config/tc-microblaze.c /home/jbglaw/repos/binutils_gdb/gas/config/tc-microblaze.c: In function 'parse_imm': /home/jbglaw/repos/binutils_gdb/gas/config/tc-microblaze.c:742:21: error: integer overflow in expression [-Werror=overflow] e->X_add_number |= -((offsetT) 1 << 31); ^ cc1: all warnings being treated as errors make[3]: *** [tc-microblaze.o] Error 1 make[3]: Leaving directory `/home/jbglaw/build/microblaze-linux/build-binutils-full/gas' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory `/home/jbglaw/build/microblaze-linux/build-binutils-full/gas' make[1]: *** [all] Error 2 make[1]: Leaving directory `/home/jbglaw/build/microblaze-linux/build-binutils-full/gas' make: *** [all-gas] Error 2 MfG, JBG -- Jan-Benedict Glaw jbglaw@lug-owl.de +49-172-7608481 Signature of: Ich hatte in letzter Zeit ein biÃchen viel Realitycheck. the second : Langsam mÃchte ich mal wieder weitertrÃumen kÃnnen. -- Maximilian Wilhelm (18. Mai 2005, #lug-owl.de)
Attachment:
signature.asc
Description: Digital signature
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |