Hi,

Just for completeness I tried with a

gcc (Ubuntu 9.3.0-10ubuntu2~16.04) 9.3.0
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

same behavior. Compiler refuses to compile without my patch.

Just looking at the code I believe the compiler should complain unless you tell it otherwise.

That's what it complains about:

| In function ‘int fprintf(FILE*, const char*, ...)’,
| inlined from ‘FormatRule* ADLParser::template_parse()’ at /workdir/build/container-x86-64-java/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/adlparse.cpp:3803:34: | /usr/include/x86_64-linux-gnu/bits/stdio2.h:97:24: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
|    97 |   return __fprintf_chk (__stream, __USE_FORTIFY_LEVEL - 1, __fmt,
|       |          ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|    98 |    __va_arg_pack ());
|       |    ~~~~~~~~~~~~~~~~~


If we look at the source code:

vim /workdir/build/container-x86-64-java/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/adlparse.cpp +3803

  // Debug Stuff
  if (_AD._adl_debug > 1) fprintf(stderr,"Format Rule: %s\n", desc);

At the beginnig of this method you can see:

//------------------------------template_parse-----------------------------------
FormatRule* ADLParser::template_parse(void) {
  char       *desc   = NULL;
  FormatRule *format = (new FormatRule(desc));
...

So I guess the compiler is wrong to complain, since desc could be NULL.

Regards,

Robert
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.

View/Reply Online (#84185): 
https://lists.openembedded.org/g/openembedded-devel/message/84185
Mute This Topic: https://lists.openembedded.org/mt/72312277/21656
Group Owner: [email protected]
Unsubscribe: 
https://lists.openembedded.org/g/openembedded-devel/leave/8024792/1994799631/xyzzy
  [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to