public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024)
@ 2012-10-19 10:39 hechtb at gmail dot com
  2012-10-19 11:01 ` [Bug target/54983] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: hechtb at gmail dot com @ 2012-10-19 10:39 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54983

             Bug #: 54983
           Summary: ARM gcc creates invalid assembly: bad immediate value
                    for 8-bit offset (1024)
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: hechtb@gmail.com


Created attachment 28488
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=28488
Includes a .config to build the v3.7-rc1 kernel and the --save-temps file

The bug appeared on new linux ARM kernel versions and I cite here a kernel
maintainer responding to my patch submission:

"Hi, I used to be able to compile MTD stuff for mackerel board with the
defconfig attached, but now it fails with 3.7-rc1 with as error:

/tmp/cc2Nr7AN.s: Error: bad immediate value for 8-bit offset (1024)

It fails for dogc4.c, but if I disable DOCG4, it fails for other drivers
with a similar error.

I've tried (arm) gcc 4.6.3 and the latest Linaro 4.7 build."

In order to reproduce the bug, please get a repository of the kernel and
checkout "v3.7-rc1" and use the attached .config. The bug happens when building
the modules. I'm sorry but I see no way figuring out all the dependencies of a
kernel build to supply a more compact way to test this. I used 

make -j16 ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- modules

and get the error:

/tmp/ccwLMdCy.s: Assembler messages:
/tmp/ccwLMdCy.s: Error: bad immediate value for 8-bit offset (2048)
make[3]: *** [drivers/mtd/nand/docg4.o] Error 1

# arm-linux-gnueabi-gcc -v
Using built-in specs.
COLLECT_GCC=arm-linux-gnueabi-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/arm-linux-gnueabi/4.6/lto-wrapper
Target: arm-linux-gnueabi
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro
4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.6 --enable-shared --enable-linker-build-id
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext
--enable-threads=posix
--with-gxx-include-dir=/usr/arm-linux-gnueabi/include/c++/4.6.3
--libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--enable-objc-gc --enable-multilib --disable-sjlj-exceptions
--with-arch=armv7-a --with-float=softfp --with-fpu=vfpv3-d16 --with-mode=thumb
--disable-werror --enable-checking=release --build=x86_64-linux-gnu
--host=x86_64-linux-gnu --target=arm-linux-gnueabi
--program-prefix=arm-linux-gnueabi- --includedir=/usr/arm-linux-gnueabi/include
--with-headers=/usr/arm-linux-gnueabi/include
--with-libs=/usr/arm-linux-gnueabi/lib
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5)

Best,

 Bastian Hecht


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/54983] ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024)
  2012-10-19 10:39 [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024) hechtb at gmail dot com
@ 2012-10-19 11:01 ` pinskia at gcc dot gnu.org
  2012-10-19 11:55 ` [Bug c/54983] " hechtb at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-10-19 11:01 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54983

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-10-19 11:01:13 UTC ---
I think there might be an issue with some of the inline-asm in asm/io.h:
static inline __attribute__((always_inline))
__attribute__((no_instrument_function)) void __raw_writew(u16 val, volatile
void *addr)
{
 asm volatile("strh %1, %0"
       : "+Qo" (*(volatile u16 *)addr)
       : "r" (val));


Also what options are being passed to the gcc?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/54983] ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024)
  2012-10-19 10:39 [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024) hechtb at gmail dot com
  2012-10-19 11:01 ` [Bug target/54983] " pinskia at gcc dot gnu.org
@ 2012-10-19 11:55 ` hechtb at gmail dot com
  2012-10-19 16:55 ` rearnsha at gcc dot gnu.org
  2012-10-20 10:30 ` hechtb at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hechtb at gmail dot com @ 2012-10-19 11:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54983

Bastian Hecht <hechtb at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|target                      |c

--- Comment #2 from Bastian Hecht <hechtb at gmail dot com> 2012-10-19 11:55:37 UTC ---
I'm afraid I don't have the knowledge to comment the inline assembly. The
command line is:

arm-linux-gnueabi-gcc -Wp,-MD,drivers/mtd/nand/.docg4.o.d  -nostdinc
-isystem /usr/lib/gcc/arm-linux-gnueabi/4.6/include
-I$KERNEL_DIR/arch/arm/include -Iarch/arm/include/generated  -Iinclude
-I$KERNEL_DIR/arch/arm/include/uapi -Iarch/arm/include/generated/uapi
-I$KERNEL_DIR/include/uapi -Iinclude/generated/uapi -include
$KERNEL_DIR/include/linux/kconfig.h -D__KERNEL__ -mlittle-endian
-Iarch/arm/mach-shmobile/include -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -Wno-format-security
-fno-delete-null-pointer-checks -O2 -marm -fno-dwarf2-cfi-asm
-fno-omit-frame-pointer -mapcs -mno-sched-prolog -mabi=aapcs-linux
-mno-thumb-interwork -D__LINUX_ARM_ARCH__=7 -march=armv7-a
-msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector
-Wno-unused-but-set-variable -fno-omit-frame-pointer
-fno-optimize-sibling-calls -Wdeclaration-after-statement
-Wno-pointer-sign -fno-strict-overflow -fconserve-stack  -DMODULE
-D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(docg4)"
-D"KBUILD_MODNAME=KBUILD_STR(docg4)" --save-temps -c -o
drivers/mtd/nand/docg4.o drivers/mtd/nand/docg4.c


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/54983] ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024)
  2012-10-19 10:39 [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024) hechtb at gmail dot com
  2012-10-19 11:01 ` [Bug target/54983] " pinskia at gcc dot gnu.org
  2012-10-19 11:55 ` [Bug c/54983] " hechtb at gmail dot com
@ 2012-10-19 16:55 ` rearnsha at gcc dot gnu.org
  2012-10-20 10:30 ` hechtb at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2012-10-19 16:55 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54983

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |INVALID

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> 2012-10-19 16:54:41 UTC ---
The 'o' in "+Qo" is invalid for this instruction.  There is, unfortunately, no
way to specify in inline assembly instructions the precise addressing range of
strh.

I think your safest bet is to use "Q".


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug c/54983] ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024)
  2012-10-19 10:39 [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024) hechtb at gmail dot com
                   ` (2 preceding siblings ...)
  2012-10-19 16:55 ` rearnsha at gcc dot gnu.org
@ 2012-10-20 10:30 ` hechtb at gmail dot com
  3 siblings, 0 replies; 5+ messages in thread
From: hechtb at gmail dot com @ 2012-10-20 10:30 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54983

--- Comment #4 from Bastian Hecht <hechtb at gmail dot com> 2012-10-20 10:30:28 UTC ---
Ok I see. Thanks for taking a look at this! I'll check if this is some
regression in the tree and either write a patch or post the issue on the ARM
mailing list.


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-10-20 10:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-19 10:39 [Bug c/54983] New: ARM gcc creates invalid assembly: bad immediate value for 8-bit offset (1024) hechtb at gmail dot com
2012-10-19 11:01 ` [Bug target/54983] " pinskia at gcc dot gnu.org
2012-10-19 11:55 ` [Bug c/54983] " hechtb at gmail dot com
2012-10-19 16:55 ` rearnsha at gcc dot gnu.org
2012-10-20 10:30 ` hechtb at gmail dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).