Skip to content

Basic Block has trailing DbgRecords! #155030

@claudeha

Description

@claudeha

Termux Emscripten 4.0.13 with Clang 22.0.0git fails sometimes when using all of -Os -fexceotions -gsource-map and setjmp(), here with libpng related code. The error message is

Basic Block has trailing DbgRecords!

build log with backtrace :

clang dumps :

smaller reproducer:

/*
em++ -std=c++17 -Wall -pedantic -Wextra \
  -Os -fexceptions -gsource-map -c bug.c             */

#include <setjmp.h>

extern void *create(void);
extern void destroy(void *p);

int bug(void)
{
  jmp_buf jmpbuf;
  void *file = create();
  if (! file)
    return 1;
  void *png = create();
  if (! png)
    return 2;
  void *info = create();
  if (! info)
  {
    destroy(png);
    destroy(file);
    return 3;
  }
  if (setjmp(jmpbuf))
  {
    destroy(info);
    destroy(png);
    destroy(file);
    return 4;
  }
  destroy(file);
  return 0;
}
Basic Block has trailing DbgRecords!
label %entry.split
Basic Block has trailing DbgRecords!
label %if.end
Basic Block has trailing DbgRecords!
label %if.end4
Basic Block has trailing DbgRecords!
label %if.end
Basic Block has trailing DbgRecords!
label %if.end4
fatal error: error in backend: Broken
      module found, compilation aborted!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: /data/data/com.termux/files/usr/opt/emscripten-llvm/bin/clang++ -target wasm32-unknown-emscripten -mllvm -combiner-global-alias-analysis=false -mllvm -enable-emscripten-cxx-exceptions -mllvm -enable-emscripten-sjlj -mllvm -disable-lsr --sysroot=/data/data/com.termux/files/usr/opt/emscripten/cache/sysroot -DEMSCRIPTEN -Xclang -iwithsysroot/include/fakesdl -Xclang -iwithsysroot/include/compat -std=c++17 -Wall -pedantic -Wextra -Os -fexceptions -g -c bug.cc
1.      <eof> parser at end of file
2.      Code generation
clang++: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 22.0.0git
Target: wasm32-unknown-emscripten
Thread model: posix
InstalledDir: /data/data/com.termux/files/usr/opt/emscripten-llvm/bin
Build config: +assertions
clang++: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang++: note: diagnostic msg: /data/data/com.termux/files/usr/tmp/bug-603d53.cpp
clang++: note: diagnostic msg: /data/data/com.termux/files/usr/tmp/bug-603d53.sh
clang++: note: diagnostic msg:

********************

bug-603d53.cpp

bug-603d53.sh

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions