-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add missing linkage to global variables.
- Loading branch information
Showing
40 changed files
with
148 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @ai : !hl.lvalue<!hl.array<10, !hl.int>> | ||
// CHECK: hl.var @ai, <common> : !hl.lvalue<!hl.array<10, !hl.int>> | ||
int ai[10]; | ||
|
||
// CHECK: hl.var @aci : !hl.lvalue<!hl.array<5, !hl.int< const >>> | ||
// CHECK: hl.var @aci, <common> : !hl.lvalue<!hl.array<5, !hl.int< const >>> | ||
const int aci[5]; | ||
|
||
// CHECK: hl.var @avi : !hl.lvalue<!hl.array<5, !hl.int< volatile >>> | ||
// CHECK: hl.var @avi, <common> : !hl.lvalue<!hl.array<5, !hl.int< volatile >>> | ||
volatile int avi[5]; | ||
|
||
// CHECK: hl.var @acvi : !hl.lvalue<!hl.array<5, !hl.int< const, volatile >>> | ||
// CHECK: hl.var @acvi, <common> : !hl.lvalue<!hl.array<5, !hl.int< const, volatile >>> | ||
const volatile int acvi[5]; | ||
|
||
// CHECK: hl.var @acvui : !hl.lvalue<!hl.array<5, !hl.int< unsigned, const, volatile >>> | ||
// CHECK: hl.var @acvui, <common> : !hl.lvalue<!hl.array<5, !hl.int< unsigned, const, volatile >>> | ||
const volatile unsigned int acvui[5]; | ||
|
||
// CHECK: hl.var @af : !hl.lvalue<!hl.array<10, !hl.float>> | ||
// CHECK: hl.var @af, <common> : !hl.lvalue<!hl.array<10, !hl.float>> | ||
float af[10]; | ||
|
||
// CHECK: hl.var @a3d : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, !hl.float>>>> | ||
// CHECK: hl.var @a3d, <common> : !hl.lvalue<!hl.array<2, !hl.array<4, !hl.array<3, !hl.float>>>> | ||
float a3d[2][4][3]; | ||
|
||
// CHECK: hl.var @ae : !hl.lvalue<!hl.array<404, !hl.int>> | ||
// CHECK: hl.var @ae, <common> : !hl.lvalue<!hl.array<404, !hl.int>> | ||
int ae[4 + 4*100]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @earr sc_extern : !hl.lvalue<!hl.array<?, !hl.int>> | ||
// CHECK: hl.var @earr, <external> sc_extern : !hl.lvalue<!hl.array<?, !hl.int>> | ||
extern int earr[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @fp16 : !hl.lvalue<!hl.half> | ||
// CHECK: hl.var @fp16, <external> : !hl.lvalue<!hl.half> | ||
__fp16 fp16 = 0.5; | ||
|
||
// CHECK: hl.var @f : !hl.lvalue<!hl.float> | ||
// CHECK: hl.var @f, <external> : !hl.lvalue<!hl.float> | ||
// CHECK: hl.const #core.float<5.000000e-01> : !hl.float | ||
float f = 0.5f; | ||
|
||
// CHECK: hl.var @d : !hl.lvalue<!hl.double> | ||
// CHECK: hl.var @d, <external> : !hl.lvalue<!hl.double> | ||
// CHECK: hl.const #core.float<5.000000e-01> : !hl.double | ||
double d = 0.5; | ||
|
||
// CHECK: hl.var @ld : !hl.lvalue<!hl.longdouble> | ||
// CHECK: hl.var @ld, <external> : !hl.lvalue<!hl.longdouble> | ||
// CHECK: hl.const #core.float<5.000000e-01> : !hl.longdouble | ||
long double ld = 0.5L; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,55 @@ | ||
// // RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// // RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @li : !hl.lvalue<!hl.int< const >> | ||
// CHECK: hl.var @li, <external> : !hl.lvalue<!hl.int< const >> | ||
// CHECK: hl.const #core.integer<10> : !hl.int | ||
const int li = 10; | ||
|
||
// CHECK: hl.var @lui : !hl.lvalue<!hl.int< unsigned, const >> | ||
// CHECK: hl.var @lui, <external> : !hl.lvalue<!hl.int< unsigned, const >> | ||
// CHECK: hl.const #core.integer<10> : !hl.int< unsigned > | ||
const unsigned int lui = 10u; | ||
|
||
// CHECK: hl.var @ll : !hl.lvalue<!hl.long< const >> | ||
// CHECK: hl.var @ll, <external> : !hl.lvalue<!hl.long< const >> | ||
// CHECK: hl.const #core.integer<10> : !hl.long | ||
const long ll = 10l; | ||
|
||
// CHECK: hl.var @lf : !hl.lvalue<!hl.float< const >> | ||
// CHECK: hl.var @lf, <external> : !hl.lvalue<!hl.float< const >> | ||
// CHECK: hl.const #core.float<5.000000e-01> : !hl.float | ||
const float lf = 0.5f; | ||
|
||
// CHECK: hl.var @ld : !hl.lvalue<!hl.double< const >> | ||
// CHECK: hl.var @ld, <external> : !hl.lvalue<!hl.double< const >> | ||
// CHECK: hl.const #core.float<5.000000e-01> : !hl.double | ||
const double ld = 0.5; | ||
|
||
// CHECK: hl.var @lc : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.var @lc, <external> : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.const #core.integer<97> : !hl.int | ||
// CHECK: IntegralCast : !hl.int -> !hl.char | ||
const char lc = 'a'; | ||
|
||
// CHECK: hl.var @null : !hl.lvalue<!hl.ptr<!hl.void< const >>> | ||
// CHECK: hl.var @null, <external> : !hl.lvalue<!hl.ptr<!hl.void< const >>> | ||
// CHECK: hl.const #core.integer<0> : !hl.int | ||
// CHECK: NullToPointer : !hl.int -> !hl.ptr<!hl.void< const >> | ||
const void *null = 0; | ||
|
||
// CHECK: hl.var @lb : !hl.lvalue<!hl.bool< const >> | ||
// CHECK: hl.var @lb, <external> : !hl.lvalue<!hl.bool< const >> | ||
// CHECK: hl.const #core.integer<1> : !hl.int | ||
// CHECK: IntegralToBoolean : !hl.int -> !hl.bool | ||
const _Bool lb = 1; | ||
|
||
#define SCHAR_MIN (-128) | ||
#define SCHAR_MAX 127 | ||
|
||
// CHECK: hl.var @scmin : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.var @scmin, <external> : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.const #core.integer<128> : !hl.int | ||
// CHECK: hl.minus | ||
const char scmin = SCHAR_MIN; | ||
|
||
// CHECK: hl.var @scmax : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.var @scmax, <external> : !hl.lvalue<!hl.char< const >> | ||
// CHECK: hl.const #core.integer<127> : !hl.int | ||
const char scmax = SCHAR_MAX; | ||
|
||
#define UCHAR_MAX 255 | ||
|
||
// CHECK: hl.var @ucmax : !hl.lvalue<!hl.char< unsigned, const >> | ||
// CHECK: hl.var @ucmax, <external> : !hl.lvalue<!hl.char< unsigned, const >> | ||
// CHECK: hl.const #core.integer<255> : !hl.int | ||
const unsigned char ucmax = UCHAR_MAX; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @vp : !hl.lvalue<!hl.ptr<!hl.void>> | ||
// CHECK: hl.var @vp, <external> : !hl.lvalue<!hl.ptr<!hl.void>> | ||
void * vp = 0; | ||
|
||
// CHECK: hl.var @vpp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.void>>> | ||
// CHECK: hl.var @vpp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.void>>> | ||
void ** vpp = 0; | ||
|
||
// CHECK: hl.var @ip : !hl.lvalue<!hl.ptr<!hl.int>> | ||
// CHECK: hl.var @ip, <external> : !hl.lvalue<!hl.ptr<!hl.int>> | ||
int * ip = 0; | ||
|
||
// CHECK: hl.var @icp : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
// CHECK: hl.var @icp, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
int const * icp = 0; | ||
|
||
// CHECK: hl.var @cip : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
// CHECK: hl.var @cip, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
const int * cip = 0; | ||
|
||
// CHECK: hl.var @ipc : !hl.lvalue<!hl.ptr<!hl.int, const >> | ||
// CHECK: hl.var @ipc, <external> : !hl.lvalue<!hl.ptr<!hl.int, const >> | ||
int * const ipc = 0; | ||
|
||
// CHECK: hl.var @icpc : !hl.lvalue<!hl.ptr<!hl.int< const >, const >> | ||
// CHECK: hl.var @icpc, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >, const >> | ||
int const * const icpc = 0; | ||
|
||
// CHECK: hl.var @cipc : !hl.lvalue<!hl.ptr<!hl.int< const >, const >> | ||
// CHECK: hl.var @cipc, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >, const >> | ||
const int * const cipc = 0; | ||
|
||
// CHECK: hl.var @ipp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int>>> | ||
// CHECK: hl.var @ipp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int>>> | ||
int ** ipp = 0; | ||
|
||
// CHECK: hl.var @ippc : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int>, const >> | ||
// CHECK: hl.var @ippc, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int>, const >> | ||
int ** const ippc = 0; | ||
|
||
// CHECK: hl.var @ipcp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
// CHECK: hl.var @ipcp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
int * const * ipcp = 0; | ||
|
||
// CHECK: hl.var @icpp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int< const >>>> | ||
// CHECK: hl.var @icpp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int< const >>>> | ||
int const ** icpp = 0; | ||
|
||
// CHECK: hl.var @ipcpc : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >, const >> | ||
// CHECK: hl.var @ipcpc, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >, const >> | ||
int * const * const ipcpc = 0; | ||
|
||
// CHECK: hl.var @ippp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.ptr<!hl.int>>>> | ||
// CHECK: hl.var @ippp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.ptr<!hl.int>>>> | ||
int *** ippp = 0; | ||
|
||
// CHECK: hl.var @uip : !hl.lvalue<!hl.ptr<!hl.int< unsigned >>> | ||
// CHECK: hl.var @uip, <external> : !hl.lvalue<!hl.ptr<!hl.int< unsigned >>> | ||
unsigned int *uip = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,33 @@ | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o - | %file-check %s | ||
// RUN: %vast-cc1 -vast-emit-mlir=hl %s -o %t && %vast-opt %t | diff -B %t - | ||
|
||
// CHECK: hl.var @p : !hl.lvalue<!hl.ptr<!hl.float>> | ||
// CHECK: hl.var @pp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.float>>> | ||
// CHECK: hl.var @p, <common> : !hl.lvalue<!hl.ptr<!hl.float>> | ||
// CHECK: hl.var @pp, <common> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.float>>> | ||
float *p, **pp; // p is a pointer to float | ||
// pp is a pointer to a pointer to float | ||
|
||
// CHECK: hl.var @fp : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>> | ||
// CHECK: hl.var @fp, <common> : !hl.lvalue<!hl.ptr<!hl.paren<!core.fn<(!hl.lvalue<!hl.int>) -> (!hl.int)>>>> | ||
int (*fp)(int); // fp is a pointer to function with type int(int) | ||
|
||
// CHECK: hl.var @pc : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
// CHECK: hl.var @pc, <external> : !hl.lvalue<!hl.ptr<!hl.int< const >>> | ||
int n; | ||
const int * pc = &n; // pc is a non-const pointer to a const int | ||
|
||
// CHECK: hl.var @cp : !hl.lvalue<!hl.ptr<!hl.int, const >> | ||
// CHECK: hl.var @cp, <external> : !hl.lvalue<!hl.ptr<!hl.int, const >> | ||
int * const cp = &n; // cp is a const pointer to a non-const int | ||
|
||
// CHECK: hl.var @pcp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
// CHECK: hl.var @pcp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
int * const * pcp = &cp; // non-const pointer to const pointer to non-const int | ||
|
||
// CHECK: hl.var @np : !hl.lvalue<!hl.ptr<!hl.int>> | ||
// CHECK: hl.var @np, <external> : !hl.lvalue<!hl.ptr<!hl.int>> | ||
int *np = &n; // pointer to int | ||
// CHECK: hl.var @npp : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
// CHECK: hl.var @npp, <external> : !hl.lvalue<!hl.ptr<!hl.ptr<!hl.int, const >>> | ||
int *const *npp = &np; // non-const pointer to const pointer to non-const int | ||
|
||
int a[2]; | ||
// CHECK: hl.var @ap : !hl.lvalue<!hl.ptr<!hl.paren<!hl.array<2, !hl.int>>>> | ||
// CHECK: hl.var @ap, <external> : !hl.lvalue<!hl.ptr<!hl.paren<!hl.array<2, !hl.int>>>> | ||
int (*ap)[2] = &a; // pointer to array of int | ||
|
||
struct S { int n; } s = {1}; | ||
// CHECK: hl.var @sp : !hl.lvalue<!hl.ptr<!hl.int>> | ||
// CHECK: hl.var @sp, <external> : !hl.lvalue<!hl.ptr<!hl.int>> | ||
int* sp = &s.n; // pointer to the int that is a member of s |
Oops, something went wrong.