Quuxplusone / LLVMBugzillaTest

0 stars 0 forks source link

missing error detection in support for variable alias attribute #7193

Open Quuxplusone opened 14 years ago

Quuxplusone commented 14 years ago
Bugzilla Link PR6736
Status NEW
Importance P normal
Reported by Heikki Kultala (hkultala@cs.tut.fi)
Reported on 2010-03-29 09:24:37 -0700
Last modified on 2020-09-14 00:37:33 -0700
Version 2.6
Hardware PC Linux
CC anton@korobeynikov.info, chuyangchen@foxmail.com, llvm-bugs@lists.llvm.org, rafael@espindo.la
Fixed by commit(s)
Attachments
Blocks
Blocked by
See also
There is and attribute to specify variable to be alias of another variable

__attribute__ ((alias ("variable2")));

This makes this variable alias to location variable2

It seems that the correctness of the symbol where the alias is created is not
checked in clang:

__attribute__ ((alias ("variable2 + 2")));

should cause a compiler error, but it passes, and creates a bogus reference to
a variable named "variable2 + 2".

At least newlib seems to use this broken syntax(because gcc can actually do the
calculation), which then goes thru configure check(because the error is not
detected when compiling) but fails on actual linking, which causes newlib to
not work when compiled with clang.
Quuxplusone commented 14 years ago

As an alternative, we might try to accept this weirdness, btu do syntax checking and emit a gep

Quuxplusone commented 14 years ago

That sounds scary to me, we should just require it to be an identifier. Doing anything more complex will be really fragile. Also, relying on it to "pop out to the assembler and just work" won't work with an integrated assembler.

Quuxplusone commented 14 years ago
(In reply to comment #2)
> That sounds scary to me, we should just require it to be an identifier.  Doing
> anything more complex will be really fragile.  Also, relying on it to "pop out
> to the assembler and just work" won't work with an integrated assembler.
Yeah, so, we should just emit an error in this case.
Quuxplusone commented 14 years ago

Sounds right to me.