llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
25.95k stars 10.58k forks source link

Flang stack overflow building openacc test from llvm-test-suite #90477

Open tblah opened 2 weeks ago

tblah commented 2 weeks ago

goacc/loop-3-2.f95 from the gfortran regression tests can cause a stack overflow in flang-new.

However the test is built by the testsuite does not lead to this bug (all tests build and pass for me).

$ flang-new -fopenacc loop-3-2.f95 

/home/user/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95:21:9: warning: Misplaced OpenACC end directive
    !$acc end loop ! { dg-error "Unexpected" }
          ^^^^^^^^
/home/user/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95:28:9: warning: Misplaced OpenACC end directive
    !$acc end loop ! { dg-error "Unexpected" }
          ^^^^^^^^
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /home/user/build/release-assertions/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenacc -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +outline-atomics -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -resource-dir /home/tomecl01/build/release-assertions/lib/clang/19 -mframe-pointer=non-leaf -o /tmp/loop-3-2-3b30e3.o -x f95-cpp-input /home/tomecl01/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95
  #0 0x0000c829f7446ae0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tomecl01/build/release-assertions/bin/flang-new+0x2df6ae0)
  #1 0x0000c829f74449cc llvm::sys::RunSignalHandlers() (/home/tomecl01/build/release-assertions/bin/flang-new+0x2df49cc)
  #2 0x0000c829f74474cc SignalHandler(int) Signals.cpp:0:0
  #3 0x0000ed30373569d0 (linux-vdso.so.1+0x9d0)
  #4 0x0000c829f9c92c64 llvm::po_iterator<mlir::Block*, llvm::SmallPtrSet<mlir::Block*, 8u>, false, llvm::GraphTraits<mlir::Block*>>::po_iterator(mlir::Block*) RegionUtils.cpp:0:0
  #5 0x0000c829f9c92434 llvm::iterator_range<llvm::po_iterator<mlir::Block*, llvm::SmallPtrSet<llvm::GraphTraits<mlir::Block*>::NodeRef, 8u>, false, llvm::GraphTraits<mlir::Block*>>> llvm::post_order<mlir::Block*>(mlir::Block* const&) (/home/tomecl01/build/release-assertions/bin/flang-new+0x5642434)
  #6 0x0000c829f9c8e3c0 propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
  #7 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
  #8 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
  #9 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #10 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #11 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #12 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #13 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #14 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #15 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #16 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #17 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #18 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #19 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
 #20 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
[...]
#246 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#247 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#248 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#249 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#250 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#251 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#252 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#253 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#254 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
#255 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0
flang-new: error: unable to execute command: Segmentation fault (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 19.0.0git (git@github.com:llvm/llvm-project.git f5ed9170464b73a7a0a386358e995ce8373ef153)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/user/build/release-assertions/bin
Build config: +assertions
flang-new: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/loop-3-2-741778
flang-new: note: diagnostic msg: /tmp/loop-3-2-741778.sh
flang-new: note: diagnostic msg: 

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

I'm using

llvmbot commented 2 weeks ago

@llvm/issue-subscribers-flang-ir

Author: Tom Eccles (tblah)

[goacc/loop-3-2.f95](https://github.com/llvm/llvm-test-suite/blob/main/Fortran/gfortran/regression/goacc/loop-3-2.f95) from the gfortran regression tests can cause a stack overflow in flang-new. However the test is built by the testsuite does not lead to this bug (all tests build and pass for me). ``` $ flang-new -fopenacc loop-3-2.f95 /home/tomecl01/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95:21:9: warning: Misplaced OpenACC end directive !$acc end loop ! { dg-error "Unexpected" } ^^^^^^^^ /home/tomecl01/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95:28:9: warning: Misplaced OpenACC end directive !$acc end loop ! { dg-error "Unexpected" } ^^^^^^^^ PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump: 0. Program arguments: /home/tomecl01/build/release-assertions/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fopenacc -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +outline-atomics -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -resource-dir /home/tomecl01/build/release-assertions/lib/clang/19 -mframe-pointer=non-leaf -o /tmp/loop-3-2-3b30e3.o -x f95-cpp-input /home/tomecl01/testsuite-llvm/Fortran/gfortran/regression/goacc/loop-3-2.f95 #0 0x0000c829f7446ae0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/tomecl01/build/release-assertions/bin/flang-new+0x2df6ae0) #1 0x0000c829f74449cc llvm::sys::RunSignalHandlers() (/home/tomecl01/build/release-assertions/bin/flang-new+0x2df49cc) #2 0x0000c829f74474cc SignalHandler(int) Signals.cpp:0:0 #3 0x0000ed30373569d0 (linux-vdso.so.1+0x9d0) #4 0x0000c829f9c92c64 llvm::po_iterator<mlir::Block*, llvm::SmallPtrSet<mlir::Block*, 8u>, false, llvm::GraphTraits<mlir::Block*>>::po_iterator(mlir::Block*) RegionUtils.cpp:0:0 #5 0x0000c829f9c92434 llvm::iterator_range<llvm::po_iterator<mlir::Block*, llvm::SmallPtrSet<llvm::GraphTraits<mlir::Block*>::NodeRef, 8u>, false, llvm::GraphTraits<mlir::Block*>>> llvm::post_order<mlir::Block*>(mlir::Block* const&) (/home/tomecl01/build/release-assertions/bin/flang-new+0x5642434) #6 0x0000c829f9c8e3c0 propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #7 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #8 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #9 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #10 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #11 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #12 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #13 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #14 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #15 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #16 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #17 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #18 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #19 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #20 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 [...] #246 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #247 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #248 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #249 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #250 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #251 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #252 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #253 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #254 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 #255 0x0000c829f9c8e58c propagateLiveness(mlir::Region&, (anonymous namespace)::LiveMap&) RegionUtils.cpp:0:0 flang-new: error: unable to execute command: Segmentation fault (core dumped) flang-new: error: flang frontend command failed due to signal (use -v to see invocation) flang-new version 19.0.0git (git@github.com:llvm/llvm-project.git f5ed9170464b73a7a0a386358e995ce8373ef153) Target: aarch64-unknown-linux-gnu Thread model: posix InstalledDir: /home/tomecl01/build/release-assertions/bin Build config: +assertions flang-new: note: diagnostic msg: ******************** PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT: Preprocessed source(s) and associated run script(s) are located at: flang-new: note: diagnostic msg: /tmp/loop-3-2-741778 flang-new: note: diagnostic msg: /tmp/loop-3-2-741778.sh flang-new: note: diagnostic msg: ******************** ``` I'm using - llvm-project f5ed917046 - llvm-test-suite dae2ca9c17
tarunprabhu commented 2 weeks ago

@keidavis and I both encountered non-deterministic failures with this test as well where it would run out of memory on a system with 256GB of RAM. I don't think either of us was able to reproduce it consistently.