Built-in ASM constraint "rm" does not work (i386)

Bug #789031 reported by David Henningsson
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-4.5 (Ubuntu)
Invalid
High
Unassigned

Bug Description

Try to compile the attached program with "gcc -O2 -g test.c" on i386. It fails with this error:

test.c: In function ‘main’:
test.c:7:3: error: can't find a register in class ‘GENERAL_REGS’ while reloading ‘asm’
test.c:7:3: error: ‘asm’ operand has impossible constraints

As I understand it, the correct behaviour would be to use memory for some parameters and registers for other parameters as I specifically allow both.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: gcc 4:4.5.2-1ubuntu3
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic i686
NonfreeKernelModules: nvidia
Architecture: i386
Date: Fri May 27 11:23:16 2011
InstallationMedia: Ubuntu 11.04 "Natty Narwhal" - Alpha i386 (20110322.1)
ProcEnviron:
 LANGUAGE=sv_SE:en
 LANG=sv_SE.UTF-8
 SHELL=/bin/bash
SourcePackage: gcc-defaults
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
David Henningsson (diwic) wrote :
Revision history for this message
David Henningsson (diwic) wrote :
affects: gcc-defaults (Ubuntu) → gcc-4.5 (Ubuntu)
Revision history for this message
Andy Whitcroft (apw) wrote :

Seems to be present in 4.6 (from oneiric) also:

  (oneiric-i386)$ gcc-4.6 -O2 -g -o test2 test2.c
  test2.c: In function 'main':
  test2.c:7:3: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
  test2.c:7:3: error: 'asm' operand has impossible constraints

and in 4.4 (from lucid):

  (oneiric-i386)$ gcc-4.6 -O2 -g -o test2 test2.c
  test2.c: In function 'main':
  test2.c:7:3: error: can't find a register in class 'GENERAL_REGS' while reloading 'asm'
  test2.c:7:3: error: 'asm' operand has impossible constraints

Revision history for this message
David Henningsson (diwic) wrote :

Since this bug also can generate faulty code with this file: http://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/pulsecore/svolume_sse.c - it allocates the rm into the same register as another r, I'm marking this as high priority.

Changed in gcc-4.5 (Ubuntu):
importance: Undecided → High
status: New → Triaged
summary: - Built-in ASM constraint "rm" does not work
+ Built-in ASM constraint "rm" does not work (i386)
Revision history for this message
Matthias Klose (doko) wrote :

afaiu, there is no way to say to use all free register's, and for the rest memory. the "r" constraint cannot be fulfilled for all operands. use a "m" constraint for the last to operands, and the code builds.

Changed in gcc-4.5 (Ubuntu):
status: Triaged → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.