Bug 348345

Summary: Assertion fails for negative lineno
Product: [Developer tools] valgrind Reporter: Jim Garrison <jim>
Component: generalAssignee: Julian Seward <jseward>
Status: RESOLVED FIXED    
Severity: minor CC: flo2030, philippe.waroquiers, tim.besard
Priority: NOR    
Version First Reported In: 3.10 SVN   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://github.com/JuliaLang/julia/issues/10806#issuecomment-92592763
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Patch to change assertion to warning
Remove other lineno>=0 assertion.

Description Jim Garrison 2015-05-28 04:21:41 UTC
coregrind/m_debuginfo/storage.c has asserts that lineno >= 0.  For some strange reason, when we (the developers of Julia) build julia against LLVM 3.7 (svn), it reports at times a line number of -1.  We've yet to figure out why, but in the meantime we've patched valgrind so that it provides a warning instead of exiting.  I am filing this bug to offer this patch upstream.

I think a warning in this case makes sense -- after all, valgrind already provides a warning for a huge lineno (greater than MAX_LINENO), and nothing is lost by continuing when a negative line number is reported.

There is a second place in the same file that asserts lineno >= 0.  I've been unable to trigger this code path, but could patch it as well to give a warning.

Reproducible: Always

Steps to Reproduce:
1. Compile Julia master (https://github.com/JuliaLang/julia) against LLVM svn (3.7)
2. Run julia under nulgrind


Actual Results:  
valgrind: m_debuginfo/storage.c:535 (vgModuleLocal_addLineInfo): Assertion 'lineno >= 0' failed.

(and exit in failure)

Expected Results:  
Provide a warning

I will upload a patch as soon as I figure out how.
Comment 1 Jim Garrison 2015-05-28 04:23:25 UTC
Created attachment 92880 [details]
Patch to change assertion to warning
Comment 2 Florian Krohm 2015-07-05 22:10:24 UTC
Is there a corresponding LLVM bug? Surely, a negative line number does not sound right. Or does LLVM use negative line numbers on purpose to refer to special source locations such as builtin macros or the command line?
Comment 3 Julian Seward 2015-08-14 09:03:12 UTC
Committed, r15544.  Thanks for the patch.
Comment 4 Tim Besard 2016-02-01 15:09:52 UTC
Created attachment 96955 [details]
Remove other lineno>=0 assertion.

Similar to the original report, I've also been running into a negative lineno assertion, using valgrind from SVN trunk with Julia using LLVM 3.7. I assume the remaining `lineno >= 0` assertion (for inlined calls) needs to be axed as well? Attached is a small patch.
Comment 5 Philippe Waroquiers 2016-02-03 22:14:08 UTC
Transformed the other assert for negative line number in a complain once
+ refactorisation of the checking  committed in revision 15780.

Thanks for the patch