Error when building latest 3D printer firmware

So I got a tip from someone on discord:

This is a regression issue with the extended undergoing optimizations at the PR Marlin.
I've reported it and they acknowledged it, but they haven't fixed it yet.
If I understand correctly, it depends on the optimizations that the compiler chooses.

To fix this do the following changes:
At the lcd.cpp, at line ~192 change the whole function:
static void lcd_putchar(char c, FILE *)
with:
static int lcd_putchar(char c, FILE *)
{
    lcd_write(c);
    return 0;
}

and at the lcd.h, the definition:
extern void lcd_putchar(char c, FILE *stream);
with:
extern int lcd_putchar(char c, FILE *stream);

I made the suggested edits, and the UI now displays correctly when building with platformIO.