It was hard to isolate, but now I think the testcase is clear.
The following program doesn't compile without any clear justification:

with System.Machine_Code;
with Interfaces; Use Interfaces;

procedure Asm_Bug is
   use System.Machine_Code;
  
   type My_Type is range 0 .. 2**32 - 1;
   for My_Type'Size use 32;

   CMT : constant My_Type := 1;
   CU32 : constant Unsigned_32 := 1;
begin
   Asm ("nop", Inputs => Unsigned_32'Asm_Input ("a", CU32 + 1));
   Asm ("nop", Inputs => My_Type'Asm_Input ("a", CMT));
   Asm ("nop", Inputs => My_Type'Asm_Input ("a", CMT + 1));
end Asm_Bug;

The firsts two inline Asm compile as expected, but the third get the following 
error:
asm_bug.adb: In function `Asm_Bug':
asm_bug.adb:15: error: impossible register constraint in `asm'
asm_bug.adb:16: confused by earlier errors, bailing out

But this code seems correct to me. If the firsts two lines are corrects the last 
must also be correct.

GCC version:
Reading specs from /usr/lib/gcc/i486-linux/3.4.0/specs
Configured with: ../src/configure -v --enable-languages=c,c++,java,f77,pascal,
objc,ada,treelang --prefix=/usr --libexecdir=/usr/lib 
--with-gxx-include-dir=/usr/include/c++/3.4 --enable-shared --with-system-zlib 
--enable-nls --enable-threads=posix --without-included-gettext 
--program-suffix=-3.4 --enable-__cxa_atexit --enable-clocale=gnu 
--enable-libstdcxx-debug --enable-java-gc=boehm --enable-java-awt=gtk 
--disable-werror i486-linux
Thread model: posix
gcc version 3.4.0 (Debian 20040516)

Regards,
JC

-- 
           Summary: Strange behaviour for inline assembler input constraint
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: jc at apinc dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i486-pc-linux-gnu
  GCC host triplet: i486-pc-linux-gnu
GCC target triplet: i486-pc-linux-gnu


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

Reply via email to