Bug 481131 - [PATCH] x86 regtest: fix clobber lists in generated asm statements
Summary: [PATCH] x86 regtest: fix clobber lists in generated asm statements
Status: RESOLVED FIXED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Paul Floyd
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-02-09 17:14 UTC by notasas
Modified: 2024-02-09 20:57 UTC (History)
1 user (show)

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


Attachments
patch (2.36 KB, patch)
2024-02-09 17:14 UTC, notasas
Details

Note You need to log in before you can comment on or make changes to this bug.
Description notasas 2024-02-09 17:14:14 UTC
Created attachment 165704 [details]
patch

Must add result registers also, or else code like this is generated:

      asm(
         "fsave %3\n"
         "movl %2, %%eax\n"
         "cdq\n"
         "movl %%edx, %0\n"
         "movl %%eax, %1\n"
         "frstor %3\n"
         "cld\n"
         : "=m" (result0), "=m" (result1)
         : "m" (preset0), "m" (state[0])
         : "eax"
      );

This crashes on my machine because gcc places some pointer in %%edx.
Comment 1 Paul Floyd 2024-02-09 20:57:26 UTC
Done.

commit 8b3d0828451f8e69e0eaf3807ffbe502aecda428 (HEAD -> master, origin/master, origin/HEAD, bug481131)
Author: Gra??vydas Ignotas <notasas@gmail.com>
Date:   Fri Feb 9 19:02:23 2024 +0200

    x86 regtest: fix clobber lists in generated asm statements
    
    Must add result registers also, or else code like this is generated:
    
          asm(
             "fsave %3\n"
             "movl %2, %%eax\n"
             "cdq\n"
             "movl %%edx, %0\n"
             "movl %%eax, %1\n"
             "frstor %3\n"
             "cld\n"
             : "=m" (result0), "=m" (result1)
             : "m" (preset0), "m" (state[0])
             : "eax"
          );
    
    This crashes on my machine because gcc places some pointer in %%edx.