Google and Microsoft have added warnings to their “risk factors” for investors about potential legal and ethical problems from their artificial intelligence projects.