I'm quite sure that what I'm going to write is true. But I need a confirmation. A proof is even better for me.
Consider a function $f \in \mathcal{C}^2([a,b])$. Consider also the following set: $$S = \{a\} \cup \{b\} \cup\{x \in [a,b] : f'(x) = 0\}. $$ Then, the absolute maximum $x_M$ and the absolute minimum $x_m$ of the function $f$ on the set $[a,b]$ both belong to the set S.
For the Weierstrass theorem, I know that both $x_M$ and $x_m$ are in the set $[a, b]$. For this part, I need that the function is just continuous (i.e. $f \in \mathcal{C}^0([a, b])$).
Moreover, the smoothness assures that stationary points "behave well" (i.e., we can establish if they are local maxima or minima) and hence they are parts of the "candidate" list, as well as the border.
It's true and this property holds as soon as $f$ is continuous in $[a,b]$ and differentiable in $(a,b)$. Then, an absolute maximum point $x_M$ and an absolute minimum point $x_m$ of the function $f$ on the set $[a,b]$ both belong to the set $$S = \{a\} \cup \{b\} \cup\{x \in (a,b) : f'(x) = 0\}. $$ Recall that by Fermat's Theorem, if a point $x_0\in(a,b)$ is a local maximum or a local minimum then $f'(x_0)=0$.