How pathological can a convex function be? Let $f : \mathbb R \to \mathbb R$ be convex. How weird can $f$ be? I know $f$ can easily be non-differentiable at finitely many points, for example $f(x) = \sum_{i=1}^n | x - c_i|$. Can it be non-differentiable at infinitely many points? Or on a set of positive measure?
My motivation for this is that when I picture an arbitrary convex function I tend to think of very regular ones like $f(x) = x^2$ but I want to make sure that I'm not building my intuition on examples that aren't rich enough.
 A: According to Wikipedia (point 2.), it can at most be non-differentiable at a countable number of points.
A: Pathological cases are not restricted to non-differentiability. Actually, a convex function need not even be continuous. A convex function on a closed domain may be discontinuous at the boundary. For example $f : [0,1] \rightarrow \mathbb{R}$:
$$f (x) =
\begin{cases}
x^2 & \text{if $x\in (0,1)$}\\
5 & \text{otherwise}
\end{cases}
$$
is convex in its domain.
A: You can get non-differentiability at a countable infinite set
by considering
$$\sum_{n=1}^\infty a_n|x-c_n|$$
where $a_n>0$ and $(a_n)$ goes to zero rapidly.
A: You can get another one with discontinuities at a dense set of points by integrating the inverse of Cantor's function. (Yes, it's not injective so it doesn't really have an inverse, but there are only countably many points in the Cantor function's range where the inverse isn't defined, so you can define the value of the inverse as whatever there.)
A: Others have provided examples in which the functions have countable sets of points at which $f$ is nondifferentiable. However, the answer to the question on whether this set of nondifferentiable points has measure zero is affirmative. This is even true for convex functions $f:\mathbb{R}^n\to \mathbb{R}$ and is just a consequence of Rademacher's theorem plus the fact that continuous convex functions in normed spaces are locally Lipschitz continuous. 
Here are the details:
Let  $f:\mathbb{R}^n\to \mathbb{R}$ be convex, and let $\{x_n\}$ be a enumeration of the elements of $\mathbb{R}^n$ with rational coordinates. It is easy to see that this set is dense in $\mathbb{R}^n.$ For each $x \in \mathbb{R}^n,$ define 
$$\epsilon(x)= \sup\{\epsilon>0: f \textrm{ is locally Lipschitz on the ball }B(x,\epsilon) \}.$$ Since convex functions are locally Lipschitz continuous, we have that $\epsilon(x)$ is well defined and positive. Now it is easy to prove that $$\mathbb{R}^n= \bigcup_{n\in \mathbb{N}} B(x_n, \epsilon(x_n)).$$ Let $ND$ be the set of points at which $f$ is nondifferentiable. Applying Rademacher's theorem on each $B(x_n, \epsilon(x_n))$ we find that the set $ND\cap B(x_n, \epsilon(x_n))$ has measure zero. Therefore 
$$\mu(ND)\leq \sum_{n=1}^\infty \mu(ND\cap B(x_n, \epsilon(x_n)))=0,$$ as desired.
Hope this helps
A: The set of points with non-differentiability can be dense in the support e.g for $x\in[-1,1]$ take
$$x\mapsto\sum_{i=0}^\infty\sum_{j=0}^{2^i-1}4^{-i}|2^{1-i}j+2^{-i}-1-x|$$
