Port 4 (and higher ports) have restrictions because of absence of port adapter. Technical reference manual section 7.10 talks about it -
SAR ADC can connect to Port 0 to Port 3. In the case of Port 2, it uses only SARMUX bus whereas in the case of other port pins, AMUX bus is also used, in addition, for routing.
If you wish to use ADC, I would suggest Port 2 pins and for comparator, dedicated pins P0/P0 or P0/P0.
Thanks Rajiv, I'll lay re-lay the PCB to use P2.7 as Analog input