nickdesaulniers added a comment.

In D66492#2350947 <https://reviews.llvm.org/D66492#2350947>, @iajbar wrote:
> Clang crashes when calling getLLVMLinkageVarDefinition() in 
> EmitAliasDefinition() when compiling this testcase:
> enum a_type { a , b, c};
> typedef enum a_type b_type;
> void foo(b_type x, enum a_type y){}
> void bar(b_type x, enum b_type y) __attribute__ ((alias ("foo")));
>
> DeclTy is not set because of "enum b_type" is incomplete type. So calling 
> getLLVMLinkageVarDefinition(cast<VarDecl>(GD.getDecl()),..) triggered an 
> assert because GD.getDecl() is FunctionDecl.

It's probably worth noting that the input is funny because `enum b_type` != 
`b_type`.

>> warning: declaration of 'enum b_type' will not be visible outside of this 
>> function [-Wvisibility]

Turns out, the enum and the typedef are red herrings. Because the types don't 
match we should be warning via `-Wattribute-alias=1` that GCC has but we don't.

  void test13(float y) {}
  void test13_foo(int y) __attribute__((alias ("test13")));

GCC:

  <source>:5:6: warning: 'test13_foo' alias between functions of incompatible 
types 'void(int)' and 'void(float)' [-Wattribute-alias=]

We should still not crash.  I don't plan on implementing `-Wattribute-alias=` 
today, but will try to fix up the crash.
https://bugs.llvm.org/show_bug.cgi?id=47957 for the feature request.
https://reviews.llvm.org/D90073


Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D66492/new/

https://reviews.llvm.org/D66492

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to