diff --git a/gcc/d/dmd/dinterpret.c b/gcc/d/dmd/dinterpret.c
index 9e74a0dbf1f11ea21eb8384ead7d28e2c894cb1d..5e71f3b24a1891b454ccdb349c49d349f6fe9375 100644
--- a/gcc/d/dmd/dinterpret.c
+++ b/gcc/d/dmd/dinterpret.c
@@ -6881,7 +6881,7 @@ Expression *evaluateIfBuiltin(UnionExp *pue, InterState *istate, Loc loc,
         const char *id = fd->ident->toChars();
         size_t idlen = strlen(id);
         if (nargs == 2 && (idlen == 10 || idlen == 11) &&
-            startswith (id, "_aApply"))
+            !strncmp(id, "_aApply", 7))
         {
             // Functions from aApply.d and aApplyR.d in the runtime
             bool rvs = (idlen == 11);   // true if foreach_reverse
diff --git a/gcc/d/dmd/dmangle.c b/gcc/d/dmd/dmangle.c
index f112243cf5f06718533187e3ca7e6262048a6f1e..83f4c18bee835ea87c68fb644c5e172734ba212f 100644
--- a/gcc/d/dmd/dmangle.c
+++ b/gcc/d/dmd/dmangle.c
@@ -673,7 +673,7 @@ public:
                 cd == ClassDeclaration::object ||
                 cd == Type::typeinfoclass ||
                 cd == Module::moduleinfo ||
-                startswith (cd->ident->toChars(), "TypeInfo_"))
+                strncmp(cd->ident->toChars(), "TypeInfo_", 9) == 0)
             {
                 // Don't mangle parent
                 ad->parent = NULL;
diff --git a/gcc/d/dmd/hdrgen.c b/gcc/d/dmd/hdrgen.c
index e72273b2dbdcf6d4ceda74df917d5c404c97678e..9397b1e8abd8acf9f208733052f1994cedd1b611 100644
--- a/gcc/d/dmd/hdrgen.c
+++ b/gcc/d/dmd/hdrgen.c
@@ -3212,7 +3212,7 @@ public:
         }
         else if (p->type->ty == Tident &&
                  strlen(((TypeIdentifier *)p->type)->ident->toChars()) > 3 &&
-                 startswith (((TypeIdentifier *)p->type)->ident->toChars(), "__T"))
+                 strncmp(((TypeIdentifier *)p->type)->ident->toChars(), "__T", 3) == 0)
         {
             // print parameter name, instead of undetermined type parameter
             buf->writestring(p->ident->toChars());
diff --git a/gcc/d/dmd/identifier.c b/gcc/d/dmd/identifier.c
index dd2c58fd657cc810e1610eac119e0357c637f0b8..197d288e5323a7270c63f952823df05a21989014 100644
--- a/gcc/d/dmd/identifier.c
+++ b/gcc/d/dmd/identifier.c
@@ -73,11 +73,11 @@ const char *Identifier::toHChars2()
     {   p = toChars();
         if (*p == '_')
         {
-            if (startswith(p, "_staticCtor"))
+            if (strncmp(p, "_staticCtor", 11) == 0)
                 p = "static this";
-            else if (startswith(p, "_staticDtor"))
+            else if (strncmp(p, "_staticDtor", 11) == 0)
                 p = "static ~this";
-            else if (startswith(p, "__invariant"))
+            else if (strncmp(p, "__invariant", 11) == 0)
                 p = "invariant";
         }
     }