Machine-translated by Google. Questions are authored in English.
Top

Discussion

A program whose behaviour changes when optimisation is enabled most often indicates

  • A.a defect in the optimiser that must be reported
  • B.that the program was compiled for the wrong machine
  • C.that the source language has been misunderstood
  • D.undefined behaviour in the program itself

Answer: D

Correct answer: undefined behaviour in the program itself

An optimiser is entitled to assume the program does not do anything the language leaves undefined - no signed overflow, no reading uninitialised storage, no aliasing violations. A program relying on what happened to work unoptimised has usually been depending on one of those, and the transformation has merely exposed it.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.