aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Schmidt <github@mschmidt.me>2016-04-06 10:56:30 +0200
committerMichael Schmidt <github@mschmidt.me>2016-04-06 10:56:30 +0200
commit2ed2dceef799867bf3dcf971fdf059d2b9ee2130 (patch)
tree9b8243d07b038ac06ceb922ec5802030b2b9587b
parentce248e4da35758540e5daa678d80623daeab6453 (diff)
downloadcompcert-2ed2dceef799867bf3dcf971fdf059d2b9ee2130.tar.gz
compcert-2ed2dceef799867bf3dcf971fdf059d2b9ee2130.zip
Check for type compatibility when initializing TInt arrays with wide strings (ยง6.7.8), bug 18000
-rw-r--r--cparser/Elab.ml2
1 files changed, 1 insertions, 1 deletions
diff --git a/cparser/Elab.ml b/cparser/Elab.ml
index 426ffb24..c2c7ff23 100644
--- a/cparser/Elab.ml
+++ b/cparser/Elab.ml
@@ -1134,7 +1134,7 @@ and elab_item zi item il =
| CStr _, _ ->
error loc "initialization of an array of non-char elements with a string literal";
elab_list zi il false
- | CWStr s, TInt(ik, _) when sizeof_ikind ik = !config.sizeof_wchar ->
+ | CWStr s, TInt(_, _) when compatible_types AttrCompat env ty_elt (TInt(wchar_ikind(), [])) ->
if not (I.index_below (Int64.of_int(List.length s - 1)) sz) then
warning loc "initializer string for array of wide chars %s is too long"
(I.name zi);