public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug ada/15896] New: Strange behaviour for inline assembler input constraint
@ 2004-06-09 15:28 jc at apinc dot org
  2004-08-05  6:23 ` [Bug target/15896] " pinskia at gcc dot gnu dot org
  0 siblings, 1 reply; 2+ messages in thread
From: jc at apinc dot org @ 2004-06-09 15:28 UTC (permalink / raw)
  To: gcc-bugs

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


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

* [Bug target/15896] Strange behaviour for inline assembler input constraint
  2004-06-09 15:28 [Bug ada/15896] New: Strange behaviour for inline assembler input constraint jc at apinc dot org
@ 2004-08-05  6:23 ` pinskia at gcc dot gnu dot org
  0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-08-05  6:23 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-08-05 06:23 -------
I don't know Ada that well (in terms of promotions and types) but the following C code produces the 
same ICE so I might assume the issue is that My_Type+constant is being promoted to unsigned long 
long or something along that line:
int f()
{
unsigned long long cu32 = 1;
  asm("%0"::"a"(cu32));
}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
          Component|ada                         |target
     Ever Confirmed|                            |1
   Last reconfirmed|0000-00-00 00:00:00         |2004-08-05 06:23:53
               date|                            |


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


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

end of thread, other threads:[~2004-08-05  6:23 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-06-09 15:28 [Bug ada/15896] New: Strange behaviour for inline assembler input constraint jc at apinc dot org
2004-08-05  6:23 ` [Bug target/15896] " 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).