public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug inline-asm/44018]  New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
@ 2010-05-06 22:53 lloyd at randombit dot net
  2010-05-06 22:54 ` [Bug inline-asm/44018] " lloyd at randombit dot net
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: lloyd at randombit dot net @ 2010-05-06 22:53 UTC (permalink / raw)
  To: gcc-bugs

I have some code (will be attached) that fails to compile with GCC 4.5.0 if you
use the exact right (wrong) flags:

$ g++-4.5.0 -fPIC -m32 -O2 -c cpuid.cpp -o cpuid.o
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h: In function 'unsigned
int get_x86_cache_line_size()':
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: can't
find a register in class 'CLOBBERED_REGS' while reloading 'asm'
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm'
operand has impossible constraints
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm'
operand has impossible constraints
/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/cpuid.h:179:52: error: 'asm'
operand has impossible constraints

If not using -fPIC, or if using -O instead of -O2, it compiles. This code
compiles with the same flags (and any other permutation I've thought to try)
with GCC 4.3.1 and 4.4.3. As far as I know the code is valid. I've pruned it
down as much as I could.

$ g++-4.5.0 -v
Using built-in specs.
COLLECT_GCC=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0/g++
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/x86_64-pc-linux-gnu/4.5.0/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /tmp/portage/sys-devel/gcc-4.5.0/work/gcc-4.5.0/configure
--prefix=/usr --bindir=/usr/x86_64-pc-linux-gnu/gcc-bin/4.5.0
--includedir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include
--datadir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0
--mandir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/man
--infodir=/usr/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/info
--with-gxx-include-dir=/usr/lib/gcc/x86_64-pc-linux-gnu/4.5.0/include/g++-v4
--host=x86_64-pc-linux-gnu --build=x86_64-pc-linux-gnu --disable-altivec
--disable-fixed-point --with-ppl --with-cloog --disable-lto --enable-nls
--without-included-gettext --with-system-zlib --disable-checking
--disable-werror --enable-secureplt --enable-multilib --enable-libmudflap
--disable-libssp --enable-libgomp --enable-cld
--with-python-dir=/share/gcc-data/x86_64-pc-linux-gnu/4.5.0/python
--disable-libgcj --enable-languages=c,c++,fortran --enable-shared
--enable-threads=posix --enable-__cxa_atexit --enable-clocale=gnu
--with-bugurl=http://bugs.gentoo.org/ --with-pkgversion='Gentoo 4.5.0 p1.0'
Thread model: posix
gcc version 4.5.0 (Gentoo 4.5.0 p1.0) 

This is the Gentoo build of GCC 4.5.0, but I've checked the packaging; there
are no noticeable patches being applied to the 4.5.0 sources, so I think this
is a problem in vanilla 4.5.0.


-- 
           Summary: Using cpuid.h, can't find a register in class
                    'CLOBBERED_REGS' while reloading 'asm'
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lloyd at randombit dot net
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


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


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

* [Bug inline-asm/44018] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
@ 2010-05-06 22:54 ` lloyd at randombit dot net
  2010-05-07  0:30 ` hjl dot tools at gmail dot com
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: lloyd at randombit dot net @ 2010-05-06 22:54 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from lloyd at randombit dot net  2010-05-06 22:53 -------
Created an attachment (id=20591)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=20591&action=view)
Testcase


-- 


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


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

* [Bug inline-asm/44018] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
  2010-05-06 22:54 ` [Bug inline-asm/44018] " lloyd at randombit dot net
@ 2010-05-07  0:30 ` hjl dot tools at gmail dot com
  2010-05-07 10:11 ` rguenth at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-05-07  0:30 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hjl dot tools at gmail dot com  2010-05-07 00:29 -------
It is triggered by revision 147395:

http://gcc.gnu.org/ml/gcc-cvs/2009-05/msg00369.html


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hubicka at gcc dot gnu dot
                   |                            |org


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


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

* [Bug inline-asm/44018] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
  2010-05-06 22:54 ` [Bug inline-asm/44018] " lloyd at randombit dot net
  2010-05-07  0:30 ` hjl dot tools at gmail dot com
@ 2010-05-07 10:11 ` rguenth at gcc dot gnu dot org
  2010-05-07 12:20 ` ubizjak at gmail dot com
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-07 10:11 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #3 from rguenth at gcc dot gnu dot org  2010-05-07 10:11 -------
Well, it probably failed before with -funroll-loops.  Why's the cpuid functions
not marked with noinline?


