From eba3d577fc9bf2575cf9c44098d780b203bcb031 Mon Sep 17 00:00:00 2001
From: Virgile Prevosto <virgile.prevosto@m4x.org>
Date: Wed, 22 Feb 2023 16:19:16 +0100
Subject: [PATCH] [typing] wide string literal are constant as well as normal
 strings

---
 src/kernel_services/ast_queries/cil.ml | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/kernel_services/ast_queries/cil.ml b/src/kernel_services/ast_queries/cil.ml
index f7e3543d622..a65d727bb6b 100644
--- a/src/kernel_services/ast_queries/cil.ml
+++ b/src/kernel_services/ast_queries/cil.ml
@@ -122,7 +122,7 @@ let createMachine () = (* Contain dummy values *)
     theMachine = Machdeps.x86_64;
     lowerConstants = false(*true*);
     insertImplicitCasts = true;
-    stringLiteralType = charPtrType;
+    stringLiteralType = charConstPtrType;
     upointKind = IChar;
     upointType = voidType;
     wcharKind = IChar;
@@ -3686,7 +3686,9 @@ let rec typeOf (e: exp) : typ =
    * have SizeOfStr for that *)
   | Const(CStr _s) -> theMachine.stringLiteralType
 
-  | Const(CWStr _s) -> TPtr(theMachine.wcharType,[])
+  | Const(CWStr _s) ->
+    let typ = typeAddAttributes [Attr("const",[])] theMachine.wcharType in
+    TPtr(typ,[])
 
   | Const(CReal (_, fk, _)) -> TFloat(fk, [])
 
-- 
GitLab