[Flang-dev] getting sigsev on glibc

blubee blubeeme gurenchan at gmail.com
Fri Nov 30 06:40:03 EST 2018


I wanted to test a llvm only toolchain so I used Fedora 29 to compile a
complete llvm7 toolchain.

Then I used that toolchain build flang-driver. The binary builds just fine
but running flang with a sample fortran program cause sigsev.

I rebuilt flang-driver with debug symbols and recompiled it with the llvm
toolchain. Here's the lldb backtrace:

lldb -- /usr/local/flang-driver/bin/flang ../../test.f
(lldb) target create "/usr/local/flang-driver/bin/flang"
r
Current executable set to '/usr/local/flang-driver/bin/flang' (x86_64).
(lldb) settings set -- target.run-args  "../../test.f"
(lldb) r
Process 27552 launched: '/usr/local/flang-driver/bin/flang' (x86_64)
Process 27552 stopped
* thread #1, name = 'flang', stop reason = signal SIGSEGV: invalid address
(fault address: 0x10)
    frame #0: 0x0000000004564cd8
flang`llvm::sys::ExecuteAndWait(llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>,
llvm::Optional<llvm::ArrayRef<llvm::StringRef> >,
llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, unsigned int, unsigned
int, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) + 56
flang`llvm::sys::ExecuteAndWait:
->  0x4564cd8 <+56>: movzbl 0x10(%r15), %eax
    0x4564cdd <+61>: movq   (%rsp), %rdx
    0x4564ce1 <+65>: movq   0x8(%rsp), %rcx
    0x4564ce6 <+70>: testb  %al, %al
(lldb) bt
* thread #1, name = 'flang', stop reason = signal SIGSEGV: invalid address
(fault address: 0x10)
  * frame #0: 0x0000000004564cd8
flang`llvm::sys::ExecuteAndWait(llvm::StringRef,
llvm::ArrayRef<llvm::StringRef>,
llvm::Optional<llvm::ArrayRef<llvm::StringRef> >,
llvm::ArrayRef<llvm::Optional<llvm::StringRef> >, unsigned int, unsigned
int, std::__cxx11::basic_string<char, std::char_traits<char>,
std::allocator<char> >*, bool*) + 56
    frame #1: 0x0000000005026431
flang`clang::driver::Command::Execute(this=0x00000000089b05d0,
Redirects=ArrayRef<llvm::Optional<llvm::StringRef> > @ 0x00007fffffffba90,
ErrMsg="\b\xbcÿÿÿ , ExecutionFailed=0x00007fffffffbbf7) const at Job.cpp:335
    frame #2: 0x0000000004fc21b2
flang`clang::driver::Compilation::ExecuteCommand(this=0x00000000089afc40,
C=0x00000000089b05d0, FailingCommand=0x00007fffffffbd10) const at
Compilation.cpp:185
    frame #3: 0x0000000004fc23bb
flang`clang::driver::Compilation::ExecuteJobs(this=0x00000000089afc40,
Jobs=0x00000000089afcd8, FailingCommands=0x00007fffffffc1e8) const at
Compilation.cpp:236
    frame #4: 0x0000000004fde406
flang`clang::driver::Driver::ExecuteCompilation(this=0x00007fffffffc2a0,
C=0x00000000089afc40, FailingCommands=0x00007fffffffc1e8) at Driver.cpp:1386
    frame #5: 0x0000000002c2ce7e flang`main(argc_=2,
argv_=0x00007fffffffdd18) at driver.cpp:462
    frame #6: 0x00007ffff7bbe413 libc.so.6`.annobin_libc_start.c + 243
    frame #7: 0x0000000002c2b02e flang`_start + 46


ldd --version
ldd (GNU libc) 2.28
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

sample fortran code: filename test.f

C AREA OF A TRIANGLE - HERON'S FORMULAC INPUT - CARD READER UNIT 5,
INTEGER INPUTC OUTPUT -C INTEGER VARIABLES START WITH I,J,K,L,M OR N
   READ(5,501) IA,IB,IC  501 FORMAT(3I5)      IF(IA.EQ.0 .OR. IB.EQ.0
.OR. IC.EQ.0) STOP 1      S = (IA + IB + IC) / 2.0      AREA = SQRT( S
* (S - IA) * (S - IB) * (S - IC) )      WRITE(6,601) IA,IB,IC,AREA
601 FORMAT(4H A= ,I5,5H  B= ,I5,5H  C= ,I5,8H  AREA= ,F10.2,     $13H
SQUARE UNITS)      STOP      END


relevant env variables

CFLAGS=-std=c17
CXXFLAGS=-std=c++17
LDFLAGS="-fuse-ld=lld -lc++ -lc++abi -lm -lc -lPolly -lPollyISL
-lPollyPPCG -LLVMPolly"


I am not particularly familiar with glibc but does anything stand out, any
help would be appreciated.

Do I need to recompile a kernel with this new toolchain to get around
errors like these?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.flang-compiler.org/pipermail/flang-dev_lists.flang-compiler.org/attachments/20181130/46a6bf95/attachment.html>


More information about the flang-dev mailing list