This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, RFC] Wrong warning message fix for gcc 9
- From: Roman Zhuykov <zhroma at ispras dot ru>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Cc: msebor at redhat dot com
- Date: Thu, 28 Mar 2019 20:49:14 +0300
- Subject: Re: [PATCH, RFC] Wrong warning message fix for gcc 9
- References: <CAJnFk2e3opjzWtfRt8NNUGpst8KBs3FnTF5vjaWBFEGG=R8FwA@mail.gmail.com>
Ping
A week ago I decided it is so minor that I can report here with a
patch without creating bugzilla PR.
Technically it is a "9 regression" in new functionality added back in summer.
Patch was succesfully bootstrapped and regtested on x86_64.
Ok for trunk?
чт, 21 мар. 2019 г. в 18:53, Roman Zhuykov <zhroma@ispras.ru>:
>
> Hello, I have found a minor diagnostic issue.
>
> Since r262910 we got a little odd error messages in cases like this:
> $ gcc -flto-compression-level=2-O2 -c empty.c
> gcc: error: argument to '-flto-compression-level=' is not between 0 and 9
> $ g++ -fabi-version=2-O2 -c empty.cpp
> cc1plus: error: '-fabi-version=1' is no longer supported
>
> Old messages were more correct:
> $ gcc-8 -flto-compression-level=2-O2 -c empty.c
> gcc: error: argument to '-flto-compression-level=' should be a
> non-negative integer
> $ g++-8 -fabi-version=2-O2 -c empty.cpp
> g++: error: argument to '-fabi-version=' should be a non-negative integer
>
> When UInteger option value string is not a number, but it's first char
> is a digit, integral_argument function returns -1 without setting
> *err.
>
> Proposed untested patch attached.
>
> --
> Best Regards,
> Roman Zhuykov
>
> gcc/ChangeLog:
>
> 2019-03-21 Roman Zhuykov <zhroma@ispras.ru>
>
> * opts-common.c (integral_argument): Set errno properly in one case.
>
> diff --git a/gcc/opts-common.c b/gcc/opts-common.c
> --- a/gcc/opts-common.c
> +++ b/gcc/opts-common.c
> @@ -205,8 +205,10 @@ integral_argument (const char *arg, int *err,
> bool byte_size_suffix)
> value = strtoull (arg, &end, 0);
> if (*end)
> {
> - /* errno is most likely EINVAL here. */
> - *err = errno;
> + if (errno)
> + *err = errno;
> + else
> + *err = EINVAL;
> return -1;
> }