impala-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jim Apple (Code Review)" <>
Subject [Impala-ASF-CR] IMPALA-5031: Remove undefined behavior "reference binding to null"
Date Sat, 27 May 2017 06:51:20 GMT
Jim Apple has uploaded a new change for review.

Change subject: IMPALA-5031: Remove undefined behavior "reference binding to null"

IMPALA-5031: Remove undefined behavior "reference binding to null"

When p has type T* and p is nullptr, then T x = p[0] has undefined
behavior (obviously). Less obviously, T& x = p[0] also has undefined
behavior -- references cannot be null. That undefined behavior can be
caused by expressions like &v[0] when v is a vector of size 0. The
issue is that the expression is parsed as &(v[0]), aka
&(v.operator[](0)). The return type of the operator[] method is T&,
and when v is empty the return value is a null reference.

This patch was created by running the following command, then fixing
the resulting compile errors:

    find be/src -type f -execdir \
      sed -i 's/&\([A-Za-z0-9]\+\)\[0\]/\' \{\} \;

Change-Id: Ifef5c3de686318bff4eac7dfad6e1639ddadb8f2
M be/src/exec/
M be/src/exec/parquet-column-stats.inline.h
M be/src/exprs/
M be/src/exprs/
M be/src/rpc/
M be/src/runtime/bufferpool/
M be/src/runtime/
M be/src/runtime/
M be/src/udf/udf-test-harness.h
M be/src/util/
M be/src/util/
M be/src/util/streaming-sampler.h
M be/src/util/uid-util.h
M be/src/util/
14 files changed, 39 insertions(+), 39 deletions(-)

  git pull ssh:// refs/changes/08/7008/1
To view, visit
To unsubscribe, visit

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifef5c3de686318bff4eac7dfad6e1639ddadb8f2
Gerrit-PatchSet: 1
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-Owner: Jim Apple <>

View raw message