diff --git a/src/abg-ir.cc b/src/abg-ir.cc
index 2483c6ce..a12a6955 100644
--- a/src/abg-ir.cc
+++ b/src/abg-ir.cc
@@ -16880,9 +16880,10 @@ array_type_def::get_qualified_name(bool internal) const
 	}
       else
 	{
-	  set_qualified_name(env->intern(get_type_representation
-					 (*this, /*internal=*/false)));
-	  return decl_base::peek_qualified_name();
+	  set_temporary_qualified_name(env->intern(get_type_representation
+						   (*this,
+						    /*internal=*/false)));
+	  return decl_base::peek_temporary_qualified_name();
 	}
     }
 }
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index 11c67899..38c919ca 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -91,6 +91,13 @@ test-abidiff/test-crc-0.xml \
 test-abidiff/test-crc-1.xml \
 test-abidiff/test-crc-2.xml \
 test-abidiff/test-crc-report.txt \
+test-abidiff/test-PR27985-report.txt	 \
+test-abidiff/test-PR27985-v0.c		 \
+test-abidiff/test-PR27985-v0.o		 \
+test-abidiff/test-PR27985-v0.o.abi	 \
+test-abidiff/test-PR27985-v1.c		 \
+test-abidiff/test-PR27985-v1.o		 \
+test-abidiff/test-PR27985-v1.o.abi	 \
 \
 test-abidiff-exit/test1-voffset-change-report0.txt \
 test-abidiff-exit/test1-voffset-change-report1.txt \
diff --git a/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt b/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt
index 8105aa7f..e9bf3d46 100644
--- a/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt
+++ b/tests/data/test-abidiff-exit/qualifier-typedef-array-report-1.txt
@@ -13,12 +13,14 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
               array element type 'void*' changed:
                 entity changed from 'void*' to 'void* const'
                 type size hasn't changed
+              type name changed from 'void*[7]' to 'void* const[7]'
               type size hasn't changed
           type of 'A v_a' changed:
             entity changed from 'typedef A' to compatible type 'void* volatile[7]'
               array element type 'void*' changed:
                 entity changed from 'void*' to 'void* volatile'
                 type size hasn't changed
+              type name changed from 'void*[7]' to 'void* volatile[7]'
               type size hasn't changed
           type of 'A r_a' changed:
             entity changed from 'typedef A' to compatible type 'void*[7]'
@@ -29,6 +31,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
                 array element type 'void*' changed:
                   entity changed from 'void*' to 'void* const'
                   type size hasn't changed
+                type name changed from 'void*[7]' to 'void* const[7]'
                 type size hasn't changed
           type of 'B v_b' changed:
             typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
@@ -37,6 +40,7 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
                 array element type 'void*' changed:
                   entity changed from 'void*' to 'void* volatile'
                   type size hasn't changed
+                type name changed from 'void*[7]' to 'void* volatile[7]'
                 type size hasn't changed
           type of 'B r_b' changed:
             typedef name changed from B to A at qualifier-typedef-array-v1.c:1:1
@@ -46,36 +50,36 @@ Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
             entity changed from 'typedef C' to compatible type 'const volatile void* const[7]'
               array element type 'void* const' changed:
                 'void* const' changed to 'const volatile void* const'
-              type name changed from 'void*[7]' to 'volatile void* const[7]'
+              type name changed from 'void* const[7]' to 'volatile void* const[7]'
               type size hasn't changed
           type of 'C r_c' changed:
             entity changed from 'typedef C' to compatible type 'restrict void* const[7]'
               array element type 'void* const' changed:
                 'void* const' changed to 'restrict const void* const'
-              type name changed from 'void*[7]' to 'restrict void* const[7]'
+              type name changed from 'void* const[7]' to 'restrict void* const[7]'
               type size hasn't changed
           type of 'D v_d' changed:
             entity changed from 'typedef D' to compatible type 'const volatile void* const[7]'
               array element type 'void* const' changed:
                 'void* const' changed to 'const volatile void* const'
-              type name changed from 'void*[7]' to 'volatile void* const[7]'
+              type name changed from 'void* const[7]' to 'volatile void* const[7]'
               type size hasn't changed
           type of 'D r_d' changed:
             entity changed from 'typedef D' to compatible type 'restrict void* const[7]'
               array element type 'void* const' changed:
                 'void* const' changed to 'restrict const void* const'
