mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-25 19:06:05 +00:00

When aliasing a static array, the aliasee is going to be a GEP which points to the value. We should strip pointer casts before forming the reference. This was occluded by the use of opaque pointers. This problem has existed since the introduction of the debug info generation for aliases in b1ea0191a42074341847d767609f66a26b6d5a41. The test case would assert due to the invalid cast with or without `-no-opaque-pointers` at that revision. Fixes: #57179
15 lines
386 B
C
15 lines
386 B
C
// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -emit-llvm -debug-info-kind=limited %s -o - | FileCheck %s
|
|
// REQUIRES: asserts
|
|
|
|
struct S {
|
|
void *p;
|
|
};
|
|
|
|
struct S s[] = {
|
|
{ .p = (void *)0, },
|
|
};
|
|
|
|
extern struct S t __attribute__((__alias__("s")));
|
|
|
|
// CHECK: !DIImportedEntity(tag: DW_TAG_imported_declaration, name: "t", scope: {{.*}}, entity: {{.*}}, file: {{.*}}, line: 12)
|