Yes, but a compiler is not a program to solve the halting problem: it's primary purpose is to generate object code that performs the algorithm described by the source code. Even if the compiler can detect whether certain programs terminate, it still must also generate correct code. If it generates bad code then it is broken even if it correctly identifies the program as terminating or non-terminating.
-- Shmuel (Seymour J.) Metz http://mason.gmu.edu/~smetz3 ________________________________________ From: IBM Mainframe Assembler List [[email protected]] on behalf of Martin Ward [[email protected]] Sent: Monday, November 15, 2021 12:43 PM To: [email protected] Subject: Re: Curious compiler optimization On 15/11/2021 17:38, Seymour J Metz wrote: > A non-terminating program can do useful work as it is running, and > replacing it with a single instruction loop would not be a correct > compilation. A non-terminating and non-interacting program is what the Halting Problem aims to detect. -- Martin Dr Martin Ward | Email: [email protected] | http://secure-web.cisco.com/1RHmSaSvuUziZMwH5Xu2QObzvimuYtCelJviu5BJwswSSJT9Mploh632pZHAvkH2GD5M42HB3s0kD63YF7ZshIzN8wtMRIp5BJXSQ9b5Vt8Wektq_3nSGpLe1z1YdICdfJXQtr7KpxK2rcK-64PG9eoF71sWrgJA3Z2qEhfyq8FmbDlRLALlp_NiiCO56J1fOyUDKZZ4SWYgXKbJuIhYszp86cJPKW-koPaeLVe1wlS5cR-1_SVJnYPamryGV_rg1ZD4E8JfbC_k2fFp-HKteedXpwcJync5d1h-wQ6H2EnzqDhlAJ3A3uhyfU3k4tnqp0aKer-zMdAPvvvr8VRBhbR4rhAkPxowz4KIbTtb_wo5u-evUqqRmDy6Oi9IPZxlJJIAbmJguO8ptEGKctjDFfTGYzk0gKhDkchSrYhWQETehTH-ahHxsLkG_ZHdFE8YP/http%3A%2F%2Fwww.gkc.org.uk G.K.Chesterton site: http://secure-web.cisco.com/1BIDF363FDCJjNiIqR_C6__bKxfC_20Ye0bUqow93rn7h-BBPFRn-hcL8m3Aj-y_1CVH7EomkrCg5fE1k2NeAz3vFz2edawZoZWVtHwt5BPhNwSm4WQCBRLiew63iw8UbxFp_WCoBW_fmzqVn1Bxgjgjct48u3FVBiboGJaJJGLIEmNGIQmksWzDMLl3L_BnNVwilXQREG5zQZbMBM8D1G9cZ5UgOiCV2w6WEjazNPOofWVW45_z-OLAslhh0C2hZnssaOC0SGAuu2jHmKc2Itk7zWv3MqnH9cGxt6qytvwJyw1hwAarBo7XZslPXU58tCgPM8KaYcDKEn3d9nHYvppJRqhjWyBVrT0vLn4Sba8vXrnSYojbFCO6fGDDzvISDCXDHE6IyzH_-Kgdcn4Zktg5D_9vBnPjuShvPb6jO-LBAnj8IWhbOnZ-bFbWezQ74/http%3A%2F%2Fwww.gkc.org.uk%2Fgkc | Erdos number: 4