-              type name changed from 'void*[7]' to 'restrict void* const[7]'
+              type name changed from 'void* const[7]' to 'restrict void* const[7]'
               type size hasn't changed
           type of 'E r_e' changed:
             entity changed from 'typedef E' to compatible type 'restrict const volatile void* const[7]'
               array element type 'const volatile void* const' changed:
                 'const volatile void* const' changed to 'restrict const volatile volatile void* const'
-              type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+              type name changed from 'volatile void* const[7]' to 'restrict const volatile void* const[7]'
               type size hasn't changed
           type of 'F r_f' changed:
             entity changed from 'typedef F' to compatible type 'restrict const volatile void* const[7]'
               array element type 'const volatile void* const' changed:
                 'const volatile void* const' changed to 'restrict const volatile volatile void* const'
-              type name changed from 'volatile void* const[7]' to 'restrict volatile void* const[7]'
+              type name changed from 'volatile void* const[7]' to 'restrict const volatile void* const[7]'
               type size hasn't changed
 
diff --git a/tests/data/test-abidiff/test-PR27985-report.txt b/tests/data/test-abidiff/test-PR27985-report.txt
new file mode 100644
index 00000000..9e741f91
--- /dev/null
+++ b/tests/data/test-abidiff/test-PR27985-report.txt
@@ -0,0 +1,19 @@
+Functions changes summary: 0 Removed, 1 Changed, 0 Added function
+Variables changes summary: 0 Removed, 0 Changed, 0 Added variable
+
+1 function with some indirect sub-type change:
+
+  [C] 'function void foo(node*)' has some indirect sub-type changes:
+    parameter 1 of type 'node*' has sub-type changes:
+      in pointed to type 'struct node':
+        type size hasn't changed
+        1 data member change:
+          type of 'leaf* ptr' changed:
+            in pointed to type 'struct leaf':
+              type size changed from 64 to 96 (in bits)
+              1 data member change:
+                type of 'int numbers[2]' changed:
+                  type name changed from 'int[2]' to 'int[3]'
+                  array type size changed from 64 to 96
+                  array type subrange 1 changed length from 2 to 3
+
diff --git a/tests/data/test-abidiff/test-PR27985-v0.c b/tests/data/test-abidiff/test-PR27985-v0.c
new file mode 100644
index 00000000..cd0b4860
--- /dev/null
+++ b/tests/data/test-abidiff/test-PR27985-v0.c
@@ -0,0 +1,11 @@
+struct leaf
+{
+  int numbers[2];
+};
+
+struct node
+{
+  struct leaf* ptr;
+};
+
+void foo(struct node *n) { (void) n; }
diff --git a/tests/data/test-abidiff/test-PR27985-v0.o b/tests/data/test-abidiff/test-PR27985-v0.o
new file mode 100644
index 0000000000000000000000000000000000000000..fda4e9bad590603adbda8f38aae77275a227f84c
GIT binary patch
diff --git a/tests/data/test-abidiff/test-PR27985-v0.o.abi b/tests/data/test-abidiff/test-PR27985-v0.o.abi
new file mode 100644
index 00000000..7fbae4a3
--- /dev/null
+++ b/tests/data/test-abidiff/test-PR27985-v0.o.abi
@@ -0,0 +1,29 @@
+<abi-corpus version='2.0' path='test-v0.o' architecture='elf-amd-x86_64'>
+  <elf-function-symbols>
+    <elf-symbol name='foo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+  </elf-function-symbols>
+  <abi-instr address-size='64' path='test-v0.c' comp-dir-path='/home/dodji/git/libabigail/fixes/prtests/PR27985' language='LANG_C11'>
+    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='64' id='type-id-2'>
+      <subrange length='2' type-id='type-id-3' id='type-id-4'/>
+    </array-type-def>
+    <type-decl name='unsigned long int' size-in-bits='64' id='type-id-3'/>
+    <type-decl name='void' id='type-id-5'/>
+    <class-decl name='leaf' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='1' column='1' id='type-id-6'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='numbers' type-id='type-id-2' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='3' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='node' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='6' column='1' id='type-id-7'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ptr' type-id='type-id-8' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='8' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-6' size-in-bits='64' id='type-id-8'/>
+    <pointer-type-def type-id='type-id-7' size-in-bits='64' id='type-id-9'/>
+    <function-decl name='foo' mangled-name='foo' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='foo'>
+      <parameter type-id='type-id-9' name='n' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v0.c' line='11' column='1'/>
+      <return type-id='type-id-5'/>
+    </function-decl>
+  </abi-instr>
+</abi-corpus>
diff --git a/tests/data/test-abidiff/test-PR27985-v1.c b/tests/data/test-abidiff/test-PR27985-v1.c
new file mode 100644
index 00000000..b7e0076e
--- /dev/null
+++ b/tests/data/test-abidiff/test-PR27985-v1.c
@@ -0,0 +1,11 @@
+struct leaf
+{
+  int numbers[3];
+};
+
+struct node
+{
+  struct leaf* ptr;
+};
+
+void foo(struct node *n) { (void) n; }
diff --git a/tests/data/test-abidiff/test-PR27985-v1.o b/tests/data/test-abidiff/test-PR27985-v1.o
new file mode 100644
index 0000000000000000000000000000000000000000..017bd88302d1829869d1873239c6912c1de1cda2
GIT binary patch
diff --git a/tests/data/test-abidiff/test-PR27985-v1.o.abi b/tests/data/test-abidiff/test-PR27985-v1.o.abi
new file mode 100644
index 00000000..09d2f44e
--- /dev/null
+++ b/tests/data/test-abidiff/test-PR27985-v1.o.abi
@@ -0,0 +1,29 @@
+<abi-corpus version='2.0' path='test-v1.o' architecture='elf-amd-x86_64'>
+  <elf-function-symbols>
+    <elf-symbol name='foo' type='func-type' binding='global-binding' visibility='default-visibility' is-defined='yes'/>
+  </elf-function-symbols>
+  <abi-instr address-size='64' path='test-v1.c' comp-dir-path='/home/dodji/git/libabigail/fixes/prtests/PR27985' language='LANG_C11'>
+    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
+    <array-type-def dimensions='1' type-id='type-id-1' size-in-bits='96' id='type-id-2'>
+      <subrange length='3' type-id='type-id-3' id='type-id-4'/>
+    </array-type-def>
+    <type-decl name='unsigned long int' size-in-bits='64' id='type-id-3'/>
+    <type-decl name='void' id='type-id-5'/>
+    <class-decl name='leaf' size-in-bits='96' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='1' column='1' id='type-id-6'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='numbers' type-id='type-id-2' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='3' column='1'/>
+      </data-member>
+    </class-decl>
+    <class-decl name='node' size-in-bits='64' is-struct='yes' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='6' column='1' id='type-id-7'>
+      <data-member access='public' layout-offset-in-bits='0'>
+        <var-decl name='ptr' type-id='type-id-8' visibility='default' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='8' column='1'/>
+      </data-member>
+    </class-decl>
+    <pointer-type-def type-id='type-id-6' size-in-bits='64' id='type-id-8'/>
+    <pointer-type-def type-id='type-id-7' size-in-bits='64' id='type-id-9'/>
+    <function-decl name='foo' mangled-name='foo' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='11' column='1' visibility='default' binding='global' size-in-bits='64' elf-symbol-id='foo'>
+      <parameter type-id='type-id-9' name='n' filepath='/home/dodji/git/libabigail/fixes/prtests/PR27985/test-v1.c' line='11' column='1'/>
+      <return type-id='type-id-5'/>
+    </function-decl>
+  </abi-instr>
+</abi-corpus>
diff --git a/tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt b/tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt
index b09b0091..66147b88 100644
--- a/tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt
+++ b/tests/data/test-diff-pkg/nss-3.23.0-1.0.fc23.x86_64-report-0.txt
@@ -61,7 +61,7 @@
     [C] 'const PRUint16 SSL_ImplementedCiphers[74]' was changed to 'const PRUint16 SSL_ImplementedCiphers[69]' at sslenum.c:51:1:
       size of symbol changed from 148 to 138
       type of variable changed:
-        type name changed from 'PRUint16[74]' to 'const PRUint16[69]'
+        type name changed from 'const PRUint16[74]' to 'const PRUint16[69]'
         array type size changed from 1184 to 1104
         array type subrange 1 changed length from 74 to 69
 
diff --git a/tests/test-abidiff.cc b/tests/test-abidiff.cc
index 6ef18654..32858ece 100644
--- a/tests/test-abidiff.cc
+++ b/tests/test-abidiff.cc
@@ -140,6 +140,12 @@ static InOutSpec specs[] =
     "data/test-abidiff/empty-report.txt",
     "output/test-abidiff/empty-report.txt"
   },
+  {
+    "data/test-abidiff/test-PR27985-v0.o.abi",
+    "data/test-abidiff/test-PR27985-v1.o.abi",
+    "data/test-abidiff/test-PR27985-report.txt",
+    "output/test-abidiff/test-PR27985-report.txt"
+  },
   // This should be the last entry.
   {0, 0, 0, 0}
 };
