public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/40803]  New: Optimization generates bad assembly causing compile to fail
@ 2009-07-19  8:18 net147 at gmail dot com
  2009-07-19  8:21 ` [Bug c/40803] " net147 at gmail dot com
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: net147 at gmail dot com @ 2009-07-19  8:18 UTC (permalink / raw)
  To: gcc-bugs

Can't compile Linux 2.6.29.6 kernel with
grsecurity-2.1.14-2.6.29.6-200907122214 patch using GCC 4.4.0.

$ gcc -Wp,-MD,drivers/staging/meilhaus/.memain.o.d  -nostdinc -isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include -Iinclude 
-I/home/net147/gccbug/linux-2.6.29/arch/x86/include -include
include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -O2 -m64 -mtune=generic -mno-red-zone
-mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Iarch/x86/include/asm/mach-default -Wframe-larger-than=2048
-fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement
-Wno-pointer-sign -fwrapv -fno-dwarf2-cfi-asm -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(memain)"  -D"KBUILD_MODNAME=KBUILD_STR(memain)" 
-c -o drivers/staging/meilhaus/memain.o drivers/staging/meilhaus/memain.c
/home/net147/gccbug/linux-2.6.29/arch/x86/include/asm/uaccess_64.h: Assembler
messages:
/home/net147/gccbug/linux-2.6.29/arch/x86/include/asm/uaccess_64.h:92: Error:
suffix or operands invalid for `movq'

The compiler outputs the assembly instruction "movq $4294967295,(%rbp)" which
causes the compile to fail. Compiling with -O0 or with GCC 4.3.3 works.

$ gcc -v
Using built-in specs.
Target: x86_64-unknown-linux-gnu
Configured with: ../configure --prefix=/usr --enable-shared
--enable-languages=c,c++,fortran,objc,obj-c++ --enable-threads=posix
--mandir=/usr/share/man --infodir=/usr/share/info --enable-__cxa_atexit
--disable-multilib --libdir=/usr/lib --libexecdir=/usr/lib --enable-clocale=gnu
--disable-libstdcxx-pch --with-tune=generic
Thread model: posix
gcc version 4.4.0 20090630 (prerelease) (GCC)

Related bug: http://bugs.archlinux.org/task/15498.


-- 
           Summary: Optimization generates bad assembly causing compile to
                    fail
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: blocker
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: net147 at gmail dot com
 GCC build triplet: x86_64-unknown-linux-gnu
  GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu


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


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

* [Bug c/40803] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
@ 2009-07-19  8:21 ` net147 at gmail dot com
  2009-07-19  8:22 ` net147 at gmail dot com
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: net147 at gmail dot com @ 2009-07-19  8:21 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from net147 at gmail dot com  2009-07-19 08:21 -------
Created an attachment (id=18225)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18225&action=view)
Preprocessed output

$ gcc -Wp,-MD,drivers/staging/meilhaus/.memain.o.d  -nostdinc -isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include -Iinclude 
-I/home/net147/gccbug/linux-2.6.29/arch/x86/include -include
include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -O2 -m64 -mtune=generic -mno-red-zone
-mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Iarch/x86/include/asm/mach-default -Wframe-larger-than=2048
-fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement
-Wno-pointer-sign -fwrapv -fno-dwarf2-cfi-asm -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(memain)"  -D"KBUILD_MODNAME=KBUILD_STR(memain)" 
-c drivers/staging/meilhaus/memain.c -E > memain.i


-- 


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


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

