public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* GCC 10 and Coverity Scan
@ 2020-10-28 16:04 Joel Sherrill
  2020-10-28 16:45 ` paulf
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Sherrill @ 2020-10-28 16:04 UTC (permalink / raw)
  To: GCC

Hi

This isn't the perfect place to ask this but someone here may have insight.
And getting help with Coverity Scan directly isn't easy. I'm hoping someone
here has some insight or can point me to someone who does.

We have been using Coverity Scan a long time with RTEMS. It works fine
using gcc 7.5.0 but Coverity appears to have a problem with gcc 10. This is
what --version reports for both toolchains:

$ ~/rtems-work/tools/5/bin/sparc-rtems5-gcc --version
sparc-rtems5-gcc (GCC) 7.5.0 20191114 (RTEMS 5, RSB 5 (cbae90a5817a),
Newlib 7947581)

$ sparc-rtems6-gcc --version
sparc-rtems6-gcc (GCC) 10.2.1 20201028 (RTEMS 6, RSB
4c5af1f7c1553e53739ca4e9892de26924ec2b3f, Newlib fcaaf40)

I am a bit suspicious that Coverity isn't handling the transition from 1 to
2 digits in the major number. All I am changing is the name of the target
in the script that does the analysis build.

This is the output from Coverity:

/home/joel/coverity/cov-analysis-linux64-2019.03/bin/cov-emit
--dir=/home/joel/rtems-work/b-coverity-sparc-rtems6/cov-int
--ignore_path=/tmp/cov-joel/d83f12de08465ee5db7c3d5793b61b7f/cov-configure
--ignore_path=/tmp/cov-joel/d83f12de08465ee5db7c3d5793b61b7f/cov-joel/4c6332bd8a8cc093158cd207a79a6edf
--pre_preinclude
/home/joel/coverity/cov-analysis-linux64-2019.03/config/gcc-config-0/coverity-macro-compat.h
--pre_preinclude
/home/joel/coverity/cov-analysis-linux64-2019.03/config/gcc-config-0/coverity-compiler-compat.h
--add_type_modifier=__coverity___fpreg
--add_type_modifier=__coverity_decimal --add_type_modifier=__coverity_float
--add_type_modifier=__coverity_floatx --no_predefined_feature_test_macros
--no_stdarg_builtin --no_predefined_cplusplus -w --no_predefines --comp_ver
0.2.1 --char_bit_size=8 --restrict --gnu_carriage_return_line_terminator
--no_multiline_string --no_trigraphs --ignore_calling_convention --c11
--no_enable_80bit_float --no_enable_128bit_float --allow__bool
--macro_stack_pragmas --inline_keyword --has_include_macro
--has_include_next_macro --has_cpp_attribute_macro --no_predefines --c
--no_builtin_emulation --ppp_translator
"replace%#\s*ident\s*([^;]*);%#ident $1" --gcc --gnu_version 201 -I.
-I/home/joel/rtems-work/b-coverity-sparc-rtems6/sparc-rtems6/c/leon3/include
-I/home/joel/rtems-work/rtems/cpukit/include
-I/home/joel/rtems-work/rtems/cpukit/score/cpu/sparc/include --sys_include
/home/joel/rtems-work/tools/6/lib/gcc/sparc-rtems6/10.2.1/include
--sys_include
/home/joel/rtems-work/tools/6/lib/gcc/sparc-rtems6/10.2.1/include-fixed
--sys_include
/home/joel/rtems-work/tools/6/lib/gcc/sparc-rtems6/10.2.1/../../../../sparc-rtems6/include
-DHAVE_CONFIG_H -D__OPTIMIZE__ --type_sizes=dex8Pfil4s2
--type_alignments=dex8Pfil4s2 --size_t_type=j --wchar_t_type=l
--ptrdiff_t_type=i ../../../../../rtems/cpukit/zlib/zutil.c
Command-line error #1359: invalid GNU version number: 201

[ERROR] 1 catastrophic error detected in this compilation.
Compilation terminated.
WARNING: cov-emit returned with code 2

Any insight or pointers to someone who might be of help is appreciated.

--joel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GCC 10 and Coverity Scan
  2020-10-28 16:04 GCC 10 and Coverity Scan Joel Sherrill
@ 2020-10-28 16:45 ` paulf
  2020-10-29 14:43   ` Joel Sherrill
  0 siblings, 1 reply; 4+ messages in thread
From: paulf @ 2020-10-28 16:45 UTC (permalink / raw)
  To: GCC

----- Original Message -----
> Hi
> 
> This isn't the perfect place to ask this but someone here may have
> insight.
> And getting help with Coverity Scan directly isn't easy. I'm hoping
> someone
> here has some insight or can point me to someone who does.
> 
> We have been using Coverity Scan a long time with RTEMS. It works
> fine
> using gcc 7.5.0 but Coverity appears to have a problem with gcc 10.
> This is
> what --version reports for both toolchains:
> 
> $ ~/rtems-work/tools/5/bin/sparc-rtems5-gcc --version
> sparc-rtems5-gcc (GCC) 7.5.0 20191114 (RTEMS 5, RSB 5 (cbae90a5817a),
> Newlib 7947581)
> 
> $ sparc-rtems6-gcc --version
> sparc-rtems6-gcc (GCC) 10.2.1 20201028 (RTEMS 6, RSB
> 4c5af1f7c1553e53739ca4e9892de26924ec2b3f, Newlib fcaaf40)

Hi

Putting aside politics (I used to work for Synopsys and now work
for a competitor, but not at all in the domain of static
analysis), I'll take a stab.

When you switched compilers, did you re-run cov-configure?

A+
Paul

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GCC 10 and Coverity Scan
  2020-10-28 16:45 ` paulf