-- 


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


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

* [Bug inline-asm/44018] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (2 preceding siblings ...)
  2010-05-07 10:11 ` rguenth at gcc dot gnu dot org
@ 2010-05-07 12:20 ` ubizjak at gmail dot com
  2010-05-07 13:09 ` hjl dot tools at gmail dot com
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: ubizjak at gmail dot com @ 2010-05-07 12:20 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from ubizjak at gmail dot com  2010-05-07 12:19 -------
(In reply to comment #3)
> Well, it probably failed before with -funroll-loops.  Why's the cpuid functions
> not marked with noinline?

Because it is only one instruction?


-- 


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


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

* [Bug inline-asm/44018] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (3 preceding siblings ...)
  2010-05-07 12:20 ` ubizjak at gmail dot com
@ 2010-05-07 13:09 ` hjl dot tools at gmail dot com
  2010-05-11 13:29 ` [Bug inline-asm/44018] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: hjl dot tools at gmail dot com @ 2010-05-07 13:09 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #5 from hjl dot tools at gmail dot com  2010-05-07 13:08 -------
For some reason, when I change it to C, it compiles.


-- 

hjl dot tools at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl dot tools at gmail dot
                   |                            |com
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
   Last reconfirmed|0000-00-00 00:00:00         |2010-05-07 13:08:33
               date|                            |


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


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

* [Bug inline-asm/44018] [4.5/4.6 Regression] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (4 preceding siblings ...)
  2010-05-07 13:09 ` hjl dot tools at gmail dot com
@ 2010-05-11 13:29 ` rguenth at gcc dot gnu dot org
  2010-05-19 12:55 ` rguenth at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-11 13:29 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |4.5.1


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


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

* [Bug inline-asm/44018] [4.5/4.6 Regression] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (5 preceding siblings ...)
  2010-05-11 13:29 ` [Bug inline-asm/44018] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
@ 2010-05-19 12:55 ` rguenth at gcc dot gnu dot org
  2010-05-26 10:04 ` jakub at gcc dot gnu dot org
  2010-07-25  1:50 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2010-05-19 12:55 UTC (permalink / raw)
  To: gcc-bugs



-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2


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


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

* [Bug inline-asm/44018] [4.5/4.6 Regression] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (6 preceding siblings ...)
  2010-05-19 12:55 ` rguenth at gcc dot gnu dot org
@ 2010-05-26 10:04 ` jakub at gcc dot gnu dot org
  2010-07-25  1:50 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: jakub at gcc dot gnu dot org @ 2010-05-26 10:04 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #6 from jakub at gcc dot gnu dot org  2010-05-26 10:03 -------
Perhaps related to PR44174.


-- 


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


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

* [Bug inline-asm/44018] [4.5/4.6 Regression] Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm'
  2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
                   ` (7 preceding siblings ...)
  2010-05-26 10:04 ` jakub at gcc dot gnu dot org
@ 2010-07-25  1:50 ` pinskia at gcc dot gnu dot org
  8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2010-07-25  1:50 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #7 from pinskia at gcc dot gnu dot org  2010-07-25 01:49 -------
(In reply to comment #6)
> Perhaps related to PR44174.

Not just perhaps but exactly the same both have the same constraints.


Note this testcase here works now on the trunk but that could have been because
of other changes.

*** This bug has been marked as a duplicate of 44174 ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |DUPLICATE


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


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

end of thread, other threads:[~2010-07-25  1:50 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-06 22:53 [Bug inline-asm/44018] New: Using cpuid.h, can't find a register in class 'CLOBBERED_REGS' while reloading 'asm' lloyd at randombit dot net
2010-05-06 22:54 ` [Bug inline-asm/44018] " lloyd at randombit dot net
2010-05-07  0:30 ` hjl dot tools at gmail dot com
2010-05-07 10:11 ` rguenth at gcc dot gnu dot org
2010-05-07 12:20 ` ubizjak at gmail dot com
2010-05-07 13:09 ` hjl dot tools at gmail dot com
2010-05-11 13:29 ` [Bug inline-asm/44018] [4.5/4.6 Regression] " rguenth at gcc dot gnu dot org
2010-05-19 12:55 ` rguenth at gcc dot gnu dot org
2010-05-26 10:04 ` jakub at gcc dot gnu dot org
2010-07-25  1:50 ` pinskia 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).