[PATCH] D48958: [clang][ubsan] Implicit Cast Sanitizer - integer truncation - clang part
Roman Lebedev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 13 05:42:41 PDT 2018
lebedev.ri marked 5 inline comments as done.
lebedev.ri added a comment.
@vsk so yeah, no wonder that doesn't work.
Somehow in that test case `ScalarExprEmitter::VisitExplicitCastExpr()` **never** gets called.
(I'm pretty sure this worked with the naive implementation, so worst case i'll just revert the 'stack' code)
Trying to assess the issue..
================
Comment at: lib/CodeGen/CGExprScalar.cpp:351
+ ScalarConversionOpts()
+ : TreatBooleanAsSigned(false),
+ EmitImplicitIntegerTruncationChecks(false) {}
----------------
lebedev.ri wrote:
> vsk wrote:
> > Why not use default member initializers here (e.g, "bool a = false")?
> I'll double-check, but i'm pretty sure then there were some warnings when i did that,
> Or, the default needs to be defined in the actual declaration of `EmitScalarConversion()`, i think.
```
[2/14 0.3/sec] Building CXX object tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExprScalar.cpp.o
FAILED: tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExprScalar.cpp.o
/usr/bin/clang++-6.0 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Itools/clang/lib/CodeGen -I/build/clang/lib/CodeGen -I/build/clang/include -Itools/clang/include -I/usr/include/libxml2 -Iinclude -I/build/llvm/include -g0 -fPIC -fvisibility-inlines-hidden -Werror -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -ffunction-sections -fdata-sections -fno-common -Woverloaded-virtual -Wno-nested-anon-types -O3 -g0 -fPIC -UNDEBUG -fno-exceptions -fno-rtti -MD -MT tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExprScalar.cpp.o -MF tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExprScalar.cpp.o.d -o tools/clang/lib/CodeGen/CMakeFiles/clangCodeGen.dir/CGExprScalar.cpp.o -c /build/clang/lib/CodeGen/CGExprScalar.cpp
/build/clang/lib/CodeGen/CGExprScalar.cpp:355:52: error: default member initializer for 'TreatBooleanAsSigned' needed within definition of enclosing class 'ScalarExprEmitter' outside of member functions
ScalarConversionOpts Opts = ScalarConversionOpts());
^
/build/clang/lib/CodeGen/CGExprScalar.cpp:349:10: note: default member initializer declared here
bool TreatBooleanAsSigned = false;
^
/build/clang/lib/CodeGen/CGExprScalar.cpp:355:52: error: default member initializer for 'EmitImplicitIntegerTruncationChecks' needed within definition of enclosing class 'ScalarExprEmitter' outside of member functions
ScalarConversionOpts Opts = ScalarConversionOpts());
^
/build/clang/lib/CodeGen/CGExprScalar.cpp:350:10: note: default member initializer declared here
bool EmitImplicitIntegerTruncationChecks = false;
^
2 errors generated.
```
Repository:
rC Clang
https://reviews.llvm.org/D48958
More information about the cfe-commits
mailing list