Skip to content

Fix #6403: Do not intercept crashes #6408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
Original file line number Diff line number Diff line change
Expand Up @@ -482,11 +482,19 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma

private def verifySignature(sym: Symbol, sig: String)(implicit ctx: Context): Unit = {
import scala.tools.asm.util.CheckClassAdapter
def wrap(body: => Unit): Boolean =
try { body; true }
catch { case ex: Throwable => println(ex.getMessage); false }
def wrap(body: => Unit): Unit = {
try body
catch {
case ex: Throwable =>
ctx.error(i"""|compiler bug: created invalid generic signature for $sym in ${sym.denot.owner.showFullName}
|signature: $sig
|if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
""".trim, sym.sourcePos)
throw ex
}
}

val valid = wrap {
wrap {
if (sym.is(Flags.Method)) {
CheckClassAdapter.checkMethodSignature(sig)
}
Expand All @@ -497,14 +505,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
CheckClassAdapter.checkClassSignature(sig)
}
}

if (!valid) {
ctx.error(
i"""|compiler bug: created invalid generic signature for $sym in ${sym.denot.owner.showFullName}
|signature: $sig
|if this is reproducible, please report bug at https://github.com/lampepfl/dotty/issues
""".trim, sym.sourcePos)
}
}

/**
Expand Down
8 changes: 4 additions & 4 deletions compiler/src/dotty/tools/backend/jvm/GenBCode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
try { /*withCurrentUnit(item.cunit)*/(visit(item)) }
catch {
case ex: Throwable =>
ex.printStackTrace()
ctx.error(s"Error while emitting ${int.sourceFileFor(item.cunit)}\n${ex.getMessage}")
println(s"Error while emitting ${int.sourceFileFor(item.cunit)}")
throw ex
}
}
}
Expand Down Expand Up @@ -414,8 +414,8 @@ class GenBCodePipeline(val entryPoints: List[Symbol], val int: DottyBackendInter
addToQ3(item)
} catch {
case ex: Throwable =>
ex.printStackTrace()
ctx.error(s"Error while emitting ${item.plain.classNode.name}\n${ex.getMessage}")
println(s"Error while emitting ${item.plain.classNode.name}")
throw ex
}
}
}
Expand Down
9 changes: 2 additions & 7 deletions compiler/test/dotty/tools/vulpix/ParallelTesting.scala
Original file line number Diff line number Diff line change
Expand Up @@ -852,19 +852,14 @@ trait ParallelTesting extends RunnerOrchestration { self =>
extends Test(testSources, times, threadLimit, suppressAllOutput) {
protected def encapsulatedCompilation(testSource: TestSource) = new LoggedRunnable {
def checkTestSource(): Unit = tryCompile(testSource) {
def fail(msg: String): Nothing = {
def fail(msg: String): Unit = {
echo(msg)
failTestSource(testSource)
???
}
testSource match {
case testSource@JointCompilationSource(_, files, flags, outDir, fromTasty, decompilation) =>
val sourceFiles = testSource.sourceFiles
val reporter =
try compile(sourceFiles, flags, true, outDir)
catch {
case ex: Throwable => fail(s"Fatal compiler crash when compiling: ${testSource.title}")
}
val reporter = compile(sourceFiles, flags, true, outDir)
if (reporter.compilerCrashed)
fail(s"Compiler crashed when compiling: ${testSource.title}")
case testSource@SeparateCompilationSource(_, dir, flags, outDir) => unsupported("NoCrashTest - SeparateCompilationSource")
Expand Down