From c42fe8c105f3e0a5bc65e801383bd8d2c5619d42 Mon Sep 17 00:00:00 2001 From: Jean-Francois Dockes Date: Mon, 12 Oct 2020 20:17:49 +0200 Subject: [PATCH] Modify dubious? c++ iterator increment which was causing a crash on ARM --- src/common/rclconfig.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/common/rclconfig.cpp b/src/common/rclconfig.cpp index 1d5afba5..dbbdcb25 100644 --- a/src/common/rclconfig.cpp +++ b/src/common/rclconfig.cpp @@ -1689,13 +1689,20 @@ bool RclConfig::processFilterCmd(std::vector& cmd) const bool hasinterp = !stringlowercmp("python", *it) || !stringlowercmp("perl", *it); - *it++ = findFilter(*it); + // Note that, if the cmd vector size is 1, post-incrementing the + // iterator in the following statement, which works on x86, leads + // to a crash on ARM with gcc 6 and 8 (at least), which does not + // seem right (it should just become cmd.end() ?) but + // whatever... We do it later then. + *it = findFilter(*it); + if (hasinterp) { if (cmd.size() < 2) { LOGERR("processFilterCmd: python/perl cmd: no script?. [" << stringsToString(cmd) << "]\n"); return false; } else { + ++it; *it = findFilter(*it); } }