I don't know if "bug" is the right word. It seems to be an intended feature, though I'm not at all sure what HP was thinking at the time. It seems to have had something to do with backward compatibility with the 65, where programs didn't have END statements.
I found an article in the Sept-Dec 1982 issue of "HP Key Notes" (http://www.hpmuseum.net/pdf/KeyNotes_19 ... es_OCR.pdf
) called "About Program Files", and it specifically mentions how GETSUB inserts ENDs: "The GETSUB function always loads a program file into main memory after
the last program file; it never overwrites the last program even if the last program contains only the permanent .END. statement. If the user isn't aware of this behavior, the repeated use of GETSUB could clutter main memory with many solitary END statements." The word "could" in the quote is odd, though. As far as I can see, repeated GETSUBs absolutely will
leave ENDs all over the place. I can't understand why GETSUB wasn't written to check for an existing END statement before appending one.
What good could ever have come from two ENDs in a row? I await illumination from some HP guru.
FWIW, I'm not actually trying to write any apps for the 41. I'm just playing around, trying to evaluate its architecture and abilities. I've been a software developer for 30+ years, but none of them were spent programming calculators. When I retired a few years ago, I started collecting calculators and slide rules as a hobby (see https://sites.google.com/site/bobscalcu ... liderules/
). I've got a 65 (actually 2 of them) a 25, a TI 59, and some Compucorps, but the 41 is the first I've seen that sort of resembles a computer.