diff --git a/src/kernel_services/ast_queries/ast_diff.ml b/src/kernel_services/ast_queries/ast_diff.ml
index 886a44ef38eeb8469fa23b43aca546127e6a0ab3..be7053cfa7faddef913e890f762e7cf83a154ba9 100644
--- a/src/kernel_services/ast_queries/ast_diff.ml
+++ b/src/kernel_services/ast_queries/ast_diff.ml
@@ -352,12 +352,12 @@ let find_candidate_type ?loc:_loc ti =
 let find_candidate_compinfo ?loc:_loc ci =
   let su = if ci.cstruct then Logic_typing.Struct else Logic_typing.Union in
   if Globals.Types.mem_type su ci.cname then begin
-    match Globals.Types.global su ci.cname with
-    | GCompTag (ci,_) | GCompTagDecl(ci,_) -> Some ci
-    | g ->
+    match Globals.Types.find_type su ci.cname with
+    | TComp(ci', _) -> Some ci'
+    | t ->
       Kernel.fatal
-        "Expected aggregate definition instead of %a"
-        Cil_datatype.Global.pretty g
+        "Expected compinfo instead of %a"
+        Printer.pp_typ t
   end else None
 
 let find_candidate_enuminfo ?loc:_loc ei =
diff --git a/tests/syntax/ast_diff_1.i b/tests/syntax/ast_diff_1.i
index 49b8262c90e47133693f22218243f984059f41b1..80d699482c562658c4907a72cf1fa75231b51b15 100644
--- a/tests/syntax/ast_diff_1.i
+++ b/tests/syntax/ast_diff_1.i
@@ -72,3 +72,9 @@ void local_var_use(int v, int a[][v]) {
   int x;
   int y [sizeof(x)];
 }
+
+struct s;
+
+extern struct s s;
+
+struct s* use_s() { return &s; }
diff --git a/tests/syntax/ast_diff_2.i b/tests/syntax/ast_diff_2.i
index c1775d8d10f6c61c29c867e4e30c70905b9f0b0a..bd8d7e8f1f8ef79a9f1afdf589422c4952c9086d 100644
--- a/tests/syntax/ast_diff_2.i
+++ b/tests/syntax/ast_diff_2.i
@@ -67,3 +67,7 @@ void local_var_use(int w, int q[][w]) {
   int z;
   int t [sizeof(z)];
 }
+
+extern struct s s;
+
+struct s* use_s() { return &s; }
diff --git a/tests/syntax/oracle/ast_diff_1.res.oracle b/tests/syntax/oracle/ast_diff_1.res.oracle
index da62e41fd4286bacf265b9d3681d8ab57c6b1f0d..1286ff511f93304970ca6c5a858245ecc9a84d17 100644
--- a/tests/syntax/oracle/ast_diff_1.res.oracle
+++ b/tests/syntax/oracle/ast_diff_1.res.oracle
@@ -7,10 +7,13 @@
 [AST diff test] Variable a:  => q
 [AST diff test] Variable x:  => z
 [AST diff test] Variable y:  => t
+[AST diff test] Variable s:  => s
+[AST diff test] Variable use_s:  => use_s
 [AST diff test] Variable has_static_local_x:  => has_static_local_y
 [AST diff test] Variable X:  => X
 [AST diff test] Variable Y: N/A
 [AST diff test] Variable f:  => f
+[AST diff test] Variable __retres:  => __retres
 [AST diff test] Variable x:  => x
 [AST diff test] Variable g:  => g
 [AST diff test] Variable h:  => h
@@ -23,6 +26,7 @@
 [AST diff test] Variable ptr_func:  => ptr_func
 [AST diff test] Function i:  => i
 [AST diff test] Function local_var_use:  => local_var_use
+[AST diff test] Function use_s:  => use_s
 [AST diff test] Function f:  => f
 [AST diff test] Function g: N/A
 [AST diff test] Function h: -> h (body changed)