aboutsummaryrefslogtreecommitdiff
path: root/gcc/d
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/d')
-rw-r--r--gcc/d/ChangeLog7
-rw-r--r--gcc/d/d-target.cc12
-rw-r--r--gcc/d/dmd/MERGE2
-rw-r--r--gcc/d/dmd/expression.c8
-rw-r--r--gcc/d/dmd/hdrgen.c14
5 files changed, 30 insertions, 13 deletions
diff --git a/gcc/d/ChangeLog b/gcc/d/ChangeLog
index 41ea48e..011b0d4 100644
--- a/gcc/d/ChangeLog
+++ b/gcc/d/ChangeLog
@@ -1,5 +1,12 @@
2019-08-20 Iain Buclaw <ibuclaw@gdcproject.org>
+ * d-target.cc: Include diagnostic.h.
+ (Target::_init): Set Tsize_t and Tptrdiff_t as D ushort and short if
+ the target pointer size is 2. Add sorry if the pointer size is not
+ either 2, 4, or 8.
+
+2019-08-20 Iain Buclaw <ibuclaw@gdcproject.org>
+
PR d/90446
* d-lang.cc (d_type_for_mode): Check for all internal __intN types.
(d_type_for_size): Likewise.
diff --git a/gcc/d/d-target.cc b/gcc/d/d-target.cc
index 8d85534..dfaf9bf 100644
--- a/gcc/d/d-target.cc
+++ b/gcc/d/d-target.cc
@@ -30,6 +30,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree.h"
#include "memmodel.h"
#include "fold-const.h"
+#include "diagnostic.h"
#include "stor-layout.h"
#include "tm.h"
#include "tm_p.h"
@@ -145,17 +146,24 @@ Target::_init (void)
Target::maxStaticDataSize = tree_to_shwi (TYPE_MAX_VALUE (integer_type_node));
/* Define what type to use for size_t, ptrdiff_t. */
- if (POINTER_SIZE == 64)
+ if (Target::ptrsize == 8)
{
global.params.isLP64 = true;
Tsize_t = Tuns64;
Tptrdiff_t = Tint64;
}
- else
+ else if (Target::ptrsize == 4)
{
Tsize_t = Tuns32;
Tptrdiff_t = Tint32;
}
+ else if (Target::ptrsize == 2)
+ {
+ Tsize_t = Tuns16;
+ Tptrdiff_t = Tint16;
+ }
+ else
+ sorry ("D does not support pointers on this target.");
Type::tsize_t = Type::basic[Tsize_t];
Type::tptrdiff_t = Type::basic[Tptrdiff_t];
diff --git a/gcc/d/dmd/MERGE b/gcc/d/dmd/MERGE
index d208aea..cb7b6bf 100644
--- a/gcc/d/dmd/MERGE
+++ b/gcc/d/dmd/MERGE
@@ -1,4 +1,4 @@
-792f0fdf249b21531dc91690024827f4f9ecbb97
+375ed10aa7eb28755f92775ca5c5399550cd100b
The first line of this file holds the git revision number of the last
merge done from the dlang/dmd repository.
diff --git a/gcc/d/dmd/expression.c b/gcc/d/dmd/expression.c
index c674392..5f1bfa8 100644
--- a/gcc/d/dmd/expression.c
+++ b/gcc/d/dmd/expression.c
@@ -2920,10 +2920,12 @@ void IntegerExp::normalize()
case Tint64: value = (d_int64) value; break;
case Tuns64: value = (d_uns64) value; break;
case Tpointer:
- if (Target::ptrsize == 4)
- value = (d_uns32) value;
- else if (Target::ptrsize == 8)
+ if (Target::ptrsize == 8)
value = (d_uns64) value;
+ else if (Target::ptrsize == 4)
+ value = (d_uns32) value;
+ else if (Target::ptrsize == 2)
+ value = (d_uns16) value;
else
assert(0);
break;
diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c
index 4eaa1ae..395aa32 100644
--- a/gcc/d/dmd/hdrgen.c
+++ b/gcc/d/dmd/hdrgen.c
@@ -2152,10 +2152,12 @@ public:
if ((sinteger_t)uval >= 0)
{
dinteger_t sizemax;
- if (Target::ptrsize == 4)
- sizemax = 0xFFFFFFFFUL;
- else if (Target::ptrsize == 8)
+ if (Target::ptrsize == 8)
sizemax = 0xFFFFFFFFFFFFFFFFULL;
+ else if (Target::ptrsize == 4)
+ sizemax = 0xFFFFFFFFUL;
+ else if (Target::ptrsize == 2)
+ sizemax = 0xFFFFUL;
else
assert(0);
if (uval <= sizemax && uval <= 0x7FFFFFFFFFFFFFFFULL)
@@ -2296,12 +2298,10 @@ public:
buf->writestring("cast(");
buf->writestring(t->toChars());
buf->writeByte(')');
- if (Target::ptrsize == 4)
- goto L3;
- else if (Target::ptrsize == 8)
+ if (Target::ptrsize == 8)
goto L4;
else
- assert(0);
+ goto L3;
default:
/* This can happen if errors, such as