Bug 335353 - expected output of exp-sgcheck/tests/hackedbz2 mismatch with gcc 4.8.1
Summary: expected output of exp-sgcheck/tests/hackedbz2 mismatch with gcc 4.8.1
Status: RESOLVED UNMAINTAINED
Alias: None
Product: valgrind
Classification: Developer tools
Component: sgcheck (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR minor
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-26 07:52 UTC by Ivo Raisr
Modified: 2022-09-29 15:12 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
patch (2.60 KB, patch)
2014-06-18 13:52 UTC, Ivo Raisr
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ivo Raisr 2014-05-26 07:52:53 UTC
When test case exp-sgcheck/tests/hackedbz2 is compiled with gcc 4.8.1
it produces the following stack trace of the reported sgcheck error:

at 0x........: add_to_myprintf_buf (hackedbz2.c:1006)
by 0x........: vex_printf (hackedbz2.c:1155)
by 0x........: BZ2_compressBlock (hackedbz2.c:4039)
by 0x........: handle_compress (hackedbz2.c:4761)
by 0x........: BZ2_bzCompress (hackedbz2.c:4831)
by 0x........: BZ2_bzBuffToBuffCompress (hackedbz2.c:5638)
by 0x........: main (hackedbz2.c:6484)

The rest of information in reported sgcheck error is correct.

With gcc 4.7 or older, the stack trace matches that in existing file
hackedbz2.stderr.exp-glibc28-amd64.
The difference is that the first function "vex_strlen" is not reported:
-   at 0x........: vex_strlen (hackedbz2.c:1006)
-   by 0x........: add_to_myprintf_buf (hackedbz2.c:1284)
+   at 0x........: add_to_myprintf_buf (hackedbz2.c:1006)

The culprit here is gcc 4.8 which optimizes away the call to vex_strlen. This can be simply seen
in 'nm hackedbz2 | grep vex_strlen' which produces empty output.
When compiling with '-fno-inline-functions-called-once', vex_strlen is not inlined.
But in that case there are more stack frames in the produced stack trace:

    at 0x........: vex_strlen (hackedbz2.c:1006)
    by 0x........: add_to_myprintf_buf (hackedbz2.c:1284)
-   by 0x........: vex_printf (hackedbz2.c:1155)
+   by 0x........: vprintf_wrk (hackedbz2.c:1155)
+   by 0x........: vex_printf (hackedbz2.c:1300)
    by 0x........: BZ2_compressBlock (hackedbz2.c:4039)
    by 0x........: handle_compress (hackedbz2.c:4761)
    by 0x........: BZ2_bzCompress (hackedbz2.c:4831)
    by 0x........: BZ2_bzBuffToBuffCompress (hackedbz2.c:5638)
    by 0x........: main (hackedbz2.c:6484)

At this point I am unsure whether the correct fix would be:
- compile hackedbz2 with '-fno-inline-functions-called-once' and fix the expected output
- supply another expected output for gcc48
Comment 1 Matthias Schwarzott 2014-06-17 08:09:14 UTC
Now inline support is commited, it is also possible to add the option "--read-inline-info=yes" and adjust stderr.exp for all.
Comment 2 Ivo Raisr 2014-06-18 13:52:26 UTC
Created attachment 87260 [details]
patch
Comment 3 Ivo Raisr 2014-06-18 13:52:56 UTC
The proposed patch implements Matthias's suggestion.
Comment 4 Paul Floyd 2020-10-28 11:11:56 UTC
On second thoughts, this doesn't seem sgcheck-specific.
Comment 5 Paul Floyd 2022-09-29 15:12:19 UTC
exp-sgcheck has been removed.