bug#79483: Segmentation fault: set-car! in compiled code
Tomas Volf <[email protected]> Mon, 22 Sep 2025 21:27:54 +0200
| Newsgroups | gmane.lisp.guile.bugs |
|---|---|
| Message-ID | <[email protected]> |
--=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable <[email protected]> writes: > On Mon, Sep 22, 2025 at 12:50:57AM +0300, var-vniiaes--- via Bug reports = for GUILE, GNU's Ubiquitous Extension Language wrote: >>=20 >> Hello, >> =C2=A0 >> Execution of =C2=A0 (set-car! '(0) 1) =C2=A0 *in compiled code* =C2=A0le= ads to segfault: > > First of all: you shouldn't be doing that :) > > You are mutating a constant. I don't know what the Scheme specification s= ays > to it (if at all). =2D-8<---------------cut here---------------start------------->8--- As noted in section 3.4, it is an error to attempt to alter a constant (i.e. the value of a literal expression) using a mutation procedure like set-car! or string-set! =2D-8<---------------cut here---------------end--------------->8--- > The other question is whether Guile should/could catch that and signal an > error instead. I believe it should not. Memory-safe languages (and, Guile is supposed to be one) should never segfault but instead terminate with a sensible error. I realize that 1.3.2 allows to "fail catastrophically", which segfault probably qualifies as, but I believe we should do better. Tomas =2D-=20 There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors. --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJCBAEBCgAsFiEEt4NJs4wUfTYpiGikL7/ufbZ/wakFAmjRozsOHH5Ad29sZnNk ZW4uY3oACgkQL7/ufbZ/walUYg/+IAbVGnqnX18kOrVICsHLzG+VbJuASa3nAxAf v+FMQp6a/010zoZZILJRSQrj0vrd2vuvSZmTSDhCnNJ4C3uzkiVDXNVLh3p2PVjY tWnQ/pknwdHB/jlFnplFy66+tUoqu8vDLaYfivjdtbGNsTZjIb3g0cwC3D26PI16 RFWBSQyG4vJs8K7y2gHBlPCnNX6Fl8gyFeeZiiFUn1h5UCzvutRvV4xxcrY2Js3X 9XrM0Id+qWVq+QT4DIVbKYkClFiTHSTZpkYPBqwC2wpEUsvhOMssA9Te8730OsaK wICyQoSflkAmOAF6/VSqQefMCuhkPEGMaOGj8c3kQU0T/ccnVGfPblIfv8Bs+Qhc /yhtdvAdilwpS+IM5f8M5QhKTVenHrYCtXXGHUejK5kdPX9nUON1+hZQcWu4FI5g DEBk6jMqYqu8nwP2TX2pVA58l8TAklaaRhXjDndIqqaaq4D6caZEjkhRzc6KRn1P lWTXhoDbMIXCTFtPFqquUmStm9PhzZ82MKWs69NMzkazKCFmlNVsIE0+seTtwzEp C3TqTxAkvJNFdVNJ1Pjlh8/91P7dEt5nKX+/EsK1zQGwZG6nGnIyPCllid9s5R/X xjbHkKO3UhCtgjI/y4pPYEvyBoqSiduYpTwXOLF+2WY69L8+zs/iOxnpQvQSmKLi 3ojsEbs= =PXfB -----END PGP SIGNATURE----- --=-=-=--