TITLE: Sard's theorem and Cantor set
QUESTION [6 upvotes]: Sard's famous theorem asserts that
Theorem. The set of critical values of a smooth function from a manifold to another has Lebesgue measure $0$.
I am asking for the curiosity that is it possible to find such a function whose set of critical values is 

Cantor set or 
Any other uncountably infinite set?

REPLY [2 votes]: By a theorem of Whitney (easy in this 1-dimensional case), any compact subset K in the interval I is the set of zeroes of a
smooth (C infty) nonnegative function f. As Robert said, take a primitive F. Provided
that K has no interior point, the critical values F(K) of F are homeomorphic with K.