Bug 264853 - clang: fatal error when compiling peg with debug symbols
Summary: clang: fatal error when compiling peg with debug symbols
Status: Open
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Some People
Assignee: freebsd-toolchain (Nobody)
URL: https://github.com/llvm/llvm-project/...
Keywords:
Depends on:
Blocks:
 
Reported: 2022-06-23 16:10 UTC by Joseph Mingrone
Modified: 2022-06-24 12:29 UTC (History)
1 user (show)

See Also:


Attachments
preprocessed source (259.24 KB, text/plain)
2022-06-23 16:10 UTC, Joseph Mingrone
no flags Details
run script (1.86 KB, application/x-shellscript)
2022-06-23 16:11 UTC, Joseph Mingrone
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Mingrone freebsd_committer 2022-06-23 16:10:43 UTC
Created attachment 234893 [details]
preprocessed source

I saw this on CURRENT before and after llvm 14 was merged.  The build log is short, so I'll include it below.  When I remove -g from CFLAGS the build finishes.

jrm@ser /usr/ports/textproc/peg/work/peg-0.1.18 [peg|✔] % gmake
cc -g -Wall -O3 -DNDEBUG  -Isrc -c -o peg.o src/peg.c
In file included from src/peg.c:49:
src/peg.peg-c:380:3: warning: unused label 'l77' [-Wunused-label]
  l77:;   yy->__pos= yypos0; yy->__thunkpos= yythunkpos0;
  ^~~~
src/peg.peg-c:257:16: warning: unused function 'yyPush' [-Wunused-function]
YY_LOCAL(void) yyPush(yycontext *yy, char *text, int count)
               ^
src/peg.peg-c:268:16: warning: unused function 'yyPop' [-Wunused-function]
YY_LOCAL(void) yyPop(yycontext *yy, char *text, int count)   { yy->__val -= count; }
               ^
src/peg.peg-c:269:16: warning: unused function 'yySet' [-Wunused-function]
YY_LOCAL(void) yySet(yycontext *yy, char *text, int count)   { yy->__val[count]= yy->__; }
               ^
cannot have column info without line info
!1417 = distinct !DILexicalBlock(scope: !1418, file: !9, column: 8)
cannot have column info without line info
!1417 = distinct !DILexicalBlock(scope: !1418, file: !9, column: 8)
fatal error: error in backend: Broken module found, compilation aborted!
PLEASE submit a bug report to https://bugs.freebsd.org/submit/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.      Program arguments: cc -g -Wall -O3 -DNDEBUG -Isrc -c -o peg.o src/peg.c
1.      <eof> parser at end of file
2.      Code generation
 #0 0x00000000050b95d1 PrintStackTrace /usr/src/contrib/llvm-project/llvm/lib/Support/Unix/Signals.inc:565:13
 #1 0x00000000050b7905 RunSignalHandlers /usr/src/contrib/llvm-project/llvm/lib/Support/Signals.cpp:98:18
 #2 0x000000000505fb2e HandleCrash /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:79:5
 #3 0x000000000505fabc /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:445:3
 #4 0x00000000050ab77c /usr/src/contrib/llvm-project/llvm/lib/Support/Process.cpp:102:5
 #5 0x0000000002477e89 (/usr/bin/cc+0x2477e89)
 #6 0x0000000005067aae __is_long /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/string:1445:22
 #7 0x0000000005067aae ~basic_string /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/string:2231:9
 #8 0x0000000005067aae report_fatal_error /usr/src/contrib/llvm-project/llvm/lib/Support/ErrorHandling.cpp:104:5
 #9 0x0000000005067949 (/usr/bin/cc+0x5067949)
