public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board.
@ 2015-05-07  8:57 chefmax at gcc dot gnu.org
  2015-05-07  9:16 ` [Bug testsuite/66046] " jakub at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-05-07  8:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66046

            Bug ID: 66046
           Summary: UBSan output pattern tests fail on target ARM board.
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: testsuite
          Assignee: unassigned at gcc dot gnu.org
          Reporter: chefmax at gcc dot gnu.org
                CC: tetra2005 at gmail dot com
  Target Milestone: ---
              Host: x86_64-pc-linux-gnu
            Target: arm-linux-gnueabi

I see lots of output pattern test failures in UBSan testsuite running it on
target ARM board:

FAIL: c-c++-common/ubsan/object-size-1.c  -O2  output pattern test
FAIL: c-c++-common/ubsan/object-size-10.c  -O2  output pattern test
FAIL: c-c++-common/ubsan/object-size-4.c  -O2  output pattern test
FAIL: c-c++-common/ubsan/object-size-5.c  -O2  output pattern test
FAIL: c-c++-common/ubsan/overflow-negate-3.c  -O2  output pattern test
FAIL: c-c++-common/ubsan/overflow-sub-4.c  -O0  output pattern test
.................

Looking to the failing tests, I've noticed, that they all try to match the last
(\n|\r\n|\r), for example overflow-negate-3.c:

/* { dg-do run } */
/* { dg-options "-fsanitize=signed-integer-overflow" } */

#define INT_MIN (-__INT_MAX__ - 1)

int
main ()
{
  int x = INT_MIN;
  int y;
  asm ("" : "+g" (x));
  y = -(-x);
  asm ("" : "+g" (y));
  y = -(-INT_MIN);
  asm ("" : "+g" (y));
}

/* { dg-output "negation of -2147483648 cannot be represented in type
'int'\[^\n\r]*; cast to an unsigned type to negate this value to
itself\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type
'int'\[^\n\r]*; cast to an unsigned type to negate this value to
itself\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type
'int'\[^\n\r]*; cast to an unsigned type to negate this value to
itself\[^\n\r]*(\n|\r\n|\r)" } */
/* { dg-output "\[^\n\r]*negation of -2147483648 cannot be represented in type
'int'\[^\n\r]*; cast to an unsigned type to negate this value to
itself\[^\n\r]*(\n|\r\n|\r)" } */ <-- matches (\n|\r\n|\r)

But for some reasons, Dejagnu eats the last \n when running tests through ssh,
consider:

$ cat /usr/share/dejagnu/rsh.exp

proc rsh_exec { boardname program pargs inp outp } {
    global timeout
...............
     # Delete one trailing \n because that is what `exec' will do and we want
    # to behave identical to it.
    regsub "\n$" $output "" output                  <-- delete last \n here
    return [list [expr {$status != 0}] $output]
}

Although the easiest way to fix this is just deleting 'regsub "\n$" $output ""
output' line from rsh_exec, I'm not sure that modifying Dejagnu is a good idea.
Another option is to postprocess tests output in
gcc/testsuite/lib/ubsan-dg.exp, just like we do it in
gcc/testsuite/lib/asan-dg.exp:

+# Replace ${tool}_load with a wrapper so that we can symbolize the output.
+if { [info procs ${tool}_load] != [list] \
+      && [info procs saved_ubsan_${tool}_load] == [list] } {
+    rename ${tool}_load saved_ubsan_${tool}_load
+
+    proc ${tool}_load { program args } {
+       global tool
+       set result [eval [list saved_ubsan_${tool}_load $program] $args]
+       set output [lindex $result 1]
+       set result [list [lindex $result 0] "${output}\n"]
+       return $result
+    }
+}
+
#
# ubsan_finish -- called at the end of each subdir of tests
#


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-05-07 14:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-07  8:57 [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board chefmax at gcc dot gnu.org
2015-05-07  9:16 ` [Bug testsuite/66046] " jakub at gcc dot gnu.org
2015-05-07  9:29 ` tetra2005 at gmail dot com
2015-05-07  9:48 ` mpolacek at gcc dot gnu.org
2015-05-07  9:48 ` mpolacek at gcc dot gnu.org
2015-05-07  9:54 ` chefmax at gcc dot gnu.org
2015-05-07 14:45 ` mpolacek at gcc dot gnu.org
2015-05-07 14:47 ` mpolacek at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).