Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

herbgrind crashes while running #27

Closed
sangeeta0201 opened this issue Jun 27, 2018 · 4 comments
Closed

herbgrind crashes while running #27

sangeeta0201 opened this issue Jun 27, 2018 · 4 comments

Comments

@sangeeta0201
Copy link

sangeeta0201 commented Jun 27, 2018

Hi,

Most of the time herbgrind crashes with this error

Herbgrind: instrument/floattypes.c:1264 (typeMeet): Assertion 'type2 == Vt_Unknown || type2 == Vt_NonFloat || type2 == Vt_SingleOrNonFloat' failed.
Herbgrind: Cannot meet types Vt_NonFloat and Vt_Double!

host stacktrace:
==29117==    at 0x380715B8: show_sched_status_wrk (m_libcassert.c:343)
==29117==    by 0x380716D4: report_and_quit (m_libcassert.c:415)
==29117==    by 0x38071861: vgPlain_assert_fail (m_libcassert.c:481)
==29117==    by 0x3806C2A3: typeMeet (floattypes.c:1262)
==29117==    by 0x3806C519: refineTempBlockType (floattypes.c:111)
==29117==    by 0x3806D325: inferTypes (floattypes.c:126)
==29117==    by 0x38063AFC: hg_instrument (instrument.c:63)
==29117==    by 0x3808C8CF: tool_instrument_then_gdbserver_if_needed (m_translate.c:238)
==29117==    by 0x38137C4C: LibVEX_Translate (main_main.c:934)
==29117==    by 0x3808F1A5: vgPlain_translate (m_translate.c:1765)
==29117==    by 0x380BFF5B: handle_chain_me (scheduler.c:1076)
==29117==    by 0x380C1ACF: vgPlain_scheduler (scheduler.c:1420)
==29117==    by 0x380D0EC6: run_a_thread_NORETURN (syswrap-linux.c:102)

I got this error while running spec2006 fp benchmark sphinx.
This is the configuration I have used to build this benchmark

C: CC="/usr/bin/gcc -g"
C: COBJOPT="-c -o options"
P: CPUFLAGS="-DSPEC_CPU -DNDEBUG"
P: BENCH_FLAGS="-I. -DSPEC_CPU -DHAVE_CONFIG_H -I. -Ilibutil "
P: BENCH_CFLAGS=""
O: OPTIMIZE=""
O: COPTIMIZE="-O2 -fno-strict-aliasing -ffast-math"
P: PORTABILITY="-DSPEC_CPU_LP64"
P: CPORTABILITY=""
O: EXTRA_CFLAGS=""
O: EXTRA_OPTIMIZE=""
O: EXTRA_COPTIMIZE=""
P: EXTRA_PORTABILITY=""
P: EXTRA_CPORTABILITY=""
LINK: /usr/bin/gcc -g   -O2 -fno-strict-aliasing -ffast-math  -DSPEC_CPU_LP64        <objects>   -lm        -o options
C: LD="/usr/bin/gcc -g"
O: COPTIMIZE="-O2 -fno-strict-aliasing -ffast-math"
P: PORTABILITY="-DSPEC_CPU_LP64"
C: MATH_LIBS="-lm"
C: LDOUT="-o options"

Please let me know if you have fix for this error.

@HazardousPeach
Copy link
Contributor

Hmm, looks like our type checker is seeing an inconsistency. Could be because of the use of -ffast-math? I'll try to reproduce and see if I can find the problem.

@sangeeta0201
Copy link
Author

sangeeta0201 commented Jun 28, 2018 via email

@HazardousPeach
Copy link
Contributor

As far as I can tell, at that optimization level gcc is generating calls to __log_finite, which Herbgrind is failing to intercept for some reason. This causes the instrumentation to dive into libm internals, and see an arithmetic bit shift being run on a floating point value. This triggers an assert in the type-checker. I'll need to fix the interception mechanism to properly intercept __log_finite so that we never descend that far into libm. If you want a temporary fix, you can go into src/instrument/instrument-op.c and uncomment lines 314-316. This will treat bit shifts as "special" operations that are allowed to take floats as input, so that Herbgrind won't complain when you descend into libm. Unfortunately, this will cause the real shadow values to be lost in the libm call (probably), so correctness will be compromised for those values.

@HazardousPeach
Copy link
Contributor

This has been fixed in PR #30

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants