* GNU Guile 2.1.6 released (beta)
@ 2017-01-19 2:26 Andy Wingo
2017-01-20 3:01 ` Matt Wette
` (3 more replies)
0 siblings, 4 replies; 14+ messages in thread
From: Andy Wingo @ 2017-01-19 2:26 UTC (permalink / raw)
To: guile-user, guile-devel, guile-sources
We are pleased to announce GNU Guile release 2.1.6.
Guile 2.1.6 is the sixth pre-release in what will eventually become the
2.2 release series. We encourage you to test this release and provide
feedback to guile-devel@gnu.org.
This is a bug-fix release, mostly fixing bugs related to threads and
interrupts. It also includes support for fast floating-point
comparisons; special thanks to new Guile committer David Thompson for
this feature. See the full NEWS below, for details.
The Guile web page is located at http://gnu.org/software/guile/, and
among other things, it contains a copy of the Guile manual and pointers
to more resources.
Guile is an implementation of the Scheme programming language, with
support for many SRFIs, packaged for use in a wide variety of
environments. In addition to implementing the R5RS Scheme standard,
Guile includes a module system, full access to POSIX system calls,
networking support, multiple threads, dynamic linking, a foreign
function call interface, and powerful string processing.
Guile can run interactively, as a script interpreter, and as a Scheme
compiler to VM bytecode. It is also packaged as a library so that
applications can easily incorporate a complete Scheme interpreter/VM.
An application can use Guile as an extension language, a clean and
powerful configuration language, or as multi-purpose "glue" to connect
primitives provided by the application. It is easy to call Scheme code
From C code and vice versa. Applications can add new functions, data
types, control structures, and even syntax to Guile, to create a
domain-specific language tailored to the task at hand.
Guile 2.1.6 can be installed in parallel with Guile 2.0.x; see
http://www.gnu.org/software/guile/manual/html_node/Parallel-Installations.html.
A more detailed NEWS summary follows these details on how to get the
Guile sources.
Here are the compressed sources:
http://alpha.gnu.org/gnu/guile/guile-2.1.6.tar.gz (18MB)
http://alpha.gnu.org/gnu/guile/guile-2.1.6.tar.xz (11MB)
Here are the GPG detached signatures[*]:
http://alpha.gnu.org/gnu/guile/guile-2.1.6.tar.gz.sig
http://alpha.gnu.org/gnu/guile/guile-2.1.6.tar.xz.sig
Use a mirror for higher download bandwidth:
http://www.gnu.org/order/ftp.html
Here are the SHA256 checksums:
6f3f34eb2d4b2c6e458c4103e731ce51479c0a4713cf4cfcc29844ec17f0305f guile-2.1.6.tar.gz
f3c25770a34bdd4391593f793107991a57b88350f2dcb947e9924d6522595d59 guile-2.1.6.tar.xz
[*] Use a .sig file to verify that the corresponding file (without the
.sig suffix) is intact. First, be sure to download both the .sig file
and the corresponding tarball. Then, run a command like this:
gpg --verify guile-2.1.6.tar.gz.sig
If that command fails because you don't have the required public key,
then run this command to import it:
gpg --keyserver keys.gnupg.net --recv-keys FF478FB264DE32EC296725A3DDC0F5358812F8F2
and rerun the 'gpg --verify' command.
This release was bootstrapped with the following tools:
Autoconf 2.69
Automake 1.15
Libtool 2.4.6
Gnulib v0.1-800-g68b6ade
Makeinfo 6.1
Changes in 2.1.6 (changes since the 2.1.5 alpha release):
* New interfaces
** suspendable-continuation?
This predicate returns true if the delimited continuation captured by
aborting to a prompt would be able to be resumed. See "Prompt
Primitives" in the manual for more.
** scm_c_prepare_to_wait_on_fd, scm_c_prepare_to_wait_on_cond,
** scm_c_wait_finished
See "Interrupts" in the manual for more.
* Performance improvements
** Support unboxed floating-point comparisons
Thanks to David Thompson for this work.
* Incompatible changes
** Rename new array functions
See "Arrays as arrays of arrays" in the manual for more.
* Bug fixes
** `scm_gc_warn_proc' writes directly to stderr
The garbage collector sometimes has warnings to display to the user.
Before, Guile would see if the current warning port was a file port, and
in that case write the warning to that file, and otherwise default to
stderr. Now Guile just writes to stderr, fixing a bug where determining
the current warning port would allocate and thus deadlock as the GC
warnings are issued with the GC lock held.
** Fix miscompilation in significant-bits computation for loop vars
** Fix many threading bugs
** Fix macOS portability bugs
Thanks to Matt Wette!
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
@ 2017-01-20 3:01 ` Matt Wette
2017-01-20 19:01 ` GNU Guile 2.1.6 released (beta) [numbers.c] Matt Wette
2017-01-20 14:10 ` GNU Guile 2.1.6 released (beta) Matt Wette
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Matt Wette @ 2017-01-20 3:01 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 508 bytes --]
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to guile-devel@gnu.org.
Saw this one last round. Mac OS, now gcc-6.3.0:
;;; ("#i1@-0" 1.0 -0.0)
FAIL: numbers.test: string->number: valid complex number strings
I am going to see if I can generate the assembly.
Matt
[-- Attachment #2: Type: text/html, Size: 1906 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta) [numbers.c]
2017-01-20 3:01 ` Matt Wette
@ 2017-01-20 19:01 ` Matt Wette
2017-01-20 19:15 ` Amirouche
2017-01-20 20:23 ` Matt Wette
0 siblings, 2 replies; 14+ messages in thread
From: Matt Wette @ 2017-01-20 19:01 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 2296 bytes --]
> On Jan 19, 2017, at 7:01 PM, Matt Wette <matt.wette@gmail.com> wrote:
>
>
>> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com <mailto:wingo@pobox.com>> wrote:
>>
>> We are pleased to announce GNU Guile release 2.1.6.
>>
>> Guile 2.1.6 is the sixth pre-release in what will eventually become the
>> 2.2 release series. We encourage you to test this release and provide
>> feedback to guile-devel@gnu.org <mailto:guile-devel@gnu.org>.
>
> Saw this one last round. Mac OS, now gcc-6.3.0:
>
> ;;; ("#i1@-0" 1.0 -0.0)
> FAIL: numbers.test: string->number: valid complex number strings
>
> I am going to see if I can generate the assembly.
Short story: scm_c_make_polar is broken for the Mac. Guile needs to decide if it want to use __sincos() on Mac, or suppress optimization, or ...
I was able to get the above to work (guile-2.1.5) by using
SCM
+#ifdef __APPLE__
+__attribute__((optimize("O0")))
+#endif
scm_c_make_polar (double mag, double ang)
In scm_c_make_polar, “gcc -O2” turns sin(), cos() into cexp(), since cexp(i*x) = cos(x) + i*sin(x):
gcc -O0 =>
LM4339:
movq -32(%rbp), %rax
movd %rax, %xmm0
call _sin
movd %xmm0, %rax
movq %rax, -8(%rbp)
LM4340:
movq -32(%rbp), %rax
movd %rax, %xmm0
call _cos
movd %xmm0, %rax
movq %rax, -16(%rbp)
gcc -O2 =>
pxor %xmm0, %xmm0
LVL2703:
call _cexp
I wrote a little C program to show that cexp() does not preserve the zero-signed-ness:
cos,sin: +1.000000 -0.000000
__sincos: +1.000000 -0.000000
cexp: +1.000000 +0.000000
The scm_c_make_polar will use sincos() if available, but macOS does not have sincos(), it has __sincos().
#include <stdio.h>
#include <stdint.h>
#include <math.h>
#include <complex.h>
extern double z, p, n;
int main() {
double complex c;
double d, sine, cosine;
d = z*n;
printf(" cos,sin: %+f %+f\n", cos(d), sin(d));
__sincos(d, &sine, &cosine);
printf("__sincos: %+f %+f\n", cosine, sine);
c = cexp(CMPLX(0.0, d));
printf(" cexp: %+f %+f\n", creal(c), cimag(c));
}
double z = 0.0, p = +1.0, n = -1.0;
Incidentally, the above program will not compile on my machine w/ gcc-6.3.0. “gcc -std=c11” or “gcc -std=c99” will not recognize the standard macro CMPLX().
[-- Attachment #2: Type: text/html, Size: 13644 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta) [numbers.c]
2017-01-20 19:01 ` GNU Guile 2.1.6 released (beta) [numbers.c] Matt Wette
@ 2017-01-20 19:15 ` Amirouche
2017-01-20 20:23 ` Matt Wette
1 sibling, 0 replies; 14+ messages in thread
From: Amirouche @ 2017-01-20 19:15 UTC (permalink / raw)
To: guile-devel
[-- Attachment #1: Type: text/plain, Size: 2423 bytes --]
Le 20/01/2017 à 20:01, Matt Wette a écrit :
>
>> On Jan 19, 2017, at 7:01 PM, Matt Wette <matt.wette@gmail.com
>> <mailto:matt.wette@gmail.com>> wrote:
>>
>>
>>> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com
>>> <mailto:wingo@pobox.com>> wrote:
>>>
>>> We are pleased to announce GNU Guile release 2.1.6.
>>>
>>> Guile 2.1.6 is the sixth pre-release in what will eventually become the
>>> 2.2 release series. We encourage you to test this release and provide
>>> feedback to guile-devel@gnu.org <mailto:guile-devel@gnu.org>.
>>
>> Saw this one last round. Mac OS, now gcc-6.3.0:
>>
>> ;;; ("#i1@-0" 1.0 -0.0)
>> FAIL: numbers.test: string->number: valid complex number strings
>>
>> I am going to see if I can generate the assembly.
>
> Short story: scm_c_make_polar is broken for the Mac. Guile needs to
> decide if it want to use __sincos() on Mac, or suppress optimization,
> or ...
>
> I was able to get the above to work (guile-2.1.5) by using
> SCM
> +#ifdef __APPLE__
> +__attribute__((optimize("O0")))
> +#endif
> scm_c_make_polar (double mag, double ang)
>
>
> In scm_c_make_polar, “gcc -O2” turns sin(), cos() into cexp(), since
> cexp(i*x) = cos(x) + i*sin(x):
>
> gcc -O0 =>
> LM4339:
> movq-32(%rbp), %rax
> movd%rax, %xmm0
> call_sin
> movd%xmm0, %rax
> movq%rax, -8(%rbp)
> LM4340:
> movq-32(%rbp), %rax
> movd%rax, %xmm0
> call_cos
> movd%xmm0, %rax
> movq%rax, -16(%rbp)
>
> gcc -O2 =>
> pxor%xmm0, %xmm0
> LVL2703:
> call_cexp
>
> I wrote a little C program to show that cexp() does not preserve the
> zero-signed-ness:
>
> cos,sin: +1.000000 -0.000000
> __sincos: +1.000000 -0.000000
> cexp: +1.000000 +0.000000
>
> The scm_c_make_polar will use sincos() if available, but macOS does
> not have sincos(), it has __sincos().
>
> #include <stdio.h>
> #include <stdint.h>
> #include <math.h>
> #include <complex.h>
>
> extern double z, p, n;
>
> int main() {
> double complex c;
> double d, sine, cosine;
>
> d = z*n;
> printf(" cos,sin: %+f %+f\n", cos(d), sin(d));
> __sincos(d, &sine, &cosine);
> printf("__sincos: %+f %+f\n", cosine, sine);
> c = cexp(CMPLX(0.0, d));
> printf(" cexp: %+f %+f\n", creal(c), cimag(c));
> }
>
> double z = 0.0, p = +1.0, n = -1.0;
>
> Incidentally, the above program will not compile on my machine w/
> gcc-6.3.0. “gcc -std=c11” or “gcc -std=c99” will not recognize the
> standard macro CMPLX().
>
>
>
wow!
[-- Attachment #2: Type: text/html, Size: 17990 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta) [numbers.c]
2017-01-20 19:01 ` GNU Guile 2.1.6 released (beta) [numbers.c] Matt Wette
2017-01-20 19:15 ` Amirouche
@ 2017-01-20 20:23 ` Matt Wette
2017-01-28 19:29 ` Matt Wette
1 sibling, 1 reply; 14+ messages in thread
From: Matt Wette @ 2017-01-20 20:23 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
> On Jan 20, 2017, at 11:01 AM, Matt Wette <matt.wette@gmail.com> wrote:
>
>>
>> On Jan 19, 2017, at 7:01 PM, Matt Wette <matt.wette@gmail.com <mailto:matt.wette@gmail.com>> wrote:
>>
>>
>>> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com <mailto:wingo@pobox.com>> wrote:
>>>
>>> We are pleased to announce GNU Guile release 2.1.6.
>>>
>>> Guile 2.1.6 is the sixth pre-release in what will eventually become the
>>> 2.2 release series. We encourage you to test this release and provide
>>> feedback to guile-devel@gnu.org <mailto:guile-devel@gnu.org>.
>>
>> Saw this one last round. Mac OS, now gcc-6.3.0:
>>
>> ;;; ("#i1@-0" 1.0 -0.0)
>> FAIL: numbers.test: string->number: valid complex number strings
>>
>> I am going to see if I can generate the assembly.
>
> Short story: scm_c_make_polar is broken for the Mac. Guile needs to decide if it want to use __sincos() on Mac, or suppress optimization, or ...
>
a patch, with which make check passes all tests on macOS 10.12.2, aka Sierra:
--- libguile/numbers.c.orig 2017-01-19 16:57:30.000000000 -0800
+++ libguile/numbers.c 2017-01-19 20:20:58.000000000 -0800
@@ -9099,6 +9099,9 @@
#undef FUNC_NAME
SCM
+#if defined(__APPLE__) && defined(__GNUC__)
+__attribute__((optimize("O0")))
+#endif
scm_c_make_polar (double mag, double ang)
{
double s, c;
[-- Attachment #2: Type: text/html, Size: 6227 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta) [numbers.c]
2017-01-20 20:23 ` Matt Wette
@ 2017-01-28 19:29 ` Matt Wette
0 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2017-01-28 19:29 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 1313 bytes --]
> On Jan 20, 2017, at 12:23 PM, Matt Wette <matt.wette@gmail.com> wrote:
>
>>
>> On Jan 20, 2017, at 11:01 AM, Matt Wette <matt.wette@gmail.com <mailto:matt.wette@gmail.com>> wrote:
>>
>>>
>>> On Jan 19, 2017, at 7:01 PM, Matt Wette <matt.wette@gmail.com <mailto:matt.wette@gmail.com>> wrote:
>>>
>>>
>>>> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com <mailto:wingo@pobox.com>> wrote:
>>>>
>>>> We are pleased to announce GNU Guile release 2.1.6.
>>>>
>>>> Guile 2.1.6 is the sixth pre-release in what will eventually become the
>>>> 2.2 release series. We encourage you to test this release and provide
>>>> feedback to guile-devel@gnu.org <mailto:guile-devel@gnu.org>.
>>>
>>> Saw this one last round. Mac OS, now gcc-6.3.0:
>>>
>>> ;;; ("#i1@-0" 1.0 -0.0)
>>> FAIL: numbers.test: string->number: valid complex number strings
>>>
>>> I am going to see if I can generate the assembly.
>>
>> Short story: scm_c_make_polar is broken for the Mac. Guile needs to decide if it want to use __sincos() on Mac, or suppress optimization, or ...
>>
>
Attached is another patch. This one adds check for __sincos() to configure.am, configure and #ifdef to numbers.c to use __sincos() on the Mac. I don’t know if __APPLE__ is required anymore or not.
Matt
[-- Attachment #2.1: Type: text/html, Size: 3936 bytes --]
[-- Attachment #2.2: patch.__sincos --]
[-- Type: application/octet-stream, Size: 1848 bytes --]
--- libguile/numbers.c-orig 2017-01-27 16:44:27.000000000 -0800
+++ libguile/numbers.c 2017-01-27 16:47:49.000000000 -0800
@@ -9109,6 +9109,8 @@
details. */
#if (defined HAVE_SINCOS) && (defined __GLIBC__) && (defined _GNU_SOURCE)
sincos (ang, &s, &c);
+#elif (defined HAVE___SINCOS) && (defined __APPLE__)
+ __sincos (ang, &s, &c);
#else
s = sin (ang);
c = cos (ang);
@@ -9951,7 +9953,7 @@
long n_size = scm_to_long (scm_integer_length (n));
long d_size = scm_to_long (scm_integer_length (d));
- if (abs (n_size - d_size) > 1)
+ if (labs (n_size - d_size) > 1)
return (scm_difference (log_of_exact_integer (n),
log_of_exact_integer (d)));
else if (scm_is_false (scm_negative_p (n)))
--- configure.ac-orig 2017-01-27 16:42:08.000000000 -0800
+++ configure.ac 2017-01-27 16:42:45.000000000 -0800
@@ -1152,8 +1152,9 @@
# asinh, acosh, atanh, trunc - C99 standard, generally not available on
# older systems
# sincos - GLIBC extension
+# __sincos - APPLE extension
#
-AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos trunc)
+AC_CHECK_FUNCS(asinh acosh atanh copysign finite sincos __sincos trunc)
# C99 specifies isinf and isnan as macros.
# HP-UX provides only macros, no functions.
--- configure-orig 2017-01-27 16:42:14.000000000 -0800
+++ configure 2017-01-27 16:56:43.000000000 -0800
@@ -52786,8 +52786,9 @@
# asinh, acosh, atanh, trunc - C99 standard, generally not available on
# older systems
# sincos - GLIBC extension
+# __sincos - APPLE extension
#
-for ac_func in asinh acosh atanh copysign finite sincos trunc
+for ac_func in asinh acosh atanh copysign finite sincos __sincos trunc
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
[-- Attachment #2.3: Type: text/html, Size: 237 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
2017-01-20 3:01 ` Matt Wette
@ 2017-01-20 14:10 ` Matt Wette
2017-01-25 3:35 ` Matt Wette
2017-02-11 20:52 ` Matt Wette
3 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2017-01-20 14:10 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 910 bytes --]
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to guile-devel@gnu.org.
I don’t see problems with this but I think it is a bug: should use labs for longs.
--- libguile/numbers.c.orig 2016-11-21 13:56:23.000000000 -0800
+++ libguile/numbers.c 2017-01-20 06:04:53.000000000 -0800
@@ -9951,7 +9951,7 @@
long n_size = scm_to_long (scm_integer_length (n));
long d_size = scm_to_long (scm_integer_length (d));
- if (abs (n_size - d_size) > 1)
+ if (labs (n_size - d_size) > 1)
return (scm_difference (log_of_exact_integer (n),
log_of_exact_integer (d)));
else if (scm_is_false (scm_negative_p (n)))
[-- Attachment #2: Type: text/html, Size: 4116 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
2017-01-20 3:01 ` Matt Wette
2017-01-20 14:10 ` GNU Guile 2.1.6 released (beta) Matt Wette
@ 2017-01-25 3:35 ` Matt Wette
2017-03-09 21:33 ` Andy Wingo
2017-02-11 20:52 ` Matt Wette
3 siblings, 1 reply; 14+ messages in thread
From: Matt Wette @ 2017-01-25 3:35 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 914 bytes --]
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to guile-devel@gnu.org.
So I am trying to compile using clang. This has detected issues with atomics-internal.h. I can fix most issues with casts:
static inline uint32_t
scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
{
- return atomic_fetch_sub (loc, arg);
+ return atomic_fetch_sub ((_Atomic uint32_t *)loc, arg);
}
But problems remain with scm_atomic_set_pointer and scm_atomic_ref_pointer which use void** and is apparently not defined for use with atomics.
Apparently gcc does not have a problem with this use but I’m guessing the C11 standard may have an issue with it.
Matt
[-- Attachment #2: Type: text/html, Size: 3029 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-01-25 3:35 ` Matt Wette
@ 2017-03-09 21:33 ` Andy Wingo
2017-03-10 2:01 ` Matt Wette
0 siblings, 1 reply; 14+ messages in thread
From: Andy Wingo @ 2017-03-09 21:33 UTC (permalink / raw)
To: Matt Wette; +Cc: guile-devel
Hi,
Picking up this topic...
On Wed 25 Jan 2017 04:35, Matt Wette <matt.wette@gmail.com> writes:
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to guile-devel@gnu.org.
>
> So I am trying to compile using clang. This has detected issues with atomics-internal.h. I can fix most issues with casts:
> static inline uint32_t
> scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
> {
> - return atomic_fetch_sub (loc, arg);
> + return atomic_fetch_sub ((_Atomic uint32_t *)loc, arg);
> }
>
> But problems remain with scm_atomic_set_pointer and scm_atomic_ref_pointer which use void** and is apparently not defined for use with atomics.
>
> Apparently gcc does not have a problem with this use but I’m guessing the C11 standard may have an issue with it.
WDYT about this?
Andy
diff --git a/libguile/atomics-internal.h b/libguile/atomics-internal.h
index f2d17e1..da3ebd8 100644
--- a/libguile/atomics-internal.h
+++ b/libguile/atomics-internal.h
@@ -31,46 +31,56 @@
#ifdef HAVE_STDATOMIC_H
#include <stdatomic.h>
+
static inline uint32_t
scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
{
- return atomic_fetch_sub (loc, arg);
+ atomic_uint_least32_t *a_loc = (atomic_uint_least32_t *) loc;
+ return atomic_fetch_sub (a_loc, arg);
}
static inline _Bool
scm_atomic_compare_and_swap_uint32 (uint32_t *loc, uint32_t *expected,
uint32_t desired)
{
- return atomic_compare_exchange_weak (loc, expected, desired);
+ atomic_uint_least32_t *a_loc = (atomic_uint_least32_t *) loc;
+ return atomic_compare_exchange_weak (a_loc, expected, desired);
}
static inline void
scm_atomic_set_pointer (void **loc, void *val)
{
- atomic_store (loc, val);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ atomic_store (a_loc, (uintptr_t) val);
}
static inline void *
scm_atomic_ref_pointer (void **loc)
{
- return atomic_load (loc);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return (void *) atomic_load (a_loc);
}
static inline void
scm_atomic_set_scm (SCM *loc, SCM val)
{
- atomic_store (loc, val);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ atomic_store (a_loc, SCM_UNPACK (val));
}
static inline SCM
scm_atomic_ref_scm (SCM *loc)
{
- return atomic_load (loc);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return SCM_PACK (atomic_load (a_loc));
}
static inline SCM
scm_atomic_swap_scm (SCM *loc, SCM val)
{
- return atomic_exchange (loc, val);
+ return SCM_PACK (atomic_exchange (loc, val));
}
static inline _Bool
scm_atomic_compare_and_swap_scm (SCM *loc, SCM *expected, SCM desired)
{
- return atomic_compare_exchange_weak (loc, expected, desired);
+ atomic_uintptr_t *a_loc = (atomic_uintptr_t *) loc;
+ return atomic_compare_exchange_weak (a_loc,
+ (uintptr_t *) expected,
+ SCM_UNPACK (desired));
}
#else /* HAVE_STDATOMIC_H */
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-03-09 21:33 ` Andy Wingo
@ 2017-03-10 2:01 ` Matt Wette
2017-03-10 2:52 ` Matt Wette
2017-03-10 8:13 ` Andy Wingo
0 siblings, 2 replies; 14+ messages in thread
From: Matt Wette @ 2017-03-10 2:01 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
[-- Attachment #1: Type: text/plain, Size: 1609 bytes --]
> On Mar 9, 2017, at 1:33 PM, Andy Wingo <wingo@pobox.com> wrote:
> On Wed 25 Jan 2017 04:35, Matt Wette <matt.wette@gmail.com <mailto:matt.wette@gmail.com>> writes:
>> So I am trying to compile using clang. This has detected issues with atomics-internal.h. I can fix most issues with casts:
>> static inline uint32_t
>> scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
>> {
>> - return atomic_fetch_sub (loc, arg);
>> + return atomic_fetch_sub ((_Atomic uint32_t *)loc, arg);
>> }
>>
>> But problems remain with scm_atomic_set_pointer and scm_atomic_ref_pointer which use void** and is apparently not defined for use with atomics.
>>
>> Apparently gcc does not have a problem with this use but I’m guessing the C11 standard may have an issue with it.
>
> WDYT about this?
>
> Andy
Have not tried to chase this down but ...
In file included from async.c:27:
../libguile/atomics-internal.h:75:20: error: address argument to atomic operation must be a pointer to _Atomic type ('SCM *' (aka 'struct scm_unused_struct **') invalid)
return SCM_PACK (atomic_exchange (loc, val));
^ ~~~
/opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.1/include/stdatomic.h:137:42: note: expanded from macro 'atomic_exchange'
#define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
^ ~~~~~~
../libguile/tags.h:105:32: note: expanded from macro 'SCM_PACK'
# define SCM_PACK(x) ((SCM) (x))
^
1 error generated.
[-- Attachment #2: Type: text/html, Size: 8641 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-03-10 2:01 ` Matt Wette
@ 2017-03-10 2:52 ` Matt Wette
2017-03-10 8:13 ` Andy Wingo
1 sibling, 0 replies; 14+ messages in thread
From: Matt Wette @ 2017-03-10 2:52 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
[-- Attachment #1: Type: text/plain, Size: 2103 bytes --]
> On Mar 9, 2017, at 6:01 PM, Matt Wette <matt.wette@gmail.com> wrote:
>
>
>> On Mar 9, 2017, at 1:33 PM, Andy Wingo <wingo@pobox.com <mailto:wingo@pobox.com>> wrote:
>> On Wed 25 Jan 2017 04:35, Matt Wette <matt.wette@gmail.com <mailto:matt.wette@gmail.com>> writes:
>>> So I am trying to compile using clang. This has detected issues with atomics-internal.h. I can fix most issues with casts:
>>> static inline uint32_t
>>> scm_atomic_subtract_uint32 (uint32_t *loc, uint32_t arg)
>>> {
>>> - return atomic_fetch_sub (loc, arg);
>>> + return atomic_fetch_sub ((_Atomic uint32_t *)loc, arg);
>>> }
>>>
>>> But problems remain with scm_atomic_set_pointer and scm_atomic_ref_pointer which use void** and is apparently not defined for use with atomics.
>>>
>>> Apparently gcc does not have a problem with this use but I’m guessing the C11 standard may have an issue with it.
>>
>> WDYT about this?
>>
>> Andy
>
> Have not tried to chase this down but ...
>
> In file included from async.c:27:
> ../libguile/atomics-internal.h:75:20: error: address argument to atomic operation must be a pointer to _Atomic type ('SCM *' (aka 'struct scm_unused_struct **') invalid)
> return SCM_PACK (atomic_exchange (loc, val));
> ^ ~~~
> /opt/local/libexec/llvm-3.9/bin/../lib/clang/3.9.1/include/stdatomic.h:137:42: note: expanded from macro 'atomic_exchange'
> #define atomic_exchange(object, desired) __c11_atomic_exchange(object, desired, __ATOMIC_SEQ_CST)
> ^ ~~~~~~
> ../libguile/tags.h:105:32: note: expanded from macro 'SCM_PACK'
> # define SCM_PACK(x) ((SCM) (x))
> ^
> 1 error generated.
>
With this change it compiles under clang-3.9, though generates warning, and gets through make check (with required other unrelated patches) OK:
static inline SCM
scm_atomic_swap_scm (SCM *loc, SCM val)
{
volatile atomic_uintptr_t *a_loc = (volatile atomic_uintptr_t *)loc;
return SCM_PACK (atomic_exchange (a_loc, val));
}
[-- Attachment #2: Type: text/html, Size: 9624 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-03-10 2:01 ` Matt Wette
2017-03-10 2:52 ` Matt Wette
@ 2017-03-10 8:13 ` Andy Wingo
2017-03-10 13:10 ` Matt Wette
1 sibling, 1 reply; 14+ messages in thread
From: Andy Wingo @ 2017-03-10 8:13 UTC (permalink / raw)
To: Matt Wette; +Cc: guile-devel
On Fri 10 Mar 2017 03:01, Matt Wette <matt.wette@gmail.com> writes:
> In file included from async.c:27:
> ../libguile/atomics-internal.h:75:20: error: address argument to atomic operation must be a pointer to _Atomic type ('SCM *' (aka 'struct scm_unused_struct **') invalid)
> return SCM_PACK (atomic_exchange (loc, val));
Right, forgot to fix this one. Following up on your other message where
you had success with clang, I fixed this and pushed. We'll see in the
next prerelease then :)
Andy
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-03-10 8:13 ` Andy Wingo
@ 2017-03-10 13:10 ` Matt Wette
0 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2017-03-10 13:10 UTC (permalink / raw)
To: Andy Wingo; +Cc: guile-devel
> On Mar 10, 2017, at 12:13 AM, Andy Wingo <wingo@pobox.com> wrote:
>
> On Fri 10 Mar 2017 03:01, Matt Wette <matt.wette@gmail.com> writes:
>
>> In file included from async.c:27:
>> ../libguile/atomics-internal.h:75:20: error: address argument to atomic operation must be a pointer to _Atomic type ('SCM *' (aka 'struct scm_unused_struct **') invalid)
>> return SCM_PACK (atomic_exchange (loc, val));
>
> Right, forgot to fix this one. Following up on your other message where
> you had success with clang, I fixed this and pushed. We'll see in the
> next prerelease then :)
FYI, I rebuilt with gcc: gcc is generating a warning on my code above. — Matt
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: GNU Guile 2.1.6 released (beta)
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
` (2 preceding siblings ...)
2017-01-25 3:35 ` Matt Wette
@ 2017-02-11 20:52 ` Matt Wette
3 siblings, 0 replies; 14+ messages in thread
From: Matt Wette @ 2017-02-11 20:52 UTC (permalink / raw)
To: guile-devel; +Cc: Andy Wingo
[-- Attachment #1: Type: text/plain, Size: 619 bytes --]
> On Jan 18, 2017, at 6:26 PM, Andy Wingo <wingo@pobox.com> wrote:
>
> We are pleased to announce GNU Guile release 2.1.6.
>
> Guile 2.1.6 is the sixth pre-release in what will eventually become the
> 2.2 release series. We encourage you to test this release and provide
> feedback to guile-devel@gnu.org.
I agree with Triple-X’s comment near line 391 in doc/ref/guile.texi:
@c XXX: Would be nicer if it were close to the (sxml simple) documentation.
@include sxml-match.texi
@include scsh.texi
@include curried.texi
@include statprof.texi
@include sxml.texi
@include texinfo.texi
Matt
[-- Attachment #2: Type: text/html, Size: 4404 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2017-03-10 13:10 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-19 2:26 GNU Guile 2.1.6 released (beta) Andy Wingo
2017-01-20 3:01 ` Matt Wette
2017-01-20 19:01 ` GNU Guile 2.1.6 released (beta) [numbers.c] Matt Wette
2017-01-20 19:15 ` Amirouche
2017-01-20 20:23 ` Matt Wette
2017-01-28 19:29 ` Matt Wette
2017-01-20 14:10 ` GNU Guile 2.1.6 released (beta) Matt Wette
2017-01-25 3:35 ` Matt Wette
2017-03-09 21:33 ` Andy Wingo
2017-03-10 2:01 ` Matt Wette
2017-03-10 2:52 ` Matt Wette
2017-03-10 8:13 ` Andy Wingo
2017-03-10 13:10 ` Matt Wette
2017-02-11 20:52 ` Matt Wette
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).