This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug ada/11079] New: Ada: Inline-Assembler - Outputs => only stores last mentioned register


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Ada: Inline-Assembler - Outputs => only stores last
                    mentioned register
           Product: gcc
           Version: 3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ada
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: graham.hanson@nats.co.uk
                CC: gcc-bugs@gcc.gnu.org

I am using the Mingw distribution: gcc-3.2-Ada-20020817-1.tar.gz. on both 
Windows NT 4 Sp6a and Windows XP Home.

Because I am new to Ada, and as a test, I copied the inline assembler example 
from section 24.7 of the GNAT Users' Guide for Unix Platforms. The example 
compiled Ok but the Vendor_ID function was producing odd results. In 
particular, instead of "GenuineIntel", it was returning "xxxxineIxxxx" where 
the "x"s are random(ish) characters. 
When I compiled using -S the listing showed that only register edx (the one 
containing "ineI"!) was being stored into the Ada variable, ebx and ecx were 
being ignored. This is despite the fact that the code contains:

    Outputs => (Unsigned_Register'Asm_output ("=b", Ebx),
                Unsigned_Register'Asm_output ("=c", Ecx),
                Unsigned_Register'Asm_output ("=d", Edx)) );

By swapping the order around, I was able to demonstrate, that code was only 
being generated to store the last mentioned register (edx in the example). The 
other registers were being ignored!

I have generated a cut down unit asm_bug.adb (and asm_bug.S) demonstrating the 
problem that I can send if required. This unit includes a function Vendor_ID_OK 
that uses CPUID three times storing ebx, ecx and edx separately and returns the 
correct result of "GenuineIntel".


Regards

Graham



------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]