From 9effdbad2f67e2feb56db6bb649c4c904c79958d Mon Sep 17 00:00:00 2001
From: Andre Maroneze <andre.maroneze@cea.fr>
Date: Fri, 1 Oct 2021 15:29:52 +0200
Subject: [PATCH] [Cabs2cil] improve error message for __builtin_offsetof

---
 src/kernel_internals/typing/cabs2cil.ml | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/kernel_internals/typing/cabs2cil.ml b/src/kernel_internals/typing/cabs2cil.ml
index 604f00ef016..ea7fdf76bfb 100644
--- a/src/kernel_internals/typing/cabs2cil.ml
+++ b/src/kernel_internals/typing/cabs2cil.ml
@@ -7122,12 +7122,13 @@ and doExp local_env
                        Kernel.error ~current:true "Using offset of bitfield";
                      let kind = Cil.theMachine.kindOfSizeOf in
                      pres := Cil.kinteger ~loc:e.eloc kind (start / 8);
-                   with SizeOfError _ ->
+                   with SizeOfError (s, _) ->
                      pres := e;
                      Kernel.error ~once:true ~current:true
-                       "Unable to compute offset %a in type %a"
+                       "Unable to compute offset %a in type %a: %s"
                        Cil_datatype.Offset.pretty offset
-                       Cil_datatype.Typ.pretty typ;
+                       Cil_datatype.Typ.pretty typ
+                       s;
                  end
                | _ ->
                  Kernel.abort ~current:true "Invalid call to builtin_offsetof"
-- 
GitLab