[cfe-commits] r145018 - in /cfe/trunk: include/clang/Driver/Compilation.h lib/Driver/Driver.cpp lib/Driver/Tools.cpp test/Driver/crash-cleanup.c test/Driver/output-file-cleanup.c

David Dean david_dean at apple.com
Sun Nov 20 22:04:35 PST 2011


Peter,
    I'm seeing a crash in one of the tests and suspect this commit:

******************** TEST 'Clang :: Driver/output-file-cleanup.c' FAILED ********************Script:
--
touch /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
not  /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang  -DCRASH -o /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o -MMD -MF /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/Driver/output-file-cleanup.c
test ! -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
test ! -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d
touch /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
not  /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang  -DMISSING -o /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o -MMD -MF /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/Driver/output-file-cleanup.c
test ! -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
test ! -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d
touch /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
not  /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang  -o /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o -MMD -MF /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/Driver/output-file-cleanup.c
test ! -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o
test -f /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d
--
Exit Code: 0
Command Output (stderr):
--
0  clang             0x0000000101bc8ca2 PrintStackTrace(void*) + 34
1  clang             0x0000000101bc9c23 SignalHandler(int) + 707
2  libSystem.B.dylib 0x00007fff804de67a _sigtramp + 26
3  libSystem.B.dylib 0x000000005fbfbb4f _sigtramp + 3748779247
4  clang             0x0000000100d22f7d clang::PragmaNamespace::HandlePragma(clang::Preprocessor&, clang::PragmaIntroducerKind, clang::Token&) + 653
5  clang             0x0000000100d22f7d clang::PragmaNamespace::HandlePragma(clang::Preprocessor&, clang::PragmaIntroducerKind, clang::Token&) + 653
6  clang             0x0000000100d1c51f clang::Preprocessor::HandlePragmaDirective(unsigned int) + 47
7  clang             0x0000000100d09814 clang::Preprocessor::HandleDirective(clang::Token&) + 2276
8  clang             0x0000000100ce8907 clang::Lexer::LexTokenInternal(clang::Token&) + 3287
9  clang             0x0000000100ce8f85 clang::Lexer::LexTokenInternal(clang::Token&) + 4949
10 clang             0x00000001003d4d98 clang::Parser::ConsumeAnyToken() + 344
11 clang             0x00000001003cc44e clang::Parser::ExpectAndConsume(clang::tok::TokenKind, unsigned int, char const*, clang::tok::TokenKind) + 78
12 clang             0x000000010036b186 clang::Parser::ParseDeclGroup(clang::Parser::ParsingDeclSpec&, unsigned int, bool, clang::SourceLocation*, clang::Parser::ForRangeInit*) + 2198
13 clang             0x000000010036c07c clang::Parser::ParseSimpleDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::ParsedAttributes&, bool, clang::Parser::ForRangeInit*) + 892
14 clang             0x000000010036c1a6 clang::Parser::ParseDeclaration(clang::ASTOwningVector<clang::Stmt*, 32u>&, unsigned int, clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&) + 198
15 clang             0x00000001003cf1ad clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::Parser::ParsingDeclSpec*) + 1437
16 clang             0x00000001003d0406 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) + 566
17 clang             0x000000010034df1b clang::ParseAST(clang::Sema&, bool) + 315
18 clang             0x0000000100302a3c clang::CodeGenAction::ExecuteAction() + 60
19 clang             0x0000000100032cc3 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 435
20 clang             0x000000010000cd99 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1737
21 clang             0x0000000100002cad cc1_main(char const**, char const**, char const*, void*) + 749
22 clang             0x000000010000baae main + 4670
23 clang             0x0000000100001534 start + 52
Stack dump:
0.	Program arguments: /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/clang -cc1 -triple x86_64-apple-macosx10.6.6 -emit-obj -mrelax-all -disable-free -main-file-name output-file-cleanup.c -pic-level 1 -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 123.4 -resource-dir /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/Release+Asserts/bin/../lib/clang/3.1 -dependency-file /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.d -MT /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver/Output/output-file-cleanup.c.tmp.o -D CRASH -fmodule-cache-path /var/tmp/clang-module-cache -fdebug-compilation-dir /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang-build/tools/clang/test/Driver -ferror-limit 19 -fmessage-length 0 -stack-protector 1 -fblocks -fobjc-dispatch-method=mixed -fdiagnostics-show-option -o /tmp/output-file-cleanup-cYjySt.o -x c /Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/Driver/output-file-cleanup.c 
1.	/Users/buildslave/zorg/buildbot/smooshlab/slave-0.8/build.clang-x86_64-darwin10-gcc42-RA/clang.src/test/Driver/output-file-cleanup.c:22:2: current parser token 'pragma'
clang: error: unable to execute command: Segmentation fault


On 20 Nov 2011, at 4:01 PM, Peter Collingbourne wrote:

