From bf29b231782c4f6533dcf65cec243e0d72ec8e2e Mon Sep 17 00:00:00 2001
From: Richard Henderson <rth@redhat.com>
Date: Mon, 7 Jun 1999 10:23:47 +0000
Subject: [PATCH]         * expr.h (struct expressionS): Revert last change;
 widen X_op.         * config/tc-alpha.c (md_begin): Check the field is wide
 enough.

---
 gas/ChangeLog         |  5 +++++
 gas/config/tc-alpha.c | 12 ++++++++++--
 gas/expr.h            | 10 ++++++++--
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/gas/ChangeLog b/gas/ChangeLog
index d14befe3760..48c2228776f 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,8 @@
+Mon Jun  7 10:22:16 1999  Richard Henderson  <rth@cygnus.com>
+
+	* expr.h (struct expressionS): Revert last change; widen X_op.
+	* config/tc-alpha.c (md_begin): Check the field is wide enough.
+
 Mon Jun  7 11:25:16 1999  Andreas Schwab  <schwab@issan.cs.uni-dortmund.de>
 
 	* Makefile.am (TARGET_CPU_CFILES): Add config/tc-fr30.c.
diff --git a/gas/config/tc-alpha.c b/gas/config/tc-alpha.c
index 791f15daa08..e55a9bcdbde 100644
--- a/gas/config/tc-alpha.c
+++ b/gas/config/tc-alpha.c
@@ -96,8 +96,9 @@ struct alpha_macro
 /* Two extra symbols we want to see in our input.  This is a blatent
    misuse of the expressionS.X_op field.  */
 
-#define O_pregister	(O_max+1)	/* O_register, but in parentheses */
-#define O_cpregister	(O_pregister+1)	/* + a leading comma */
+#define O_pregister  ((operatorT) (O_max+1)) /* O_register, in parentheses */
+#define O_cpregister ((operatorT) (O_pregister+1)) /* + a leading comma */
+#define O_alpha_max  ((operatorT) (O_cpregister+1))
 
 /* Macros for extracting the type and number of encoded register tokens */
 
@@ -709,6 +710,13 @@ md_begin ()
 {
   unsigned int i;
 
+  /* Verify that X_op field is wide enough.  */
+  {
+    expressionS e;
+    e.X_op = O_alpha_max;
+    assert (e.X_op == O_alpha_max);
+  }
+
   /* Create the opcode hash table */
 
   alpha_opcode_hash = hash_new ();
diff --git a/gas/expr.h b/gas/expr.h
index 32a16619b1d..e3764092970 100644
--- a/gas/expr.h
+++ b/gas/expr.h
@@ -116,8 +116,14 @@ typedef struct expressionS
   symbolS *X_op_symbol;
   /* A number to add.  */
   offsetT X_add_number;
-  /* The type of the expression.  */
-  operatorT X_op;
+  /* The type of the expression.  We can't assume that an arbitrary
+     compiler can handle a bitfield of enum type.  FIXME: We could
+     check this using autoconf.  */
+#ifdef __GNUC__
+  operatorT X_op : 7;
+#else
+  unsigned X_op : 7;
+#endif
   /* Non-zero if X_add_number should be regarded as unsigned.  This is
      only valid for O_constant expressions.  It is only used when an
      O_constant must be extended into a bignum (i.e., it is not used