NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/51893: [PATCH] tests/lib/libc/ssp/h_memset: prevent toolchain from optimizing out memset call
The following reply was made to PR bin/51893; it has been noted by GNATS.
From: "Ngie Cooper (yaneurabeya)" <yaneurabeya%gmail.com@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: bin/51893: [PATCH] tests/lib/libc/ssp/h_memset: prevent toolchain
from optimizing out memset call
Date: Sun, 15 Jan 2017 13:34:53 -0800
--Apple-Mail=_4FC2B394-64E4-4066-A7B5-FBCDED173B3C
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
charset=us-ascii
Patch attached.
-Ngie
--Apple-Mail=_4FC2B394-64E4-4066-A7B5-FBCDED173B3C
Content-Disposition: attachment;
filename=h_memset-return-b_0-to-prevent-memset-optimization.patch
Content-Type: application/octet-stream;
x-unix-mode=0644;
name="h_memset-return-b_0-to-prevent-memset-optimization.patch"
Content-Transfer-Encoding: 7bit
Index: lib/libc/ssp/h_memset.c
===================================================================
RCS file: /cvsroot/src/tests/lib/libc/ssp/h_memset.c,v
retrieving revision 1.1
diff -u -r1.1 h_memset.c
--- lib/libc/ssp/h_memset.c 27 Dec 2010 02:04:19 -0000 1.1
+++ lib/libc/ssp/h_memset.c 15 Jan 2017 21:27:18 -0000
@@ -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() */
}
--Apple-Mail=_4FC2B394-64E4-4066-A7B5-FBCDED173B3C--
Home |
Main Index |
Thread Index |
Old Index