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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  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 ` jakub at gcc dot gnu.org
  2015-05-07  9:29 ` tetra2005 at gmail dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jakub at gcc dot gnu.org @ 2015-05-07  9:16 UTC (permalink / raw)
  To: gcc-bugs

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
At some point somebody was already removing trailing (\n|\r\n|\r) (from the
last dg-output line in the file) from various sanitizer testcases, maybe it is
time to do that again.


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  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
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: tetra2005 at gmail dot com @ 2015-05-07  9:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Yuri Gribov <tetra2005 at gmail dot com> ---
The question is what's more appropriate.  Doing this repetative work like this
demotivates folks.  But if Marek promises to never add newlines to his regexps
again we can submit another cleanup patch :)


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  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
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-07  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2015-05-07
                 CC|                            |mpolacek at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |mpolacek at gcc dot gnu.org
   Target Milestone|---                         |6.0
     Ever confirmed|0                           |1

--- Comment #3 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Oops.  Let me prepare a patch.  But I won't be able to test -- are you willing
to test it once I have something?.  If it passes both x86_64, I'll just commit
it.

This way maybe I'll remember to not add trailing (\n|\r\n|\r).


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  2015-05-07  8:57 [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board chefmax at gcc dot gnu.org
                   ` (2 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-07  9:48 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
"both x86_64 and arm"


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  2015-05-07  8:57 [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board chefmax at gcc dot gnu.org
                   ` (3 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: chefmax at gcc dot gnu.org @ 2015-05-07  9:54 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #5 from Maxim Ostapenko <chefmax at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #3)
> Oops.  Let me prepare a patch.  But I won't be able to test -- are you
> willing to test it once I have something?.  If it passes both x86_64, I'll
> just commit it.
> 
> This way maybe I'll remember to not add trailing (\n|\r\n|\r).

Sure, thank you!


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  2015-05-07  8:57 [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board chefmax at gcc dot gnu.org
                   ` (4 preceding siblings ...)
  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
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-07 14:45 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Thu May  7 14:44:26 2015
New Revision: 222878

URL: https://gcc.gnu.org/viewcvs?rev=222878&root=gcc&view=rev
Log:
        PR testsuite/66046
        * c-c++-common/ubsan/align-6.c: Don't match trailing newlines in the
        last dg-output.
        * c-c++-common/ubsan/align-7.c: Likewise.
        * c-c++-common/ubsan/bounds-8.c: Likewise.
        * c-c++-common/ubsan/float-cast-overflow-9.c: Likewise.
        * c-c++-common/ubsan/load-bool-enum.c: Likewise.
        * c-c++-common/ubsan/null-1.c: Likewise.
        * c-c++-common/ubsan/null-10.c: Likewise.
        * c-c++-common/ubsan/null-11.c: Likewise.
        * c-c++-common/ubsan/null-2.c: Likewise.
        * c-c++-common/ubsan/null-3.c: Likewise.
        * c-c++-common/ubsan/null-4.c: Likewise.
        * c-c++-common/ubsan/null-5.c: Likewise.
        * c-c++-common/ubsan/null-6.c: Likewise.
        * c-c++-common/ubsan/null-7.c: Likewise.
        * c-c++-common/ubsan/null-8.c: Likewise.
        * c-c++-common/ubsan/null-9.c: Likewise.
        * c-c++-common/ubsan/object-size-1.c: Likewise.
        * c-c++-common/ubsan/object-size-10.c: Likewise.
        * c-c++-common/ubsan/object-size-4.c: Likewise.
        * c-c++-common/ubsan/object-size-5.c: Likewise.
        * c-c++-common/ubsan/object-size-7.c: Likewise.
        * c-c++-common/ubsan/object-size-8.c: Likewise.
        * c-c++-common/ubsan/object-size-9.c: Likewise.
        * c-c++-common/ubsan/overflow-add-2.c: Likewise.
        * c-c++-common/ubsan/overflow-int128.c: Likewise.
        * c-c++-common/ubsan/overflow-mul-2.c: Likewise.
        * c-c++-common/ubsan/overflow-mul-4.c: Likewise.
        * c-c++-common/ubsan/overflow-negate-1.c: Likewise.
        * c-c++-common/ubsan/overflow-negate-3.c: Likewise.
        * c-c++-common/ubsan/overflow-sub-2.c: Likewise.
        * c-c++-common/ubsan/overflow-sub-4.c: Likewise.
        * c-c++-common/ubsan/pr59333.c: Likewise.
        * c-c++-common/ubsan/pr59667.c: Likewise.
        * c-c++-common/ubsan/pr60613-2.c: Likewise.
        * c-c++-common/ubsan/pr60636.c: Likewise.
        * c-c++-common/ubsan/pr63802.c: Likewise.
        * c-c++-common/ubsan/recovery-1.c: Likewise.
        * c-c++-common/ubsan/recovery-3.c: Likewise.
        * c-c++-common/ubsan/shift-1.c: Likewise.
        * c-c++-common/ubsan/shift-2.c: Likewise.
        * c-c++-common/ubsan/shift-4.c: Likewise.
        * c-c++-common/ubsan/shift-7.c: Likewise.
        * c-c++-common/ubsan/undefined-2.c: Likewise.
        * c-c++-common/ubsan/vla-1.c: Likewise.
        * g++.dg/ubsan/null-1.C: Likewise.
        * g++.dg/ubsan/null-3.C: Likewise.
        * g++.dg/ubsan/null-4.C: Likewise.
        * g++.dg/ubsan/vptr-8.C: Likewise.
        * g++.dg/ubsan/vptr-9.C: Likewise.
        * gcc.dg/ubsan/bounds-2.c: Likewise.
        * gcc.dg/ubsan/object-size-9.c: Likewise.

Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/ubsan/align-6.c
    trunk/gcc/testsuite/c-c++-common/ubsan/align-7.c
    trunk/gcc/testsuite/c-c++-common/ubsan/bounds-8.c
    trunk/gcc/testsuite/c-c++-common/ubsan/float-cast-overflow-9.c
    trunk/gcc/testsuite/c-c++-common/ubsan/load-bool-enum.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-1.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-10.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-11.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-3.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-5.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-6.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-7.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-8.c
    trunk/gcc/testsuite/c-c++-common/ubsan/null-9.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-1.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-10.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-5.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-7.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-8.c
    trunk/gcc/testsuite/c-c++-common/ubsan/object-size-9.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-add-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-int128.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-mul-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-mul-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-negate-1.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-negate-3.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-sub-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/overflow-sub-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/pr59333.c
    trunk/gcc/testsuite/c-c++-common/ubsan/pr59667.c
    trunk/gcc/testsuite/c-c++-common/ubsan/pr60613-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/pr60636.c
    trunk/gcc/testsuite/c-c++-common/ubsan/pr63802.c
    trunk/gcc/testsuite/c-c++-common/ubsan/recovery-1.c
    trunk/gcc/testsuite/c-c++-common/ubsan/recovery-3.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-1.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-4.c
    trunk/gcc/testsuite/c-c++-common/ubsan/shift-7.c
    trunk/gcc/testsuite/c-c++-common/ubsan/undefined-2.c
    trunk/gcc/testsuite/c-c++-common/ubsan/vla-1.c
    trunk/gcc/testsuite/g++.dg/ubsan/null-1.C
    trunk/gcc/testsuite/g++.dg/ubsan/null-3.C
    trunk/gcc/testsuite/g++.dg/ubsan/null-4.C
    trunk/gcc/testsuite/g++.dg/ubsan/vptr-8.C
    trunk/gcc/testsuite/g++.dg/ubsan/vptr-9.C
    trunk/gcc/testsuite/gcc.dg/ubsan/bounds-2.c
    trunk/gcc/testsuite/gcc.dg/ubsan/object-size-9.c


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

* [Bug testsuite/66046] UBSan output pattern tests fail on target ARM board.
  2015-05-07  8:57 [Bug testsuite/66046] New: UBSan output pattern tests fail on target ARM board chefmax at gcc dot gnu.org
                   ` (5 preceding siblings ...)
  2015-05-07 14:45 ` mpolacek at gcc dot gnu.org
@ 2015-05-07 14:47 ` mpolacek at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2015-05-07 14:47 UTC (permalink / raw)
  To: gcc-bugs

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

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #7 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Fixed for GCC 6.


^ 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).