* [Bug c/40803] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
  2009-07-19  8:21 ` [Bug c/40803] " net147 at gmail dot com
@ 2009-07-19  8:22 ` net147 at gmail dot com
  2009-07-19 15:14 ` [Bug c/40803] [4.4 Regression] " ubizjak at gmail dot com
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: net147 at gmail dot com @ 2009-07-19  8:22 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from net147 at gmail dot com  2009-07-19 08:22 -------
Created an attachment (id=18226)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=18226&action=view)
Assembly output

$ gcc -Wp,-MD,drivers/staging/meilhaus/.memain.o.d  -nostdinc -isystem
/usr/lib/gcc/x86_64-unknown-linux-gnu/4.4.0/include -Iinclude 
-I/home/net147/gccbug/linux-2.6.29/arch/x86/include -include
include/linux/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes
-Wno-trigraphs -fno-strict-aliasing -fno-common
-Werror-implicit-function-declaration -O2 -m64 -mtune=generic -mno-red-zone
-mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1
-DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
-fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
-Iarch/x86/include/asm/mach-default -Wframe-larger-than=2048
-fno-stack-protector -fomit-frame-pointer -Wdeclaration-after-statement
-Wno-pointer-sign -fwrapv -fno-dwarf2-cfi-asm -DMODULE -D"KBUILD_STR(s)=#s"
-D"KBUILD_BASENAME=KBUILD_STR(memain)"  -D"KBUILD_MODNAME=KBUILD_STR(memain)" 
-c drivers/staging/meilhaus/memain.c -S -o memain.s


-- 


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


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

* [Bug c/40803] [4.4 Regression] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
  2009-07-19  8:21 ` [Bug c/40803] " net147 at gmail dot com
  2009-07-19  8:22 ` net147 at gmail dot com
@ 2009-07-19 15:14 ` ubizjak at gmail dot com
  2009-07-19 15:48 ` ubizjak at gmail dot com
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2009-07-19 15:14 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from ubizjak at gmail dot com  2009-07-19 15:14 -------
"i" is not correct constraint to immediate operand for sign-extending movq. 
Use "e".


-- 

ubizjak at gmail dot com changed:

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


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


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

* [Bug c/40803] [4.4 Regression] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
                   ` (2 preceding siblings ...)
  2009-07-19 15:14 ` [Bug c/40803] [4.4 Regression] " ubizjak at gmail dot com
@ 2009-07-19 15:48 ` ubizjak at gmail dot com
  2009-07-19 20:30 ` ubizjak at gmail dot com
  2009-07-19 22:08 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2009-07-19 15:48 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2009-07-19 15:47 -------
BTW: Constraints in arch/x86/include/asm/uaccess_64.h from linux-2.6.31 are
wrong for all cases where mov is suffixed with "q", i.e.:

int __copy_to_user(void __user *dst, const void *src, unsigned size)
{
        ...
        case 8:__put_user_asm(*(u64 *)src, (u64 __user *)dst,
                              ret, "q", "", "ir", 8);
                return ret;
        ...


-- 


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


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

* [Bug c/40803] [4.4 Regression] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
                   ` (3 preceding siblings ...)
  2009-07-19 15:48 ` ubizjak at gmail dot com
@ 2009-07-19 20:30 ` ubizjak at gmail dot com
  2009-07-19 22:08 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: ubizjak at gmail dot com @ 2009-07-19 20:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from ubizjak at gmail dot com  2009-07-19 20:30 -------
FYI, patch for linux kernel is at [1].

[1] http://marc.info/?l=linux-kernel&m=124801961215396&w=2


-- 


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


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

* [Bug c/40803] [4.4 Regression] Optimization generates bad assembly causing compile to fail
  2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
                   ` (4 preceding siblings ...)
  2009-07-19 20:30 ` ubizjak at gmail dot com
@ 2009-07-19 22:08 ` steven at gcc dot gnu dot org
  5 siblings, 0 replies; 7+ messages in thread
From: steven at gcc dot gnu dot org @ 2009-07-19 22:08 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from steven at gcc dot gnu dot org  2009-07-19 22:08 -------
*sigh* another kernel bug where kernel developers just immediately look to
blame gcc instead of trying to see their own mistake...


-- 


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


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

end of thread, other threads:[~2009-07-19 22:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-19  8:18 [Bug c/40803] New: Optimization generates bad assembly causing compile to fail net147 at gmail dot com
2009-07-19  8:21 ` [Bug c/40803] " net147 at gmail dot com
2009-07-19  8:22 ` net147 at gmail dot com
2009-07-19 15:14 ` [Bug c/40803] [4.4 Regression] " ubizjak at gmail dot com
2009-07-19 15:48 ` ubizjak at gmail dot com
2009-07-19 20:30 ` ubizjak at gmail dot com
2009-07-19 22:08 ` steven at gcc dot gnu dot org

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).