[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
GCC bug workaround
From: |
John Darrington |
Subject: |
GCC bug workaround |
Date: |
Sun, 31 Mar 2013 20:29:35 +0200 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
I have noticed a really wierd problem, which I think is
a bug in gcc version 4.4.5
When compiled with -O2 tests [185, 189] (the ODS reader tests) fail.
Investigation shows that the stack is corrupt on return from
the function casereader_count_cases__ and the program counter
returns to the wrong address and crashes.
It seems to be a rather wierd bug.
The following patch seems to workaround the symptoms.
diff --git a/src/data/casereader.c b/src/data/casereader.c
index c8050c6..3698201 100644
--- a/src/data/casereader.c
+++ b/src/data/casereader.c
@@ -241,6 +241,9 @@ casereader_count_cases__ (const struct casereader *reader,
{
struct casereader *clone;
casenumber n_cases;
+#if (__GNUC__ == 4 ) && (__GNUC_MINOR__ == 4)
+ volatile int x = 1; x++;
+#endif
clone = casereader_clone (reader);
n_cases = casereader_advance (clone, max_cases);
Maybe someone can check this doesn't happen with later compilers.
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.
signature.asc
Description: Digital signature
- GCC bug workaround,
John Darrington <=