From 75c3a63b59730d40659d88befa1960ff3d7abfca Mon Sep 17 00:00:00 2001 From: Ulya Trofimovich Date: Mon, 10 Aug 2015 11:41:51 +0100 Subject: [PATCH] Yet another explicit cast of pointer difference to uint32_t. This time we deal with pointers in 'Ins' array (the length of array equals the calculated size of regular expression, which is currently of type uint32_t: larger regular expressions will surely crash re2c). So we can guarantee that, if regexp was correctly compiled to instructions, than the first pointer points to some instuction in the array and second pointer points to the beginning of array, so this cast is safe. If compilation was incorrect than re2c will fail anyway. Fixes [-Wconversion] warning. --- re2c/src/ir/bytecode/bytecode.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/re2c/src/ir/bytecode/bytecode.cc b/re2c/src/ir/bytecode/bytecode.cc index 352ac0d3..afbb7668 100644 --- a/re2c/src/ir/bytecode/bytecode.cc +++ b/re2c/src/ir/bytecode/bytecode.cc @@ -46,7 +46,7 @@ smart_ptr genCode (RegExp *re, Output & output, uint32_t ind, const std::st if (ins[j].i.tag == CHAR) { - j = (Ins*) ins[j].i.link - ins; + j = static_cast ((Ins*) ins[j].i.link - ins); } else { -- 2.40.0