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 1339 - [x86] dollar-signs in identifiers in assembly not protected
Summary: [x86] dollar-signs in identifiers in assembly not protected
Status: RESOLVED FIXED
Alias: None
Product: libraries
Classification: Unclassified
Component: Backend: X86 (show other bugs)
Version: trunk
Hardware: PC Linux
: P normal
Assignee: Dan Gohman
URL:
Keywords: compile-fail
Depends on:
Blocks:
 
Reported: 2007-04-17 13:43 PDT by Dan Gohman
Modified: 2010-02-22 12:52 PST (History)
1 user (show)

See Also:
Fixed By Commit(s):


Attachments
a possible fix (1.56 KB, patch)
2007-04-17 13:46 PDT, Dan Gohman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Gohman 2007-04-17 13:43:05 PDT
In this testcase:

declare void @"$foo"()

define void @bar() {
  call void @"$foo"()
  ret void
}

For x86, llvm emits the following:
        call $foo
With GAS, this gets an error:

test.s:9: Error: suffix or operands invalid for `call'

This can be fixed by enclosing the name in parentheses, like this:
        call ($foo)
Comment 1 Dan Gohman 2007-04-17 13:46:38 PDT
Created attachment 786 [details]
a possible fix

This patch Works For Me, along with some corresponding testsuite
changes. It could be made smarter, such as not using parentheses
when no dollar signs are present, but they don't cause errors.
Comment 2 Chris Lattner 2007-04-17 13:49:17 PDT
Interesting bug.  Your patch looks like the right first step.  Please do take the next one, to make it not 
print parens when not needed.  This should only occur for the GlobalValue case, in which case a strchr of 
the name should work, or is there some other bad case?

-Chris
Comment 3 Dan Gohman 2007-04-26 16:09:14 PDT
Fixed.  Patch here:
http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20070423/048526.html

Testcase here: test/CodeGen/X86/dollar-name.ll