summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormiod <miod@openbsd.org>2003-08-08 07:29:25 +0000
committermiod <miod@openbsd.org>2003-08-08 07:29:25 +0000
commit761fc66fc8c39d35bba8700ec73fc521074635d7 (patch)
tree3604a3b1ccb196bf01582cac12ca6303b2a0a4f2
parentifdef some debugging crap (diff)
downloadwireguard-openbsd-761fc66fc8c39d35bba8700ec73fc521074635d7.tar.xz
wireguard-openbsd-761fc66fc8c39d35bba8700ec73fc521074635d7.zip
On some architectures, being too optimistic in preserve_subexpressions_p(),
for example when -fexpensive-optimizations is used, sometimes causes incorrect code sequences to be generated. As -fexpensive-optimizations is implied by -O2, this means we are potentially affected by this in numerous places... so add a specific workaround to nullify expensizve-optimizations in preserve_subexpressions_p() on a known-to-be-affected basis. So far, only alpha, powerpc, m88k, sparc and sparc64 are affected. Problem tracked down by henning@ - analysis by etoh@ and I - ugly workaround by me - ok deraadt@
-rw-r--r--gnu/egcs/gcc/config/alpha/openbsd.h2
-rw-r--r--gnu/egcs/gcc/config/m88k/openbsd.h3
-rw-r--r--gnu/egcs/gcc/config/rs6000/openbsd.h3
-rw-r--r--gnu/egcs/gcc/config/sparc/openbsd.h2
-rw-r--r--gnu/egcs/gcc/config/sparc/openbsd64.h2
-rw-r--r--gnu/egcs/gcc/stmt.c2
6 files changed, 13 insertions, 1 deletions
diff --git a/gnu/egcs/gcc/config/alpha/openbsd.h b/gnu/egcs/gcc/config/alpha/openbsd.h
index d9b7696209b..36e1a020693 100644
--- a/gnu/egcs/gcc/config/alpha/openbsd.h
+++ b/gnu/egcs/gcc/config/alpha/openbsd.h
@@ -90,3 +90,5 @@ Boston, MA 02111-1307, USA. */
assemble_name (FILE, LO); \
} while (0)
+/* problems occur if we're too liberal in preserve_subexpressions_p */
+#define BROKEN_PRESERVE_SUBEXPRESSIONS_P
diff --git a/gnu/egcs/gcc/config/m88k/openbsd.h b/gnu/egcs/gcc/config/m88k/openbsd.h
index 9c195b18f6a..87e6e9ca6ce 100644
--- a/gnu/egcs/gcc/config/m88k/openbsd.h
+++ b/gnu/egcs/gcc/config/m88k/openbsd.h
@@ -67,3 +67,6 @@ Boston, MA 02111-1307, USA. */
/* Every structure or union's size must be a multiple of 2 bytes. */
#undef STRUCTURE_SIZE_BOUNDARY
#define STRUCTURE_SIZE_BOUNDARY 16
+
+/* problems occur if we're too liberal in preserve_subexpressions_p */
+#define BROKEN_PRESERVE_SUBEXPRESSIONS_P
diff --git a/gnu/egcs/gcc/config/rs6000/openbsd.h b/gnu/egcs/gcc/config/rs6000/openbsd.h
index ec34255ab8e..6f47b793190 100644
--- a/gnu/egcs/gcc/config/rs6000/openbsd.h
+++ b/gnu/egcs/gcc/config/rs6000/openbsd.h
@@ -88,4 +88,5 @@ Boston, MA 02111-1307, USA. */
default to using nm. */
#undef OBJECT_FORMAT_COFF
-
+/* problems occur if we're too liberal in preserve_subexpressions_p */
+#define BROKEN_PRESERVE_SUBEXPRESSIONS_P
diff --git a/gnu/egcs/gcc/config/sparc/openbsd.h b/gnu/egcs/gcc/config/sparc/openbsd.h
index 5cb2ab90018..a13f03d54d0 100644
--- a/gnu/egcs/gcc/config/sparc/openbsd.h
+++ b/gnu/egcs/gcc/config/sparc/openbsd.h
@@ -65,3 +65,5 @@ Boston, MA 02111-1307, USA. */
#undef DEFAULT_PCC_STRUCT_RETURN
#define DEFAULT_PCC_STRUCT_RETURN 0
+/* problems occur if we're too liberal in preserve_subexpressions_p */
+#define BROKEN_PRESERVE_SUBEXPRESSIONS_P
diff --git a/gnu/egcs/gcc/config/sparc/openbsd64.h b/gnu/egcs/gcc/config/sparc/openbsd64.h
index cba0919547f..4a4d9a77f59 100644
--- a/gnu/egcs/gcc/config/sparc/openbsd64.h
+++ b/gnu/egcs/gcc/config/sparc/openbsd64.h
@@ -115,3 +115,5 @@ Boston, MA 02111-1307, USA. */
fprintf ((FILE), "\n"); \
} while (0)
+/* problems occur if we're too liberal in preserve_subexpressions_p */
+#define BROKEN_PRESERVE_SUBEXPRESSIONS_P
diff --git a/gnu/egcs/gcc/stmt.c b/gnu/egcs/gcc/stmt.c
index 6ca6197bc58..7f8a571c4d1 100644
--- a/gnu/egcs/gcc/stmt.c
+++ b/gnu/egcs/gcc/stmt.c
@@ -2437,8 +2437,10 @@ preserve_subexpressions_p ()
{
rtx insn;
+#ifndef BROKEN_PRESERVE_SUBEXPRESSIONS_P
if (flag_expensive_optimizations)
return 1;
+#endif
if (optimize == 0 || loop_stack == 0)
return 0;