#10 0x0000000004d98b16 (/usr/bin/cc+0x4d98b16)
#11 0x0000000004d29306 doFinalization /usr/src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1498:13
#12 0x0000000004d23297 runOnModule /usr/src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1585:41
#13 0x0000000004d23297 run /usr/src/contrib/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:539:44
#14 0x0000000002cbe654 ~TimeTraceScope /usr/src/contrib/llvm-project/llvm/include/llvm/Support/TimeProfiler.h:88:9
#15 0x0000000002cbe654 RunCodegenPipeline /usr/src/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1536:3
#16 0x0000000002cbe654 EmitAssembly /usr/src/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1565:3
#17 0x0000000002cbe654 EmitBackendOutput /usr/src/contrib/llvm-project/clang/lib/CodeGen/BackendUtil.cpp:1728:15
#18 0x0000000002fad2c3 reset /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__memory/unique_ptr.h:312:28
#19 0x0000000002fad2c3 ~unique_ptr /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/__memory/unique_ptr.h:269:19
#20 0x0000000002fad2c3 HandleTranslationUnit /usr/src/contrib/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:370:7
#21 0x00000000034e28c4 begin /usr/obj/usr/src/amd64.amd64/tmp/usr/include/c++/v1/vector:1408:30
#22 0x00000000034e28c4 finalize<std::__1::vector<std::__1::unique_ptr<clang::TemplateInstantiationCallback, std::__1::default_delete<clang::TemplateInstantiationCallback> >, std::__1::allocator<std::__1::unique_ptr<clang::TemplateInstantiationCallback, std::__1::default_delete<clang::TemplateInstantiationCallback> > > > > /usr/src/contrib/llvm-project/clang/include/clang/Sema/TemplateInstCallback.h:54:16
#23 0x00000000034e28c4 ParseAST /usr/src/contrib/llvm-project/clang/lib/Parse/ParseAST.cpp:178:3
#24 0x0000000002ee975f Execute /usr/src/contrib/llvm-project/clang/lib/Frontend/FrontendAction.cpp:971:10
#25 0x0000000002e7dd9f getPtr /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:271:42
#26 0x0000000002e7dd9f operator bool /usr/src/contrib/llvm-project/llvm/include/llvm/Support/Error.h:234:16
#27 0x0000000002e7dd9f ExecuteAction /usr/src/contrib/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1036:23
#28 0x0000000002fa6806 ExecuteCompilerInvocation /usr/src/contrib/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:263:25
#29 0x0000000002477b45 cc1_main /usr/src/contrib/llvm-project/clang/tools/driver/cc1_main.cpp:248:15
#30 0x0000000002485095 ExecuteCC1Tool /usr/src/contrib/llvm-project/clang/tools/driver/driver.cpp:317:12
#31 0x0000000002d39f07 operator() /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:30
#32 0x0000000002d39f07 callback_fn<(lambda at /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:22)> /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#33 0x000000000505fa64 operator() /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:0:12
#34 0x000000000505fa64 RunSafely /usr/src/contrib/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:428:3
#35 0x0000000002d39b13 Execute /usr/src/contrib/llvm-project/clang/lib/Driver/Job.cpp:407:7
#36 0x0000000002d07f32 ExecuteCommand /usr/src/contrib/llvm-project/clang/lib/Driver/Compilation.cpp:196:15
#37 0x0000000002d083d9 ExecuteJobs /usr/src/contrib/llvm-project/clang/lib/Driver/Compilation.cpp:249:13
#38 0x0000000002d1d0fc empty /usr/src/contrib/llvm-project/llvm/include/llvm/ADT/SmallVector.h:73:47
#39 0x0000000002d1d0fc ExecuteCompilation /usr/src/contrib/llvm-project/clang/lib/Driver/Driver.cpp:1617:23
cc: error: clang frontend command failed with exit code 70 (use -v to see invocation)
FreeBSD clang version 14.0.5 (https://github.com/llvm/llvm-project.git llvmorg-14.0.5-0-gc12386ae247c)
Target: x86_64-unknown-freebsd14.0
Thread model: posix
InstalledDir: /usr/bin
cc: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
cc: note: diagnostic msg: /tmp/peg-ee85f1.c
cc: note: diagnostic msg: /tmp/peg-ee85f1.sh
cc: note: diagnostic msg:

********************
gmake: *** [Makefile:43: peg.o] Error 70
Comment 1 Joseph Mingrone freebsd_committer 2022-06-23 16:11:56 UTC
Created attachment 234894 [details]
run script
Comment 2 Dimitry Andric freebsd_committer 2022-06-23 17:08:04 UTC
This is caused by the "#line 0" directives in src/peg.peg-c, and I have reported an upstream bug for it: https://github.com/llvm/llvm-project/issues/56186

For now, a workaround can be to substitute all the "#line 0" lines with "#line 1", or simply deleting them.