From the LRM:
23.3.3.1 Port coercion A port that is declared as input (output) but used as an output (input) or inout may be coerced to inout. If not coerced to inout, a warning shall be issued.
The LRM doesn't make sense, shouldn't it be the opposite if coerced i.e simulator is changing rtl "under the hood" warning shall be issued. If not coerced to inout compilation should fail (as lint and synthesis) ?
test case : https://www.edaplayground.com/x/VdmF
The Verilog standard is incorrect and has been since IEEE 1364-1995. The problem is most simulation tools ignore port directions and no one has put in the effort to fix the LRM.