bincount of empty array raises
Running
`jnp.bincount(jnp.int32([]))`
raises
`ValueError: zero-size array to reduction operation max which has no identity`

In contrast, `np.bincount([])` produces `array([], dtype=int64)`
diff --git a/jax/_src/numpy/lax_numpy.py b/jax/_src/numpy/lax_numpy.py
index 4332d6690..d22465799 100644
--- a/jax/_src/numpy/lax_numpy.py
+++ b/jax/_src/numpy/lax_numpy.py
@@ -1659,7 +1659,7 @@ def bincount(x, weights=None, minlength=0, *, length=None):
     x = core.concrete_or_error(asarray, x,
       "The error occured because of argument 'x' of jnp.bincount. "
       "To avoid this error, pass a static `length` argument.")
-    length = max(x) + 1
+    length = max(x, initial=-1) + 1
   length = _max(length, minlength)
   if ndim(x) != 1:
     raise ValueError("only 1-dimensional input supported.")
diff --git a/tests/lax_numpy_test.py b/tests/lax_numpy_test.py
index f42191ba9..a831c2ec1 100644
--- a/tests/lax_numpy_test.py
+++ b/tests/lax_numpy_test.py
@@ -4001,7 +4001,7 @@ class LaxBackedNumpyTests(jtu.JaxTestCase):
       "weights": weights,
       "minlength": minlength,
       "length": length}
-    for shape in [(5,), (10,)]
+    for shape in [(0,), (5,), (10,)]
     for dtype in int_dtypes
     for weights in [True, False]
     for minlength in [0, 20]
['jax/_src/numpy/lax_numpy.py', 'tests/lax_numpy_test.py']