diff mbox

[committed] Avoid undefined behavior in test.

Message ID alpine.LNX.2.20.1512091842510.31970@monopod.intra.ispras.ru
State New
Headers show

Commit Message

Alexander Monakov Dec. 9, 2015, 3:48 p.m. UTC
I have committed the following testsuite patch as obvious.

The test calls a variadic function that extracts pointers with va_arg, but the
terminating NULL is passed as an int, not a pointer.  This wouldn't trip on
32-bit architectures, and even on 64-bit the test simply iterates until it
gets a NULL stack slot (in any containing frame).

Noticed while testing NVPTX with -mgomp.

2015-12-09  Alexander Monakov  <amonakov@ispras.ru>

	* gcc.c-torture/execute/980716-1.c: Avoid undefined behavior due to
	passing terminating NULL as int rather than pointer.
diff mbox

Patch

--- gcc.c-torture/execute/980716-1.c	(revision 231457)
+++ gcc.c-torture/execute/980716-1.c	(working copy)
@@ -20,7 +20,7 @@ 
 int
 main()
 {
-    stub(1, "ab", "bc", "cx", 0);
+    stub(1, "ab", "bc", "cx", (char *)0);
     exit (0);
 }