From aa5ecf658ce392689d5501c3fff2c572fbab08d3 Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Tue, 1 Sep 2020 11:29:23 +0200
Subject: [PATCH] [Kernel] improve error message for sizeof on incomplete types

---
 src/kernel_internals/typing/cabs2cil.ml               | 3 ++-
 tests/syntax/oracle/sizeof_incomplete_type.res.oracle | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/kernel_internals/typing/cabs2cil.ml b/src/kernel_internals/typing/cabs2cil.ml
index d797b501c14..209aed920b7 100644
--- a/src/kernel_internals/typing/cabs2cil.ml
+++ b/src/kernel_internals/typing/cabs2cil.ml
@@ -5995,7 +5995,8 @@ and doExp local_env
       let res =
         if Cil.isCompleteType typ then new_exp ~loc (SizeOf typ)
         else begin
-          Kernel.error ~once:true ~current:true "sizeof on incomplete type";
+          Kernel.error ~once:true ~current:true
+            "sizeof on incomplete type '%a'" Cil_printer.pp_typ typ;
           new_exp ~loc (Const (CStr ("booo sizeof(incomplete)")))
         end
       in
diff --git a/tests/syntax/oracle/sizeof_incomplete_type.res.oracle b/tests/syntax/oracle/sizeof_incomplete_type.res.oracle
index 861a044c355..37dab603578 100644
--- a/tests/syntax/oracle/sizeof_incomplete_type.res.oracle
+++ b/tests/syntax/oracle/sizeof_incomplete_type.res.oracle
@@ -1,6 +1,6 @@
 [kernel] Parsing tests/syntax/sizeof_incomplete_type.c (with preprocessing)
 [kernel] tests/syntax/sizeof_incomplete_type.c:21: User Error: 
-  sizeof on incomplete type
+  sizeof on incomplete type 'struct inexistent'
 [kernel] User Error: stopping on file "tests/syntax/sizeof_incomplete_type.c" that has errors. Add
   '-kernel-msg-key pp' for preprocessing command.
 [kernel] Frama-C aborted: invalid user input.
-- 
GitLab