Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/ssp PR/51893: Ngie Cooper: prevent toolchain ...



details:   https://anonhg.NetBSD.org/src/rev/81a48071cf37
branches:  trunk
changeset: 820951:81a48071cf37
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Jan 16 16:34:24 2017 +0000

description:
PR/51893: Ngie Cooper: prevent toolchain from optimizing out memset call

diffstat:

 tests/lib/libc/ssp/h_memset.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (25 lines):

diff -r 4b61c5f4ec80 -r 81a48071cf37 tests/lib/libc/ssp/h_memset.c
--- a/tests/lib/libc/ssp/h_memset.c     Mon Jan 16 16:32:13 2017 +0000
+++ b/tests/lib/libc/ssp/h_memset.c     Mon Jan 16 16:34:24 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $ */
+/* $NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include <sys/cdefs.h>
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_memset.c,v 1.1 2010/12/27 02:04:19 pgoyette Exp $");
+__RCSID("$NetBSD: h_memset.c,v 1.2 2017/01/16 16:34:24 christos Exp $");
 
 #include <stdio.h>
 #include <string.h>
@@ -41,5 +41,5 @@
        char b[10];
        size_t len =  atoi(argv[1]);
        (void)memset(b, 0, len);
-       return 0;
+       return b[0]; /* keeps optimizer from zapping the call to memset() */
 }



Home | Main Index | Thread Index | Old Index