> Author: pcc
> Date: Sun Nov 20 18:01:05 2011
> New Revision: 145018
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=145018&view=rev
> Log:
> Teach the driver about failure result files, which are compilation
> output files that are valid regardless of whether the compilation
> succeeded or failed (but not if we crash).  Add depfiles to the
> failure result file list.
> 
> Added:
>    cfe/trunk/test/Driver/output-file-cleanup.c
> Removed:
>    cfe/trunk/test/Driver/crash-cleanup.c
> Modified:
>    cfe/trunk/include/clang/Driver/Compilation.h
>    cfe/trunk/lib/Driver/Driver.cpp
>    cfe/trunk/lib/Driver/Tools.cpp
> 
> Modified: cfe/trunk/include/clang/Driver/Compilation.h
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Compilation.h?rev=145018&r1=145017&r2=145018&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Driver/Compilation.h (original)
> +++ cfe/trunk/include/clang/Driver/Compilation.h Sun Nov 20 18:01:05 2011
> @@ -56,6 +56,10 @@
>   /// Result files which should be removed on failure.
>   ArgStringList ResultFiles;
> 
> +  /// Result files which are generated correctly on failure, and which should
> +  /// only be removed if we crash.
> +  ArgStringList FailureResultFiles;
> +
>   /// Redirection for stdout, stderr, etc.
>   const llvm::sys::Path **Redirects;
> 
> @@ -84,6 +88,10 @@
> 
>   const ArgStringList &getResultFiles() const { return ResultFiles; }
> 
> +  const ArgStringList &getFailureResultFiles() const {
> +    return FailureResultFiles;
> +  }
> +
>   /// getArgsForToolChain - Return the derived argument list for the
>   /// tool chain \arg TC (or the default tool chain, if TC is not
>   /// specified).
> @@ -106,6 +114,13 @@
>     return Name;
>   }
> 
> +  /// addFailureResultFile - Add a file to remove if we crash, and returns its
> +  /// argument.
> +  const char *addFailureResultFile(const char *Name) {
> +    FailureResultFiles.push_back(Name);
> +    return Name;
> +  }
> +
>   /// CleanupFileList - Remove the files in the given list.
>   ///
>   /// \param IssueErrors - Report failures as errors.
> 
> Modified: cfe/trunk/lib/Driver/Driver.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=145018&r1=145017&r2=145018&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Driver.cpp (original)
> +++ cfe/trunk/lib/Driver/Driver.cpp Sun Nov 20 18:01:05 2011
> @@ -507,9 +507,14 @@
>     return Res;
> 
>   // Otherwise, remove result files as well.
> -  if (!C.getArgs().hasArg(options::OPT_save_temps))
> +  if (!C.getArgs().hasArg(options::OPT_save_temps)) {
>     C.CleanupFileList(C.getResultFiles(), true);
> 
> +    // Failure result files are valid unless we crashed.
> +    if (Res < 0)
> +      C.CleanupFileList(C.getFailureResultFiles(), true);
> +  }
> +
>   // Print extra information about abnormal failures, if possible.
>   //
>   // This is ad-hoc, but we don't want to be excessively noisy. If the result
> 
> Modified: cfe/trunk/lib/Driver/Tools.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=145018&r1=145017&r2=145018&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Driver/Tools.cpp (original)
> +++ cfe/trunk/lib/Driver/Tools.cpp Sun Nov 20 18:01:05 2011
> @@ -218,11 +218,13 @@
>       DepFile = Output.getFilename();
>     } else if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
>       DepFile = MF->getValue(Args);
> +      C.addFailureResultFile(DepFile);
>     } else if (A->getOption().matches(options::OPT_M) ||
>                A->getOption().matches(options::OPT_MM)) {
>       DepFile = "-";
>     } else {
>       DepFile = darwin::CC1::getDependencyFileName(Args, Inputs);
> +      C.addFailureResultFile(DepFile);
>     }
>     CmdArgs.push_back("-dependency-file");
>     CmdArgs.push_back(DepFile);
> 
> Removed: cfe/trunk/test/Driver/crash-cleanup.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/crash-cleanup.c?rev=145017&view=auto
> ==============================================================================
> --- cfe/trunk/test/Driver/crash-cleanup.c (original)
> +++ cfe/trunk/test/Driver/crash-cleanup.c (removed)
> @@ -1,9 +0,0 @@
> -// RUN: not %clang -o %t.o -MMD -MF %t.d %s
> -// RUN: test ! -f %t.o
> -// RUN: test ! -f %t.d
> -// REQUIRES: shell
> -// REQUIRES: crash-recovery
> -
> -// XFAIL: *
> -
> -#pragma clang __debug crash
> 
> Added: cfe/trunk/test/Driver/output-file-cleanup.c
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/output-file-cleanup.c?rev=145018&view=auto
> ==============================================================================
> --- cfe/trunk/test/Driver/output-file-cleanup.c (added)
> +++ cfe/trunk/test/Driver/output-file-cleanup.c Sun Nov 20 18:01:05 2011
> @@ -0,0 +1,20 @@
> +// RUN: touch %t.o
> +// RUN: not %clang -DCRASH -o %t.o -MMD -MF %t.d %s
> +// RUN: test ! -f %t.o
> +// RUN: test ! -f %t.d
> +
> +// RUN: touch %t.o
> +// RUN: not %clang -o %t.o -MMD -MF %t.d %s
> +// RUN: test ! -f %t.o
> +// RUN: test -f %t.d
> +
> +// REQUIRES: shell
> +// REQUIRES: crash-recovery
> +
> +// XFAIL: darwin
> +
> +#ifdef CRASH
> +#pragma clang __debug crash
> +#else
> +invalid C code
> +#endif
> 
> 
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

-David






More information about the cfe-commits mailing list