bug-gnulib@gnu.org mirror (unofficial)
 help / color / mirror / Atom feed
From: Bruno Haible <bruno@clisp.org>
To: "Dmitry V. Levin" <ldv@altlinux.org>
Cc: bug-gnulib@gnu.org
Subject: Re: new module 'sigsegv'
Date: Mon, 07 Jun 2021 02:49:35 +0200	[thread overview]
Message-ID: <2263638.MxO8Z3q26L@omega> (raw)
In-Reply-To: <20210606232756.GA17371@altlinux.org>

Hi Dmitry,

> I've tried to rebuild the latest GNU grep with the latest gnulib
> and got a few build issues:
> ...
> The following gnulib patch makes the compiler happy again:
> 
> diff --git a/lib/sigsegv.c b/lib/sigsegv.c
> index 312f132b8..b0b406685 100644
> --- a/lib/sigsegv.c
> +++ b/lib/sigsegv.c
> @@ -1056,7 +1056,7 @@ sigsegv_handler (SIGSEGV_FAULT_HANDLER_ARGLIST)
>            /* Handler declined responsibility for real.  */
>  
>            /* Remove ourselves and dump core.  */
> -          SIGSEGV_FOR_ALL_SIGNALS (sig, signal (sig, SIG_DFL);)
> +          SIGSEGV_FOR_ALL_SIGNALS (signo, signal (signo, SIG_DFL);)
>          }
>  
>  # if HAVE_STACK_OVERFLOW_RECOVERY

Thanks for the report. This patch is good, but needs to be applied also to
the other sigsegv_handler, and also to libsigsegv (to be kept in sync when
possible). I'm doing that now.

>  
> -volatile int *
> +static volatile int *
>  recurse_1 (int n, volatile int *p)
>  {
>    if (n < INT_MAX)
> @@ -80,7 +80,7 @@ recurse_1 (int n, volatile int *p)
>    return p;
>  }
>  
> -int
> +static int
>  recurse (volatile int n)
>  {
>    return *recurse_1 (n, &n);

This part should better not be applied. It may enable compiler optimizations
(now or in the future) that, in the end, turn an endless recursion into an
endless loop.

> @@ -183,6 +183,9 @@ main ()
>        *(volatile int *) (page + 0x678) = 42;
>        break;
>      case 3:
> +#if 6 < __GNUC__
> +# pragma GCC diagnostic ignored "-Wnull-dereference"
> +#endif
>        *(volatile int *) 0 = 42;
>        break;
>      case 4:

We shouldn't spend time eliminating warnings from test code.

The goal is to have a good coverage of the lib/* code with unit tests.
That means, we need to
  - make it easy to write unit tests,
  - not make it time-consuming to maintain them.

Eliminating warnings from lib/* code is useful, to avoid bugs in the
programs. But eliminating warnings from tests/* code goes against the
goal of increasing test coverage.

I think the right fix would be that gnulib-tool's --import/--update
option, when creating a tests directory, adds a $(CFLAG_ALLOW_WARNING)
to tests/Makefile.am, where CFLAG_ALLOW_WARNING is defined as
  -Wno-error  when the compiler is GCC or clang,
  empty       otherwise
Will that work in GNU grep?

Bruno



  reply	other threads:[~2021-06-07  1:23 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-16 17:01 new module 'sigsegv' Bruno Haible
2021-06-06 23:27 ` Dmitry V. Levin
2021-06-07  0:49   ` Bruno Haible [this message]
2021-06-07 10:29     ` Dmitry V. Levin
2021-06-08  1:45       ` Jim Meyering
2021-06-08  2:40         ` warnings in unit tests Bruno Haible
2021-06-08  5:55           ` Jim Meyering
2021-06-08  8:56             ` Bruno Haible
2021-06-09  0:41               ` Dmitry V. Levin
2021-06-10 20:05                 ` Bruno Haible
     [not found]             ` <CAH8yC8kHTq5J9onJj+2jwy_DwzXrwujqFs9TEBxGh5k_KCu=kg@mail.gmail.com>
2021-06-08 10:57               ` Bruno Haible
2021-06-08 16:42                 ` Paul Eggert
2021-06-09 13:35                   ` Dmitry V. Levin
2021-06-09 19:38                   ` Bruno Haible
2021-06-10 19:39                   ` Bruno Haible
2021-06-09  7:23                 ` Bernhard Voelker
2021-06-09 14:17                   ` Bruno Haible
2021-06-10  8:13                     ` Simon Josefsson via Gnulib discussion list
2021-06-10 19:51                       ` Bruno Haible
2021-06-10 21:49                         ` Simon Josefsson via Gnulib discussion list
2021-06-11 12:21                         ` Eric Blake
2021-06-11 13:57                           ` Bruno Haible
2021-06-19 12:02 ` new module 'sigsegv' Bruno Haible
2021-06-21 18:22   ` [PATCH] sigsegv, sigsegv-tests: Assign my contributions to the FSF Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.gnu.org/mailman/listinfo/bug-gnulib

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2263638.MxO8Z3q26L@omega \
    --to=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=ldv@altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).