impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Apple (Code Review)" <ger...@cloudera.org>
Subject [Impala-ASF-CR] IMPALA-5031: Suppress noisy UBSAN errors.
Date Tue, 14 Mar 2017 05:36:40 GMT
Jim Apple has uploaded a new change for review.

  http://gerrit.cloudera.org:8080/6378

Change subject: IMPALA-5031: Suppress noisy UBSAN errors.
......................................................................

IMPALA-5031: Suppress noisy UBSAN errors.

The current version of the standard C++ library that Impala is often
compiled with (libstdc++ 4.9.2) contains some undefined behavior. This
patch prevents that behavior from showing up in UBSAN errors.

The behavior in question is in violation of chapter 5 ("Expressions")
paragraph 4: "If during the evaluation of an expression, the result is
not mathematically defined or not in the range of representable values
for its type, the behavior is undefined." The bitwise complement of an
enumeration value does not necessarily produce another value of the
same enumeration, so the following can exhibit undefined behavior:

    enum _Ios_Fmtflags {
      _S_boolalpha = 1L << 0,
      _S_dec = 1L << 1,
      _S_fixed = 1L << 2,
      _S_hex = 1L << 3,
      _S_internal = 1L << 4,
      _S_left = 1L << 5,
      _S_oct = 1L << 6,
      _S_right = 1L << 7,
      _S_scientific = 1L << 8,
      _S_showbase = 1L << 9,
      _S_showpoint = 1L << 10,
      _S_showpos = 1L << 11,
      _S_skipws = 1L << 12,
      _S_unitbuf = 1L << 13,
      _S_uppercase = 1L << 14,
      _S_adjustfield = _S_left | _S_right | _S_internal,
      _S_basefield = _S_dec | _S_oct | _S_hex,
      _S_floatfield = _S_scientific | _S_fixed,
      _S_ios_fmtflags_end = 1L << 16
    };

    _Ios_Fmtflags operator~(_Ios_Fmtflags __a) {
      return _Ios_Fmtflags(~static_cast<int>(__a));
    }

This patch also fixes some omissions from the last UBSAN patch and
sets the UBSAN environment variables in all the useful locations.

Change-Id: Iac7a568ccc2d90ee174ccc286c108d0b28018fbb
---
M bin/run-backend-tests.sh
M bin/start-catalogd.sh
M bin/start-impalad.sh
M bin/start-statestored.sh
A bin/ubsan-suppressions.txt
5 files changed, 34 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/78/6378/1
-- 
To view, visit http://gerrit.cloudera.org:8080/6378
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iac7a568ccc2d90ee174ccc286c108d0b28018fbb
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Jim Apple <jbapple-impala@apache.org>

Mime
View raw message