Re: segfault in vfscanf(3): clang and __restrict usage

From: Jean-Sébastien Pédron <dumbbell_at_FreeBSD.org>
Date: Thu, 26 Apr 2012 11:41:14 +0200
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 25.04.2012 21:40, Dimitry Andric wrote:
> I think the easiest solution for now is to #undef __restrict at the
> top of both lib/libc/stdio/vfscanf.c and lib/libc/stdio/vfwscanf.c,
> then recompile and reinstall libc.

I attached a patch that removes the __restrict keyword in the
convert_* functions because I believe it's incorrect.

In vfscanf.c, I kept the last one in parseint() because I believe it's
correct: the restricted pointer is used to initialized another one and
comparisons are made only between those two pointers. But I didn't
check if clang optimized out the comparisons. What do you think about
the correctness here?

We can't remove it in vfwscanf(), vfwscanf_l() and __vfwscanf()
(vfwscanf.c) because it's required by the vfwscanf(3) API.

The patch also removes some trailing whitespaces while here.

I'm rebuilding world with this patch and will check that cmake is
working again (the program which shows segfaults for me).

Boris, could you please test it and tell me if cupsd works again for
you too? You just need to rebuild/reinstall the libc, not cups.

Dimitry, thank you for the reporting the problem to LLVM!

- -- 
Jean-Sébastien Pédron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.19 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk+ZGDoACgkQa+xGJsFYOlOA4ACdH7vH4XfjH6nxcV/axmAYKUKq
8hoAoMrfly9RkUL0UKSKsmbxIiBz2YZy
=GFTc
-----END PGP SIGNATURE-----

Received on Thu Apr 26 2012 - 07:41:17 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:26 UTC