diff --git a/test/test_fdopendir_nonposix.c b/test/test_fdopendir_nonposix.c
new file mode 100644
index 0000000000000000000000000000000000000000..ac43b30ca3d13fc72cb9ee468f201aff37a7d117
--- /dev/null
+++ b/test/test_fdopendir_nonposix.c
@@ -0,0 +1,25 @@
+/*
+ * Version of test_fdopendir with non-POSIX semantics (32-bit only).
+ *
+ * Attempting a 64-bit build with _NONSTD_SOURCE results in an error.
+ */
+
+#if defined(__LP64__) && __LP64__
+
+#include <libgen.h>
+#include <stdio.h>
+
+int
+main(int argc, char *argv[])
+{
+  (void) argc;
+  printf("%s is inapplicable.\n", basename(argv[0]));
+  return 0;
+}
+
+#else /* 32-bit */
+
+#define _NONSTD_SOURCE
+#include "test_fdopendir.c"
+
+#endif /* 32-bit */