I’m still not sure if you missed to provide more details in this pos.
To answer your question directly: No, STM32G4 COMP external outputs cannot internally drive UART RX on the same pin just because the two functions overlap there; you must use another routing method, typically an external wire. So, IN/OUT pin definitions do not create an internal hardware route by themselves
To give better visibility on the answered topics, please click on "Best answer" on the reply which solved your issue or answered your question.Best regards,FBL