This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, RFC] Wrong warning message fix for gcc 9


On 3/28/19 11:49 AM, Roman Zhuykov wrote:
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?

Thanks for the patch!  The change makes sense to me.  Can you
please also add a test case to the test suite?

I can't approve patches, even obvious ones, so please wait for
an approval from a maintainer before committing it.

Martin


чт, 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;
       }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]