If it's one of those two it's not fully undefined behavior it's just implementation defined. UB can do anything.