Bug 357037 - Line numbers are occasionally displayed incorrectly in intel-compiled applications
Summary: Line numbers are occasionally displayed incorrectly in intel-compiled applica...
Status: RESOLVED NOT A BUG
Alias: None
Product: valgrind
Classification: Developer tools
Component: memcheck (show other bugs)
Version: 3.10 SVN
Platform: RedHat Enterprise Linux Linux
: NOR minor
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-12-22 12:23 UTC by Tanya
Modified: 2016-01-12 15:49 UTC (History)
1 user (show)

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


Attachments
a reproducer application (133 bytes, text/x-csrc)
2015-12-22 12:23 UTC, Tanya
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Tanya 2015-12-22 12:23:22 UTC
Created attachment 96260 [details]
a reproducer application

If an application is compiled with Intel compiler, line numbers are displayed incorrectly if the line contains line break.
A reproducer application (line_numbers.c) is attached.

Steps to build and run the test:
    icc -O0 -g line_numbers.c -o line_numbers_icc
    valgrind -q ./line_numbers_icc

Expected result (reported for gcc-compiled application):
==xxxx== Invalid write of size 4
==xxxx==    at 0xxxxxxx: main (line_numbers.c:8)
==xxxx==  Address 0xxxxxxxx is 4 bytes inside a block of size 40 free'd
==xxxx==    at 0xxxxxxxx: free (vg_replace_malloc.c:530)
==xxxx==    by 0xxxxxxx: main (line_numbers.c:7)
==xxxx==  Block was alloc'd at
==xxxx==    at 0xxxxxxxx: malloc (vg_replace_malloc.c:299)
==xxxx==    by 0xxxxxxx: main (line_numbers.c:5)
==xxxx==

Actual result:
==xxxx== Invalid write of size 4
==xxxx==    at 0xxxxxxx: main (line_numbers.c:8)
==xxxx==  Address 0xxxxxxxx is 4 bytes inside a block of size 40 free'd
==xxxx==    at 0xxxxxxxx: free (vg_replace_malloc.c:530)
==xxxx==    by 0xxxxxxx: main (line_numbers.c:7)
==xxxx==  Block was alloc'd at
==xxxx==    at 0xxxxxxxx: malloc (vg_replace_malloc.c:299)
==xxxx==    by 0xxxxxxx: main (line_numbers.c:7)
==xxxx==
Comment 1 Philippe Waroquiers 2015-12-30 20:54:58 UTC
It would be good to analyse the debug info generated by icc 
e.g. using objdump
and/or using gdb  e.g.  info line 5/6/7
                                and info line *0x......
and/or the valgrind gdbserver monitor command   v.info location <addr>
   (where addr is an address that should be part of the line 5)

Alternatively, it might be the unwind info that is not ok and/or the valgrind unwinder.
You might investigate that by using gdb+vgdb, and put a break at vg_replace_malloc.c:299.
You can then compare gdb unwinder (using the bt gdb command) 
with the valgrind unwinder (using monitor v.info scheduler)

All the above might give some hints about what is going wrong.
Comment 2 Tanya 2016-01-12 15:49:08 UTC
(In reply to Philippe Waroquiers from comment #1)
> It would be good to analyse the debug info generated by icc 
> e.g. using objdump
> and/or using gdb  e.g.  info line 5/6/7
>                                 and info line *0x......
> and/or the valgrind gdbserver monitor command   v.info location <addr>
>    (where addr is an address that should be part of the line 5)

Philippe Waroquiers,
Thank you very much. The debug information is generated incorrectly by compiler.