https://bugs.kde.org/show_bug.cgi?id=502729

            Bug ID: 502729
           Summary: s390x: incorrect line number for specification
                    exceptions and emulation errors
    Classification: Developer tools
           Product: valgrind
           Version: unspecified
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: jsew...@acm.org
          Reporter: flo2...@eich-krohm.de
  Target Milestone: ---

In b792917720c31c323b90c4481d520242c8690010 none/tests/s390x/srnmb.c
was added. Here is the snippet of interest.

    60     srnmb(0,001);
    61     printf("rounding mode = %u\n", get_rounding_mode());
    62  
    63     srnmb0(004);    // -> emul warning invalid rounding mode    
<--------<<
    64     printf("rounding mode = %u\n", get_rounding_mode());
    65  
    66     return 0;
    67  }

Emulation warning: unsupported action:
  The specified rounding mode is invalid.
  Continuing using 'round to nearest'. Results may differ!
   at 0x........: main (srnmb.c:64)

The line number is off by +1. Because it is on line 63 where the invalid SRNMB
insn is processed.

Next is 70932c0363bd0f71e5d48c945f012cc2e9f82bc6 with this comment:

    * `srnmb.c' relies on Valgrind's error message for a bad rounding mode to
      point to the line number where get_rounding_mode() is called, not to the
      function itself.

It changes get_rounding_mode to be a macro.

    57     srnmb(0,001);
    58     printf("rounding mode = %u\n", get_rounding_mode());
    59  
    60     srnmb0(004);    // -> emul warning invalid rounding mode   
<-------<<
    61     printf("rounding mode = %u\n", get_rounding_mode());
    62  
    63     return 0;
    64  }

Emulation warning: unsupported action:
  The specified rounding mode is invalid.
  Continuing using 'round to nearest'. Results may differ!
   at 0x........: main (srnmb.c:61)

The line numbers have changed but the complaint is still off by +1.  Line 60
would be correct.


Then in a8914e5f71fc3e624cf19f922f19fddbff5e17d3 s390_irgen_SRNMB was changed
to 
generate a specification exception for an invalid rounding mode to be
consistent with what POP
calls for.

    58     srnmb(0,001);
    59     printf("rounding mode = %u\n", get_rounding_mode());
    60  
    61     srnmb0(004);    // -> specification exception     <-----<<
    62     printf("rounding mode = %u\n", get_rounding_mode());
    63  
    64     return 0;
    65  }

vex s390->IR: specification exception: B2B8 0004
valgrind: Unrecognised instruction at address 0x.........
   at 0x........: main (srnmb.c:59)

Now the line number is off by -2. Correct would be line 61.

This behaviour is not specific to this testcase. It can be reproduced with
other insns that
cause specification exceptions.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to