aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
-rw-r--r--evaluate.c2
-rw-r--r--validation/inline-early/unreplaced-abstract.c28
-rw-r--r--validation/optim/devirtualize0.c17
3 files changed, 46 insertions, 1 deletions
diff --git a/evaluate.c b/evaluate.c
index 61f59ee3..fe716f63 100644
--- a/evaluate.c
+++ b/evaluate.c
@@ -3555,7 +3555,7 @@ static struct symbol *evaluate_symbol(struct symbol *sym)
current_fn = sym;
examine_fn_arguments(base_type);
- if (!base_type->stmt && base_type->inline_stmt)
+ if (!base_type->stmt && base_type->inline_stmt && sym->definition)
uninline(sym);
if (base_type->stmt)
evaluate_statement(base_type->stmt);
diff --git a/validation/inline-early/unreplaced-abstract.c b/validation/inline-early/unreplaced-abstract.c
new file mode 100644
index 00000000..e38cd668
--- /dev/null
+++ b/validation/inline-early/unreplaced-abstract.c
@@ -0,0 +1,28 @@
+static inline void f0(void) { }
+static inline long f1(long a) { return a + 1;}
+
+_Static_assert([typeof(f0)] != [typeof(f1)]);
+
+
+static inline void g0(void) { }
+static inline long g1(long a) { return a + 1;}
+
+extern long goo(long a);
+long goo(long a)
+{
+ g0();
+ return g1(a);
+}
+
+_Static_assert([typeof(g0)] != [typeof(g1)]);
+
+extern long moo(long a);
+long moo(long a)
+{
+ typeof(f1) *f = g1;
+ return f(a);
+}
+
+/*
+ * check-name: unreplaced-abstract
+ */
diff --git a/validation/optim/devirtualize0.c b/validation/optim/devirtualize0.c
new file mode 100644
index 00000000..7079e790
--- /dev/null
+++ b/validation/optim/devirtualize0.c
@@ -0,0 +1,17 @@
+static inline long f1(long x) { return x + 1;}
+
+extern long foo(long a);
+long foo(long a)
+{
+ typeof(f1) *f = f1;
+ return f(a);
+}
+
+/*
+ * check-name: devirtualize0
+ * check-command: test-linearize -Wno-decl $file
+ * check-known-to-fail
+ *
+ * check-output-ignore
+ * check-output-excludes: call\\.
+ */