aboutsummaryrefslogtreecommitdiffstats
path: root/awk.h
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2017-04-21 11:14:26 +0300
committerArnold D. Robbins <arnold@skeeve.com>2017-04-21 11:14:26 +0300
commit631da910c29e4008f6e7094f60eb1e88a42e03b2 (patch)
treea9595fc63259db33811ff9bcd1a3d59c4b05fe85 /awk.h
parenta2af6158ff6d6b8252effccdaaf695e410fc0e49 (diff)
parent84f33c8b74c45e977ea05855f64545140dc6c2de (diff)
downloadegawk-631da910c29e4008f6e7094f60eb1e88a42e03b2.tar.gz
egawk-631da910c29e4008f6e7094f60eb1e88a42e03b2.tar.bz2
egawk-631da910c29e4008f6e7094f60eb1e88a42e03b2.zip
Merge branch 'master' into feature/api-mpfr
Diffstat (limited to 'awk.h')
-rw-r--r--awk.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/awk.h b/awk.h
index e2a400a6..2b3a0dea 100644
--- a/awk.h
+++ b/awk.h
@@ -365,21 +365,6 @@ typedef struct exp_node {
} nodep;
struct {
- // April 2017:
- // The NODE union will be the death of me yet. :-(
- //
- // On 64 bit Intel systems, at least, if compiling
- // without MPFR, the pointers need to come before the
- // the double. Otherwise things break pretty
- // badly. This doesn't happen on 32 bit compiles.
- // I saw this on GCC 5.4.0, GCC 6.3.0, PCC, TCC
- // and clang 3.8.0. It's way too much work to
- // try to figure out why. So I just put pointers,
- // then the double, then the size_t's, and then
- // the rest. Sigh.
- char *sp;
- wchar_t *wsp;
- struct exp_node *typre;
#ifdef HAVE_MPFR
union {
AWKNUM fltnum;
@@ -389,14 +374,31 @@ typedef struct exp_node {
#else
AWKNUM fltnum;
#endif
+ char *sp;
size_t slen;
- size_t wslen;
- long sref;
int idx;
+ wchar_t *wsp;
+ size_t wslen;
+ struct exp_node *typre;
} val;
} sub;
NODETYPE type;
unsigned int flags;
+ // April 2017:
+ // The NODE union will be the death of me yet. :-(
+ //
+ // On 64 bit Intel systems, at least, if compiling without MPFR,
+ // the valref (formerly) sref field needs to be at the end. In its
+ // original position it overlapped with stuff in the nodep part of
+ // the union causing things to break pretty badly. This doesn't
+ // happen on 32 bit compiles.
+ //
+ // I saw this on GCC 4.9.0, GCC 5.4.0, GCC 6.3.0, PCC, TCC and
+ // clang 3.8.0.
+ //
+ // We simply move valref out of the unions entirely to avoid future
+ // problems.
+ long valref;
/* type = Node_val */
/*
@@ -506,7 +508,6 @@ typedef struct exp_node {
*/
#define stptr sub.val.sp
#define stlen sub.val.slen
-#define valref sub.val.sref
#define stfmt sub.val.idx
#define wstptr sub.val.wsp
#define wstlen sub.val.wslen