Bug 348345 - Assertion fails for negative lineno
Summary: Assertion fails for negative lineno
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.10 SVN
Platform: Compiled Sources Linux
: NOR minor
Target Milestone: ---
Assignee: Julian Seward
URL: https://github.com/JuliaLang/julia/is...
Keywords:
Depends on:
Blocks:
 
Reported: 2015-05-28 04:21 UTC by Jim Garrison
Modified: 2016-02-03 22:14 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Patch to change assertion to warning (1.25 KB, patch)
2015-05-28 04:23 UTC, Jim Garrison
Details
Remove other lineno>=0 assertion. (796 bytes, patch)
2016-02-01 15:09 UTC, Tim Besard
Details

Note You need to log in before you can comment on or make changes to this bug.
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