From 90f83fd516f625f21533c7c8d775bf630bbacdb5 Mon Sep 17 00:00:00 2001 From: Bernhard Schommer Date: Fri, 20 Apr 2018 18:02:34 +0200 Subject: Better check for incomplete types in pointer subtraction (#92) In the case of pointer subtraction both side can be pointers, for example if the difference between two array cells is calculated, so we need to check that both sides have complete types. Bug 23312 --- cparser/Elab.ml | 1 + 1 file changed, 1 insertion(+) (limited to 'cparser') diff --git a/cparser/Elab.ml b/cparser/Elab.ml index 074779ca..f203c777 100644 --- a/cparser/Elab.ml +++ b/cparser/Elab.ml @@ -1854,6 +1854,7 @@ let elab_expr vararg loc env a = err "%a and %a are not pointers to compatible types" (print_typ env) b1.etyp (print_typ env) b1.etyp; check_ptr_arith env ty1 '-'; + check_ptr_arith env ty2 '-'; if wrap sizeof loc env ty1 = Some 0 then err "subtraction between two pointers to zero-sized objects"; (TPtr(ty1, []), TInt(ptrdiff_t_ikind(), [])) -- cgit