LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 1356 - [inlineasm] integer mem input uses int operand as address instead of value
Summary: [inlineasm] integer mem input uses int operand as address instead of value
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Common Code Generator Code (show other bugs)
Version: 1.0
Hardware: Macintosh MacOS X
: P normal
Assignee: Chris Lattner
URL:
Keywords: miscompilation
Depends on:
Blocks:
 
Reported: 2007-04-25 01:45 PDT by Oliver Hunt
Modified: 2010-03-06 13:59 PST (History)
2 users (show)

See Also:
Fixed By Commit(s):


Attachments
Simple test case (491 bytes, text/plain)
2007-04-25 01:46 PDT, Oliver Hunt
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Oliver Hunt 2007-04-25 01:45:10 PDT
llvm-gcc generates invalid code for a function consisting only of a single inline asm statement
Comment 1 Oliver Hunt 2007-04-25 01:46:25 PDT
Created attachment 800 [details]
Simple test case

This simple test case compiles and runs fine in gcc at any optimisation level,
but crashes when compiled with llvm-gcc
Comment 2 Chris Lattner 2007-04-27 12:23:05 PDT
Taking a look, we probably don't handle the 'o' constraint.
Comment 3 Chris Lattner 2007-04-27 13:19:33 PDT
hrm, this is nasty.  The code generator is seeing o as a memory constraint (correct) then seeing the integer 
constant as a valid offsetable address (wrong).  Tracking.
Comment 4 Chris Lattner 2007-04-27 16:45:56 PDT
I am working on fixing this, but it may take several days.  The workaround is to remove 'o' from the inline 
asm.
Comment 5 Chris Lattner 2007-04-28 01:44:21 PDT
Fixed.  Many patches made this possible, but the final patch is here: 
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048601.html

Testcase here: CodeGen/X86/2007-04-27-InlineAsm-IntMemInput.ll

Many thanks for the reduced testcase!

-Chris
Comment 6 Oliver Hunt 2007-04-28 01:47:12 PDT
Awesome, it will probably be a wee while before i can verify alas :(