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 19837 - Global named registers support for pointer types
Summary: Global named registers support for pointer types
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: LLVM Codegen (show other bugs)
Version: unspecified
Hardware: PC Linux
: P normal
Assignee: Renato Golin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-23 07:27 PDT by Renato Golin
Modified: 2014-06-05 11:56 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Renato Golin 2014-05-23 07:27:15 PDT
Pointer types are supposed to fit on the architecture registers, so it should be reasonably safe to assume they're safe for named registers. The code below asserts on Clang (Bad register type):

struct p4_Thread {
  struct {
    int len
  } word
};
register struct p4_Thread *p4TH asm("%r15");
fn1() {
  (*p4TH).word.len;
}

Not only we could add support for pointer types, but we *must* not assert on bad register types. We should have an error on SemaDecl before it gets to CGExpr, by checking the type of the register variable and emitting a proper error.

Once this is accepted by Clang, it will fail on LLVM, since "%r15" is not in the list of registers accepted. But that's a separate problem.
Comment 1 Renato Golin 2014-06-05 11:56:15 PDT
Fixed on r210274