[LLVMbugs] [Bug 14284] New: Returning NULL from void-returning function crashes fixit in getScalarZeroExpressionForType()
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Wed Nov 7 13:30:09 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=14284
Bug #: 14284
Summary: Returning NULL from void-returning function crashes
fixit in getScalarZeroExpressionForType()
Product: clang
Version: trunk
Platform: Macintosh
OS/Version: All
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: avi at drissman.com
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
clang version 3.2 (trunk 167488)
Target: i386-apple-darwin12.2.0
Thread model: posix
I altered a base class function TabStripModelDelegate::AddBlankTabAt to return
void, and altered the overriding class's function declaration to return void.
In the definition I forgot to remove the "return null". Clang crashed.
I'm attaching the pre-processed source and run script as instructed.
---8<---
box-o-bits:src$ ninja -C out/Debug all
ninja: Entering directory `out/Debug'
[152/17/116] CXX obj/chrome/browser/ui..._tests.test_tab_strip_model_delegate.o
FAILED: ../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF
obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o.d
-DCHROMIUM_BUILD -DUSE_LIBJPEG_TURBO=1 -DENABLE_ONE_CLICK_SIGNIN
-DENABLE_REMOTING=1 -DENABLE_WEBRTC=1 -DENABLE_CONFIGURATION_POLICY
-DENABLE_INPUT_SPEECH -DENABLE_NOTIFICATIONS -DENABLE_HIDPI=1 -DENABLE_GPU=1
-DENABLE_EGLIMAGE=1 -DUSE_SKIA=1 -DENABLE_TASK_MANAGER=1 -DENABLE_WEB_INTENTS=1
-DENABLE_EXTENSIONS=1 -DENABLE_PLUGIN_INSTALLATION=1
-DENABLE_PROTECTOR_SERVICE=1 -DENABLE_SESSION_SERVICE=1 -DENABLE_THEMES=1
-DENABLE_BACKGROUND=1 -DENABLE_AUTOMATION=1 -DENABLE_LANGUAGE_DETECTION=1
-DENABLE_PRINTING=1 -DENABLE_CAPTIVE_PORTAL_DETECTION=1 -DCLD_WINDOWS
-DENABLE_SAFE_BROWSING -DUSE_OFFICIAL_GOOGLE_API_KEYS=1
-DGOOGLE_PROTOBUF_NO_RTTI -DGOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
-DNACL_WINDOWS=0 -DNACL_LINUX=0 -DNACL_OSX=1 -DNACL_TARGET_SUBARCH=32
-DNACL_TARGET_ARCH=x86 -DNACL_BUILD_SUBARCH=32 -DNACL_BUILD_ARCH=x86
-DUNIT_TEST -DGTEST_HAS_RTTI=0 -DSK_BUILD_NO_IMAGE_ENCODE
-DSK_DEFERRED_CANVAS_USES_GPIPE=1
'-DGR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h"'
-DGR_AGGRESSIVE_SHADER_OPTS=1 -DSK_USE_POSIX_THREADS -DCOMPILER_GCC
-DU_USING_ICU_NAMESPACE=0 -DU_STATIC_IMPLEMENTATION -DFEATURE_ENABLE_SSL
-DFEATURE_ENABLE_VOICEMAIL -DEXPAT_RELATIVE_PATH -DGTEST_RELATIVE_PATH
-DJSONCPP_RELATIVE_PATH -DNO_MAIN_THREAD_WRAPPING -DNO_SOUND_SYSTEM -DOSX
-DPOSIX -DXML_STATIC -DLIBXML_STATIC -D__STDC_FORMAT_MACROS
-DDYNAMIC_ANNOTATIONS_ENABLED=1 -DWTF_USE_DYNAMIC_ANNOTATIONS=1 -D_DEBUG
-I../../third_party/icu/public/common -I../../third_party/icu/public/i18n
-I../.. -I../../third_party/GTM -I../../third_party/GTM/AppKit
-I../../third_party/khronos -Igen/protoc_out -I../../third_party/protobuf
-I../../third_party/protobuf/src -I../../testing/gmock/include
-I../../testing/gtest/include -Igen/policy
-I../../third_party/cacheinvalidation/google/cacheinvalidation
-I../../skia/config -I../../third_party/skia/src/core
-I../../third_party/skia/include/config -I../../third_party/skia/include/core
-I../../third_party/skia/include/effects -I../../third_party/skia/include/pdf
-I../../third_party/skia/include/gpu -I../../third_party/skia/include/gpu/gl
-I../../third_party/skia/include/pipe -I../../third_party/skia/include/ports
-I../../third_party/skia/include/utils -I../../skia/ext
-I../../third_party/skia/include/utils/mac -I../../third_party/bzip2
-I../../third_party/cacheinvalidation/overrides
-I../../third_party/cacheinvalidation/src -I../../third_party/cld
-I../../third_party/leveldatabase/src/include
-I../../third_party/leveldatabase/src -I../../third_party/libjingle/overrides
-I../../third_party/libjingle/source -I../../third_party
-I../../third_party/webrtc -I../../third_party/expat/files/lib
-I../../third_party/jsoncpp/overrides/include
-I../../third_party/jsoncpp/source/include
-I../../third_party/libxml/mac/include -I../../third_party/libxml/src/include
-Igen -I../../third_party/mesa/MesaLib/include -Igen/ui/gl
-Igen/ui/ui_resources -I../../v8/include -Igen/chrome
-I../../third_party/ocmock -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-O0 -gdwarf-2 -fvisibility=hidden -Werror -Wnewline-eof
-mmacosx-version-min=10.6 -arch i386 -Wall -Wendif-labels -Wextra
-Wno-unused-parameter -Wno-missing-field-initializers -Wheader-hygiene
-Wno-char-subscripts -Wno-unused-function -Wno-unnamed-type-template-args
-Wno-c++11-extensions -Wno-covered-switch-default -fno-rtti -fno-exceptions
-fvisibility-inlines-hidden -fno-threadsafe-statics -Xclang -load -Xclang
/Users/avi/Source/chrome-git/src/tools/clang/scripts/../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib
-Xclang -add-plugin -Xclang find-bad-constructs -Xclang
-plugin-arg-find-bad-constructs -Xclang skip-virtuals-in-implementations
-fcolor-diagnostics -fno-strict-aliasing -fstack-protector-all -c
../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc -o
obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o
../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc:21:3: error: void
function 'AddBlankTabAt' should not return a value [-Wreturn-type]
return NULL;
^ ~~~~
Assertion failed: (T.isScalarType() && "use scalar types only"), function
getScalarZeroExpressionForType, file
/Volumes/MacintoshHD2/src/chrome-git/src/third_party/llvm/tools/clang/lib/Sema/SemaFixItUtils.cpp,
line 168.
0 clang 0x00000001016d4b45 PrintStackTrace(void*) + 37
1 clang 0x00000001016d4f54 SignalHandler(int) + 564
2 libsystem_c.dylib 0x00007fff871778ea _sigtramp + 26
3 clang 0x0000000101d62728 llvm::errs()::S + 0
4 clang 0x000000010004faf6 abort + 22
5 clang 0x000000010004fad1 __assert_rtn + 81
6 clang 0x0000000100533ef5
getScalarZeroExpressionForType(clang::Type const&, clang::Sema const&) + 597
7 clang 0x00000001005340c4
clang::Sema::getFixItZeroLiteralForType(clang::QualType) const + 36
8 clang 0x00000001003d1445 (anonymous
namespace)::CheckImplicitConversion(clang::Sema&, clang::Expr*,
clang::QualType, clang::SourceLocation, bool*) + 2309
9 clang 0x00000001003cc24f (anonymous
namespace)::AnalyzeImplicitConversions(clang::Sema&, clang::Expr*,
clang::SourceLocation) + 703
10 clang 0x00000001005a9f8c
clang::Sema::ActOnReturnStmt(clang::SourceLocation, clang::Expr*) + 1884
11 clang 0x000000010035ca59 clang::Parser::ParseReturnStatement() +
505
12 clang 0x0000000100357ea6
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*, clang::Parser::ParsedAttributesWithRange&)
+ 2838
13 clang 0x00000001003572fa
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, bool, clang::SourceLocation*) + 154
14 clang 0x000000010035e7ac
clang::Parser::ParseCompoundStatementBody(bool) + 1628
15 clang 0x000000010036055b
clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) + 171
16 clang 0x000000010036ff20
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*) +
2064
17 clang 0x000000010030e0bc
clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, bool,
clang::SourceLocation*, clang::Parser::ForRangeInit*) + 1388
18 clang 0x000000010036f5b6
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier) + 678
19 clang 0x000000010036f011
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) + 353
20 clang 0x000000010036e553
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) + 2835
21 clang 0x000000010036d9c4
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 308
22 clang 0x0000000100300e86 clang::ParseAST(clang::Sema&, bool,
bool) + 438
23 clang 0x00000001002c29ea clang::CodeGenAction::ExecuteAction() +
458
24 clang 0x00000001000b2938 clang::FrontendAction::Execute() + 104
25 clang 0x000000010009446d
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 941
26 clang 0x000000010005a61a
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 3450
27 clang 0x0000000100052c48 cc1_main(char const**, char const**,
char const*, void*) + 840
28 clang 0x0000000100056e75 main + 3077
29 clang 0x00000001000528d4 start + 52
Stack dump:
0. Program arguments:
/Users/avi/Source/chrome-git/src/third_party/llvm-build/Release+Asserts/bin/clang
-cc1 -triple i386-apple-macosx10.6.0 -emit-obj -mrelax-all -disable-free
-main-file-name test_tab_strip_model_delegate.cc -pic-level 2 -mdisable-fp-elim
-relaxed-aliasing -masm-verbose -target-cpu yonah -target-linker-version 97.17
-g -coverage-file
/Users/avi/Source/chrome-git/src/out/Debug/obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o
-resource-dir
/Users/avi/Source/chrome-git/src/third_party/llvm-build/Release+Asserts/bin/../lib/clang/3.2
-dependency-file
obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o.d -MT
obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o -isysroot
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
-D CHROMIUM_BUILD -D USE_LIBJPEG_TURBO=1 -D ENABLE_ONE_CLICK_SIGNIN -D
ENABLE_REMOTING=1 -D ENABLE_WEBRTC=1 -D ENABLE_CONFIGURATION_POLICY -D
ENABLE_INPUT_SPEECH -D ENABLE_NOTIFICATIONS -D ENABLE_HIDPI=1 -D ENABLE_GPU=1
-D ENABLE_EGLIMAGE=1 -D USE_SKIA=1 -D ENABLE_TASK_MANAGER=1 -D
ENABLE_WEB_INTENTS=1 -D ENABLE_EXTENSIONS=1 -D ENABLE_PLUGIN_INSTALLATION=1 -D
ENABLE_PROTECTOR_SERVICE=1 -D ENABLE_SESSION_SERVICE=1 -D ENABLE_THEMES=1 -D
ENABLE_BACKGROUND=1 -D ENABLE_AUTOMATION=1 -D ENABLE_LANGUAGE_DETECTION=1 -D
ENABLE_PRINTING=1 -D ENABLE_CAPTIVE_PORTAL_DETECTION=1 -D CLD_WINDOWS -D
ENABLE_SAFE_BROWSING -D USE_OFFICIAL_GOOGLE_API_KEYS=1 -D
GOOGLE_PROTOBUF_NO_RTTI -D GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER -D
NACL_WINDOWS=0 -D NACL_LINUX=0 -D NACL_OSX=1 -D NACL_TARGET_SUBARCH=32 -D
NACL_TARGET_ARCH=x86 -D NACL_BUILD_SUBARCH=32 -D NACL_BUILD_ARCH=x86 -D
UNIT_TEST -D GTEST_HAS_RTTI=0 -D SK_BUILD_NO_IMAGE_ENCODE -D
SK_DEFERRED_CANVAS_USES_GPIPE=1 -D
GR_GL_CUSTOM_SETUP_HEADER="GrGLConfig_chrome.h" -D GR_AGGRESSIVE_SHADER_OPTS=1
-D SK_USE_POSIX_THREADS -D COMPILER_GCC -D U_USING_ICU_NAMESPACE=0 -D
U_STATIC_IMPLEMENTATION -D FEATURE_ENABLE_SSL -D FEATURE_ENABLE_VOICEMAIL -D
EXPAT_RELATIVE_PATH -D GTEST_RELATIVE_PATH -D JSONCPP_RELATIVE_PATH -D
NO_MAIN_THREAD_WRAPPING -D NO_SOUND_SYSTEM -D OSX -D POSIX -D XML_STATIC -D
LIBXML_STATIC -D __STDC_FORMAT_MACROS -D DYNAMIC_ANNOTATIONS_ENABLED=1 -D
WTF_USE_DYNAMIC_ANNOTATIONS=1 -D _DEBUG -I ../../third_party/icu/public/common
-I ../../third_party/icu/public/i18n -I ../.. -I ../../third_party/GTM -I
../../third_party/GTM/AppKit -I ../../third_party/khronos -I gen/protoc_out -I
../../third_party/protobuf -I ../../third_party/protobuf/src -I
../../testing/gmock/include -I ../../testing/gtest/include -I gen/policy -I
../../third_party/cacheinvalidation/google/cacheinvalidation -I
../../skia/config -I ../../third_party/skia/src/core -I
../../third_party/skia/include/config -I ../../third_party/skia/include/core -I
../../third_party/skia/include/effects -I ../../third_party/skia/include/pdf -I
../../third_party/skia/include/gpu -I ../../third_party/skia/include/gpu/gl -I
../../third_party/skia/include/pipe -I ../../third_party/skia/include/ports -I
../../third_party/skia/include/utils -I ../../skia/ext -I
../../third_party/skia/include/utils/mac -I ../../third_party/bzip2 -I
../../third_party/cacheinvalidation/overrides -I
../../third_party/cacheinvalidation/src -I ../../third_party/cld -I
../../third_party/leveldatabase/src/include -I
../../third_party/leveldatabase/src -I ../../third_party/libjingle/overrides -I
../../third_party/libjingle/source -I ../../third_party -I
../../third_party/webrtc -I ../../third_party/expat/files/lib -I
../../third_party/jsoncpp/overrides/include -I
../../third_party/jsoncpp/source/include -I
../../third_party/libxml/mac/include -I ../../third_party/libxml/src/include -I
gen -I ../../third_party/mesa/MesaLib/include -I gen/ui/gl -I
gen/ui/ui_resources -I ../../v8/include -I gen/chrome -I
../../third_party/ocmock -fmodule-cache-path
/var/folders/zt/1mcf1bjn2mddfxl1r3gx9hr8000mw2/T/clang-module-cache -O0 -Werror
-Wnewline-eof -Wall -Wendif-labels -Wextra -Wno-unused-parameter
-Wno-missing-field-initializers -Wheader-hygiene -Wno-char-subscripts
-Wno-unused-function -Wno-unnamed-type-template-args -Wno-c++11-extensions
-Wno-covered-switch-default -fdeprecated-macro -fdebug-compilation-dir
/Users/avi/Source/chrome-git/src/out/Debug -ferror-limit 19 -fmessage-length 0
-fvisibility hidden -fvisibility-inlines-hidden -stack-protector 2
-mstackrealign -fblocks -fno-rtti -fno-threadsafe-statics
-fobjc-runtime=macosx-fragile-10.6.0 -fobjc-default-synthesize-properties
-fdiagnostics-show-option -fcolor-diagnostics -load
/Users/avi/Source/chrome-git/src/tools/clang/scripts/../../../third_party/llvm-build/Release+Asserts/lib/libFindBadConstructs.dylib
-add-plugin find-bad-constructs -plugin-arg-find-bad-constructs
skip-virtuals-in-implementations -o
obj/chrome/browser/ui/tabs/unit_tests.test_tab_strip_model_delegate.o -x c++
../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc
1. ../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc:21:14:
current parser token ';'
2. ../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc:20:75:
parsing function body 'AddBlankTabAt'
3. ../../chrome/browser/ui/tabs/test_tab_strip_model_delegate.cc:20:75: in
compound statement ('{}')
clang: error: unable to execute command: Illegal instruction: 4
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (trunk 167488)
Target: i386-apple-darwin12.2.0
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list