@ 2020-10-29 14:43   ` Joel Sherrill
  2020-12-03 17:44     ` Johannes Schindelin
  0 siblings, 1 reply; 4+ messages in thread
From: Joel Sherrill @ 2020-10-29 14:43 UTC (permalink / raw)
  To: paulf; +Cc: GCC

On Wed, Oct 28, 2020 at 11:45 AM <paulf@free.fr> wrote:

> ----- Original Message -----
> > Hi
> >
> > This isn't the perfect place to ask this but someone here may have
> > insight.
> > And getting help with Coverity Scan directly isn't easy. I'm hoping
> > someone
> > here has some insight or can point me to someone who does.
> >
> > We have been using Coverity Scan a long time with RTEMS. It works
> > fine
> > using gcc 7.5.0 but Coverity appears to have a problem with gcc 10.
> > This is
> > what --version reports for both toolchains:
> >
> > $ ~/rtems-work/tools/5/bin/sparc-rtems5-gcc --version
> > sparc-rtems5-gcc (GCC) 7.5.0 20191114 (RTEMS 5, RSB 5 (cbae90a5817a),
> > Newlib 7947581)
> >
> > $ sparc-rtems6-gcc --version
> > sparc-rtems6-gcc (GCC) 10.2.1 20201028 (RTEMS 6, RSB
> > 4c5af1f7c1553e53739ca4e9892de26924ec2b3f, Newlib fcaaf40)
>
> Hi
>
> Putting aside politics (I used to work for Synopsys and now work
> for a competitor, but not at all in the domain of static
> analysis), I'll take a stab.
>

:)

Thanks for the quick reply Paul.

>
> When you switched compilers, did you re-run cov-configure?
>

Yes. The script I use runs it every time.

cov-configure -co sparc-rtems6-gcc -- -mcpu=leon3

I decided to try a Coverity run with gcc 10, 9, 8, and 7. We use
gcc 7 on the release branch where Coverity works. This took a
bit of time as I had to build toolchains for each of those versions.

Without changing my script that runs Coverity and removing and
reinstalling Coverity between runs, it works with gcc 7, 8, and 9,
but not 10. If I don't uninstall and reinstall Coverity when changing
GCC versions, it tends to fail. I assume there is some file left over
with GCC version info that it reuses incorrectly.

With gcc 10, Coverity reports this:

  Command-line error #1359: invalid GNU version number: 201

  [ERROR] 1 catastrophic error detected in this compilation.
  Compilation terminated.
  WARNING: cov-emit returned with code 2

We are in the process of switching from an autoconf based build system
to waf so I went ahead and tried the even newer waf build system. I only
checked the waf build system with gcc 8 but it worked.

That leads me to the conclusion that Coverity Scan is broken for GCC
versions with two digit major numbers. Since the binary Coverity provides
is from 2019 and GCC 10 was released in May 2020, it looks likely they
didn't test against a GCC snapshot. Not sure how to make sure that
information gets to the right persons to address it though. If anyone
has a contact other than posting on stackoverflow, please pass it along.

If anyone has any other insight, I'm happy to experiment but I think
this is a Coverity issue which will eventually impact all GCC users as
GCC 10 is adopted more broadly in distributions.

Thanks.

--joel

>
> A+
> Paul
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: GCC 10 and Coverity Scan
  2020-10-29 14:43   ` Joel Sherrill
@ 2020-12-03 17:44     ` Johannes Schindelin
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Schindelin @ 2020-12-03 17:44 UTC (permalink / raw)
  To: Joel Sherrill; +Cc: gcc

Hi Joel,

On Thu, 29 Oct 2020, Joel Sherrill wrote:

> With gcc 10, Coverity reports this:
>
>   Command-line error #1359: invalid GNU version number: 201
>
>   [ERROR] 1 catastrophic error detected in this compilation.
>   Compilation terminated.
>   WARNING: cov-emit returned with code 2

I noticed this, too, and unfortunately it does not seem that there is a
whole lot of interest or at least rush on Synopsys' side to fix this. This
post has been unanswered since May 2020:

https://community.synopsys.com/s/question/0D52H000058Z6KvSAK/gcc101-when-it-will-be-supported

In the meantime, I noticed that I can edit the `.xml` files in the `emit/`
subdirectory of the path I specified via `--dir`. In your case, they should
contain a line like this:

          <version>0.2.1</version>

If you change that to this form, Coverity should start to work again:

          <version>10.2.1</version>

I actually use a slightly more automated version of this
(https://github.com/git-for-windows/build-extra/commit/23eea104d5358):

	gcc10_workaround="$(gcc -v 2>&1 |
		sed -n 's/^gcc version \([1-9]\)\([0-9]\)\.\([0-9][0-9]*\)\.\([0-9][0-9]*\).*/s|\\<\\(\1\\)\\?\\(\2\\.\3\\.\4\\)\\>|\1\\2|g/p')"
	find cov-int/emit/* -name \*.xml -exec sed -i "$gcc10_workaround" {} \;

Ciao,
Johannes


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-12-03 22:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28 16:04 GCC 10 and Coverity Scan Joel Sherrill
2020-10-28 16:45 ` paulf
2020-10-29 14:43   ` Joel Sherrill
2020-12-03 17:44     ` Johannes Schindelin

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).