paulfloyd / freebsd_valgrind

Git repo used to Upstream the FreeBSD Port of Valgrind
GNU General Public License v2.0
15 stars 4 forks source link

memcheck/tests/fprw is failing [clang, x86] #116

Closed paulfloyd closed 4 years ago

paulfloyd commented 4 years ago

The code contains

   *dp += ( d > 0.1  ? 2.0 : 3.0 );

(dp a pointer to double, d a double, neither with initialized content).

GCC generates this after comparing

0x804870f <main+138>    jbe    0x8048719 <main+148>
0x8048711 <main+140>    fldl   0x8048820
0x8048717 <main+146>    jmp    0x804871f <main+154>
0x8048719 <main+148>    fldl   0x8048828

clang generates

0x401334 <main+116>     fnstsw %ax
0x401336 <main+118>     mov    %ah,%dl
0x401338 <main+120>     mov    %dl,%ah
0x40133a <main+122>     sahf
0x40133b <main+123>     seta   %dl
0x40133e <main+126>     movzbl %dl,%ecx
0x401341 <main+129>     fldl   0x4003d0(,%ecx,8)
0x401348 <main+136>     mov    0x20(%esp),%ecx
0x40134c <main+140>     fldl   (%ecx)

So it's comparing then saving the flag for use in calculating the offset to use to load either 2.0 or 3.0. No jumps.

OK to create a new expected.

paulfloyd commented 4 years ago

Pushed with To https://github.com/paulfloyd/freebsd_valgrind.git 29f33ed8f..6aab65414 freebsd -> freebsd