Skip to content

Commit e501317

Browse files
committed
Additional regression tests for always_inline
The previous attempt of implementing support for always_inline broke each of those in different ways.
1 parent 17a50c5 commit e501317

File tree

22 files changed

+270
-0
lines changed

22 files changed

+270
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
static inline __attribute__((__always_inline__)) int func(int val)
2+
{
3+
return val;
4+
}
5+
6+
static inline int func2(int *p)
7+
{
8+
// the typecast, although redundant, is essential to show the problem
9+
return func(*(int*)p);
10+
}
11+
12+
int main()
13+
{
14+
int x;
15+
return func2(&x);
16+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE gcc-only
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
static inline __attribute__((__always_inline__)) int func(int val)
2+
{
3+
if(val > 0)
4+
return func(val - 1);
5+
return 0;
6+
}
7+
8+
int main()
9+
{
10+
int x;
11+
return func(x);
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE gcc-only
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
extern int func_alias(int val) __asm__("" "func");
2+
3+
static inline __attribute__((__always_inline__)) int func(int val)
4+
{
5+
if(val > 0)
6+
return func_alias(val - 1);
7+
return 0;
8+
}
9+
10+
int main()
11+
{
12+
int x;
13+
return func(x);
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE gcc-only
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
static inline
2+
__attribute__((__section__(".init"))) __attribute__((__always_inline__))
3+
int func(int val)
4+
{
5+
return val + 1;
6+
}
7+
8+
int main()
9+
{
10+
int x;
11+
return func(x);
12+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE gcc-only
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
static inline __attribute__((__always_inline__)) int func(int val, ...)
2+
{
3+
return val + 1;
4+
}
5+
6+
int main()
7+
{
8+
int x;
9+
return func(x, x);
10+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE gcc-only
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

0 commit comments

Comments
 (0)