[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 01/02: Add test: writes to specific fields clobber reads
From: |
Andy Wingo |
Subject: |
[Guile-commits] 01/02: Add test: writes to specific fields clobber reads of whole objects |
Date: |
Wed, 20 Mar 2024 06:51:36 -0400 (EDT) |
wingo pushed a commit to branch main
in repository guile.
commit b012c80875f6ac5235bf518b594513a6031304ad
Author: Andy Wingo <wingo@pobox.com>
AuthorDate: Wed Mar 20 11:29:38 2024 +0100
Add test: writes to specific fields clobber reads of whole objects
* test-suite/tests/compiler.test ("cse auxiliary definitions"): New
test.
---
test-suite/tests/compiler.test | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/test-suite/tests/compiler.test b/test-suite/tests/compiler.test
index a018e0c41..0b47d0e32 100644
--- a/test-suite/tests/compiler.test
+++ b/test-suite/tests/compiler.test
@@ -1,5 +1,5 @@
;;;; compiler.test --- tests for the compiler -*- scheme -*-
-;;;; Copyright (C) 2008-2014, 2018, 2021-2022 Free Software Foundation, Inc.
+;;;; Copyright (C) 2008-2014, 2018, 2021-2022, 2024 Free Software Foundation,
Inc.
;;;;
;;;; This library is free software; you can redistribute it and/or
;;;; modify it under the terms of the GNU Lesser General Public
@@ -356,7 +356,14 @@
(trampoline (lambda () (test count))))
main)))
- (pass-if-equal "running test" 42 (test-proc)))
+ (pass-if-equal "running test" 42 (test-proc))
+
+ (define test2
+ (compile '(lambda (x)
+ (define pair (cons 42 69))
+ (when x (set-car! pair 100))
+ (car pair))))
+ (pass-if-equal "clobbering" 100 (test2 #t)))
(with-test-prefix "closure conversion"
(define test-proc