diff options
author | Ofek <ofekshilon@gmail.com> | 2024-05-06 22:08:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-06 22:08:31 +0300 |
commit | 0fc6a922b1ca3abb57cd99711d594a1f27896227 (patch) | |
tree | 749d4aa4cbbad5369491ddfb6060d7c9ae402c5e | |
parent | 72caf0904859caa60b8d6bb2317a3e582a0027b2 (diff) | |
download | compiler-explorer-0fc6a922b1ca3abb57cd99711d594a1f27896227.tar.gz compiler-explorer-0fc6a922b1ca3abb57cd99711d594a1f27896227.zip |
Fix #6437: Don't try and generate cfg for incomplete (truncated) IR (#6444)gh-11649
-rw-r--r-- | lib/base-compiler.ts | 4 | ||||
-rw-r--r-- | lib/cfg/cfg-parsers/llvm-ir.ts | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/base-compiler.ts b/lib/base-compiler.ts index 5e164f267..942a49ce0 100644 --- a/lib/base-compiler.ts +++ b/lib/base-compiler.ts @@ -1444,6 +1444,10 @@ export class BaseCompiler implements ICompiler { asm: ir.asm, }; + if (result.asm[result.asm.length - 1].text === '[truncated; too many lines]') { + return result; + } + if (produceCfg) { result.cfg = cfg.generateStructure( this.compiler, diff --git a/lib/cfg/cfg-parsers/llvm-ir.ts b/lib/cfg/cfg-parsers/llvm-ir.ts index 4c9066373..e8e22e0c8 100644 --- a/lib/cfg/cfg-parsers/llvm-ir.ts +++ b/lib/cfg/cfg-parsers/llvm-ir.ts @@ -62,9 +62,10 @@ export class LlvmIrCfgParser extends BaseCFGParser { while (i < asmArr.length) { if (this.functionDefinition.test(asmArr[i].text)) { const start = i; - while (asmArr.length > 0 && asmArr[i].text !== '}') { + do { i++; - } + } while (i < asmArr.length && asmArr[i].text !== '}'); + // start is the function define, end is the closing brace result.push({ start, |