From 1dfc6b1f6ed81c2b58b5beca09d7f7ab903c8ad8 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Sun, 20 Sep 2009 21:38:12 -0700 Subject: [PATCH] hmap-test: Disable tests that GCC 4.3 miscompiles. Commit ac58b3c51 "Avoid bug in GCC 4.3 in hmap-test." attempted to work around a bug in GCC 4.3 that was causing test failures in hmap-test. Unfortunately, the problem has started resurfacing again, probably due to changes elsewhere, so this commit simply disables the tests in question when PSPP is built with GCC 4.3. --- tests/libpspp/hmap-test.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/tests/libpspp/hmap-test.c b/tests/libpspp/hmap-test.c index e59ea464..4e072c94 100644 --- a/tests/libpspp/hmap-test.c +++ b/tests/libpspp/hmap-test.c @@ -1,5 +1,5 @@ /* PSPP - a program for statistical analysis. - Copyright (C) 2007, 2008 Free Software Foundation, Inc. + Copyright (C) 2007, 2008, 2009 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -21,13 +21,10 @@ "valgrind --leak-check=yes --show-reachable=yes" should give a clean report. */ -/* Warning: - - GCC 4.3 will miscompile this test program, specifically - test_moved(), given small changes. This is a bug in GCC - triggered by the test program, not by the library under test, - so you may safely ignore it. To avoid miscompilation, compile - this file with GCC 4.2 or earlier or GCC 4.4 or later. +/* GCC 4.3 miscompiles some of the tests below, so we do not run + these tests on GCC 4.3. This is a bug in GCC 4.3 triggered by + the test program, not a bug in the library under test. GCC + 4.2 or earlier and GCC 4.4 or later do not have this bug. Here is a minimal test program that demonstrates the same or a similar bug in GCC 4.3: @@ -741,6 +738,10 @@ test_moved (int max_elems, hash_function *hash) struct hmap hmap; int i, j; +#if __GNUC__ == 4 && __GNUC_MINOR__ == 3 + return; +#endif /* GCC 4.3 */ + hmap_init (&hmap); e[0] = xnmalloc (max_elems, sizeof *e[0]); e[1] = xnmalloc (max_elems, sizeof *e[1]); @@ -876,6 +877,10 @@ test_swap (int max_elems, hash_function *hash) struct hmap *working, *empty; int i; +#if __GNUC__ == 4 && __GNUC_MINOR__ == 3 + return; +#endif /* GCC 4.3 */ + hmap_init (&a); hmap_init (&b); working = &a; -- 2.30.2