[PATCH] D93401: [flang][driver] Add support for `-D`, `-U`

sameeran joshi via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Jan 9 01:53:42 PST 2021


sameeranjoshi added inline comments.


================
Comment at: flang/test/Flang-Driver/driver-help.f90:22
 ! HELP-NEXT: -###                   Print (but do not run) the commands to run for this compilation
+! HELP-NEXT: -D <macro>=<value>     Define <macro> to <value> (or 1 if <value> omitted)
 ! HELP-NEXT: -E                     Only run the preprocessor
----------------
I see below crash report, when omitting the <value> but not omitting the `=` symbol.
Not sure if that's correct way of running hence instead of filing bug reporting here.

```
./bin/flang-new -E -DX= test.f90
```

```
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/amd/f18_git/final_test/driver_build/bin/flang-new -fc1 -E -D X= -o - test.f90
 #0 0x00007f26185d0bc1 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/amd/f18_git/final_test/driver_build/bin/../lib/libLLVMSupport.so.12git+0x1a4bc1)
 #1 0x00007f26185ce9a4 llvm::sys::RunSignalHandlers() (/home/amd/f18_git/final_test/driver_build/bin/../lib/libLLVMSupport.so.12git+0x1a29a4)
 #2 0x00007f26185ceb10 SignalHandler(int) (/home/amd/f18_git/final_test/driver_build/bin/../lib/libLLVMSupport.so.12git+0x1a2b10)
 #3 0x00007f2617749470 (/lib/x86_64-linux-gnu/libc.so.6+0x46470)
 #4 0x00007f2617443498 Fortran::parser::OffsetToProvenanceMappings::Map(unsigned long) const (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x571498)
 #5 0x00007f261744adf2 Fortran::parser::TokenSequence::GetProvenanceRange() const (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x578df2)
 #6 0x00007f26173dd334 Fortran::parser::Preprocessor::MacroReplacement(Fortran::parser::TokenSequence const&, Fortran::parser::Prescanner&) (.localalias) (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x50b334)
 #7 0x00007f26173e9dc1 Fortran::parser::Prescanner::Statement() (.localalias) (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x517dc1)
 #8 0x00007f26173ea888 Fortran::parser::Prescanner::Prescan(Fortran::common::Interval<Fortran::parser::Provenance>) (.localalias) (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x518888)
 #9 0x00007f26173d480b Fortran::parser::Parsing::Prescan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Fortran::parser::Options) (/home/amd/f18_git/final_test/driver_build/bin/../lib/../lib/libFortranParser.so.12git+0x50280b)
#10 0x00007f2618424ddd Fortran::frontend::FrontendAction::Execute() (/home/amd/f18_git/final_test/driver_build/bin/../lib/libflangFrontend.so.12git+0xdddd)
#11 0x00007f261841fa5e Fortran::frontend::CompilerInstance::ExecuteAction(Fortran::frontend::FrontendAction&) (/home/amd/f18_git/final_test/driver_build/bin/../lib/libflangFrontend.so.12git+0x8a5e)
#12 0x00007f26184132fc Fortran::frontend::ExecuteCompilerInvocation(Fortran::frontend::CompilerInstance*) (/home/amd/f18_git/final_test/driver_build/bin/../lib/libflangFrontendTool.so.12git+0x12fc)
#13 0x000055bad4081c20 fc1_main(llvm::ArrayRef<char const*>, char const*) (/home/amd/f18_git/final_test/driver_build/bin/flang-new+0x3c20)
#14 0x000055bad4080e59 main (/home/amd/f18_git/final_test/driver_build/bin/flang-new+0x2e59)
#15 0x00007f261772a1e3 __libc_start_main /build/glibc-5mDdLG/glibc-2.30/csu/../csu/libc-start.c:342:3
#16 0x000055bad4080eae _start (/home/amd/f18_git/final_test/driver_build/bin/flang-new+0x2eae)
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 12.0.0 (https://github.com/llvm/llvm-project.git 2f9cb090cc6db1be5bf524eb0a32537503b3e786)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/amd/f18_git/final_test/driver_build/bin
flang-new: note: diagnostic msg: Error generating preprocessed source(s) - no preprocessable inputs.

```



Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D93401/new/

https://reviews.llvm.org/D93401



More information about the cfe-commits mailing list