<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body smarttemplateinserted="true">
<div>Hi<br>
</div>
<div>
<blockquote type="cite"> On which platform? When I compile the
attached tt.pp file with -gw4 -Clfsanitize=address (LLVM 13,
Debian 11, x86-64) and then run it, I get the output in tt.txt.
It includes line information. <br>
<br>
You could try lldb instead of gdb, although gdb should also be
able to handle debug information generated by LLVM. </blockquote>
</div>
<div><br>
</div>
<div>Ubuntu 22.04, LLVM 13</div>
<div><br>
</div>
<div>Nothing helps.<br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>only some units are affected</div>
<div><br>
</div>
<div>Actually, now I see the warnings during compilation</div>
<div><br>
</div>
<div><span style="font-family:monospace"><span
style="color:#000000;background-color:#ffffff;">Assembling
xquery </span><br>
mismatched subprogram between llvm.dbg.addr variable and !dbg
attachment <br>
inlinable function call in a function with debug info must have
a !dbg location<br>
invoke void
@"\01XQUERY$_$IXQVALUE_$__$$_$finalize$IXQVALUE"(%typ.XQUERY.IXQValue*
%reg.1_200)<br>
to label %.Lj9768 unwind label %.Lj9743<br>
.....<br>
call void @llvm.dbg.addr(metadata
%typ.SYSTEM.TRTLCriticalSection* %tmp.1, metadata !48637,
metadata !DIExpression()), !dbg !48773 <br>
label %0 <br>
void ()* @"\01XQUERY_$$_finalize$" <br>
!48637 = !DILocalVariable(name:
"_zero_$SYSTEM_$$_TRTLCRITICALSECTION", scope: !48635, file: !3,
line: 10567, type: !1260) <br>
!48635 = distinct !DISubprogram(name: "XQUERY_$$_init$", scope:
!3, file: !3, line: 3506, type: !7606, scopeLine: 10504,
spFlags: DISPFlagDefinition, unit: !2) <br>
!48773 = !DILocation(line: 10570, column: 1, scope: !48772) <br>
!48772 = distinct !DISubprogram(name: "XQUERY_$$_finalize$",
scope: !3, file: !3, line: 10570, type: !7606, scopeLine: 10570,
spFlags: DISPFlagDefinition, unit: !2) <br>
warning: ignoring invalid debug info in
/home/theo/lib/fpc/x86_64-linux/xquery.ll<br>
<br>
<br>
</span></div>
<div><br>
</div>
<div>The first appears to be caused by my managed operator patch<br>
</div>
<div><br>
</div>
<div>Then there is the default issue <a
class="moz-txt-link-freetext"
href="https://gitlab.com/freepascal.org/fpc/source/-/issues/40395">https://gitlab.com/freepascal.org/fpc/source/-/issues/40395</a></div>
<div>(and you have fixed it while I was still writing this mail)<br>
</div>
<p>Then this:</p>
<p><a class="moz-txt-link-freetext"
href="https://gitlab.com/freepascal.org/fpc/source/-/issues/40280">https://gitlab.com/freepascal.org/fpc/source/-/issues/40280</a>
is causing a stack corruption </p>
<p><a class="moz-txt-link-freetext"
href="https://gitlab.com/freepascal.org/fpc/source/-/issues/40392">https://gitlab.com/freepascal.org/fpc/source/-/issues/40392</a>
is causing a heap corruption </p>
<p><br>
</p>
<div> Cheers,<br>
Benito <br>
</div>
<div class="moz-cite-prefix">On 11.08.23 12:57, Jonas Maebe via
fpc-pascal wrote:<br>
</div>
<blockquote type="cite"
cite="mid:27a9738d-7552-48f8-42e4-d926fa68e5cc@freepascal.org">On
10/08/2023 23:27, Benito van der Zander via fpc-pascal wrote: <br>
<blockquote type="cite">i tried to run my program under LLVM (from
july fpc) and it crashes? <br>
<br>
Program received signal SIGSEGV, Segmentation fault. <br>
0x000000000042e5f1in SYSTEM_$$_SYSGETMEM_FIXED$QWORD$$POINTER()
<br>
(gdb) bt <br>
#0 0x000000000042e5f1in
SYSTEM_$$_SYSGETMEM_FIXED$QWORD$$POINTER() <br>
#1 0x000000000041b92ain fpc_ansistr_setlength() <br>
#2 0x0000000000558d52in RESETBUFFER(ABUFFER=0x7fffffffd560,
BASECAPACITY=130) at bbutils.pas:1650 <br>
#3 INIT(ABUFFER=0x7fffffffd560, BASECAPACITY=130,
AENCODING=65001) at bbutils.pas:1639 <br>
#4 STRDECODEHTMLENTITIES(result=0x0, P=<optimized out>,
L=130, ENCODING=65001, FLAGS=...) at bbutils.pas:5527 <br>
<br>
anyone has seen sysgetmem crash before? <br>
</blockquote>
<br>
It suggests heap corruption. <br>
<br>
<blockquote type="cite">Perhaps that is exactly the kind of things
ASAN was supposed to detect. <br>
</blockquote>
<br>
Possibly, yes. <br>
<br>
<blockquote type="cite">But with ASAN, I get an error somewhere
entirely else. And I do not understand it, because the function
is shown as ~ 5000 lines of assembly. <br>
<br>
How can I see the mixed code with disassemble /rm in gdb? I
tried to call fpc -gl, -gs and -gw, and nothing helps <br>
</blockquote>
<br>
On which platform? When I compile the attached tt.pp file with
-gw4 -Clfsanitize=address (LLVM 13, Debian 11, x86-64) and then
run it, I get the output in tt.txt. It includes line information.
<br>
<br>
You could try lldb instead of gdb, although gdb should also be
able to handle debug information generated by LLVM. <br>
<br>
<blockquote type="cite">And there are a lot of weird ASAN calls
for trivial movs. Like: <br>
<br>
0x00000000006f577c<+22204>: 48 8b bb c8 00 00 00
movrdi,QWORDPTR[rbx+0xc8] <br>
0x00000000006f5783<+22211>: e8 18 cc d0 ff
call0x4023a0<__asan_report_load8@plt> <br>
0x00000000006f5788<+22216>: e8 13 cc d0 ff
call0x4023a0<__asan_report_load8@plt> <br>
0x00000000006f578d<+22221>: e8 0e cc d0 ff
call0x4023a0<__asan_report_load8@plt> <br>
0x00000000006f5792<+22226>: e8 09 cc d0 ff
call0x4023a0<__asan_report_load8@plt> <br>
0x00000000006f5797<+22231>: 48 89 c7 movrdi,rax <br>
0x00000000006f579a<+22234>: e8 01 cc d0 ff
call0x4023a0<__asan_report_load8@plt> <br>
0x00000000006f579f<+22239>: 48 89 cf movrdi,rcx <br>
0x00000000006f57a2<+22242>: e8 09 ca d0 ff
call0x4021b0<__asan_report_store8@plt> <br>
<br>
Are they supposed to be there? <br>
</blockquote>
<br>
These are generated by LLVM's own code generator, so yes. <br>
<br>
<br>
Jonas <br>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-pascal maillist - <a class="moz-txt-link-abbreviated moz-txt-link-freetext" href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal</a>
</pre>
</blockquote>
</body>
</html>