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 gcc optimizes away the side effect free c...
details: https://anonhg.NetBSD.org/src/rev/7ab56c69aa24
branches: trunk
changeset: 767598:7ab56c69aa24
user: martin <martin%NetBSD.org@localhost>
date: Sat Jul 23 22:17:43 2011 +0000
description:
gcc optimizes away the side effect free call to the "poke" function which
is supposed to smash our stack in this test case.
So: make it print out some dummy value based on the smashing changes.
diffstat:
tests/lib/libc/ssp/h_raw.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r b4f33e6d306a -r 7ab56c69aa24 tests/lib/libc/ssp/h_raw.c
--- a/tests/lib/libc/ssp/h_raw.c Sat Jul 23 21:37:28 2011 +0000
+++ b/tests/lib/libc/ssp/h_raw.c Sat Jul 23 22:17:43 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: h_raw.c,v 1.4 2011/06/15 06:09:21 plunky Exp $ */
+/* $NetBSD: h_raw.c,v 1.5 2011/07/23 22:17:43 martin Exp $ */
/*
* Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -29,8 +29,9 @@
#include <sys/cdefs.h>
__COPYRIGHT("@(#) Copyright (c) 2011\
The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: h_raw.c,v 1.4 2011/06/15 06:09:21 plunky Exp $");
+__RCSID("$NetBSD: h_raw.c,v 1.5 2011/07/23 22:17:43 martin Exp $");
+#include <stdio.h>
#include <stdlib.h>
void poke(int *, size_t);
@@ -38,7 +39,13 @@
void
poke(int *b, size_t index)
{
+ size_t i;
+ int sum = 0;
+
b[index] = 42;
+ for (i = 0; i < 10; i++)
+ sum += b[i];
+ printf("dummy value: %d\n", sum);
}
int
Home |
Main Index |
Thread Index |
Old Index