[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#915405: marked as done (gcc-8: Spurious stringop-overflow error when compiling with -O2)



Your message dated Sat, 13 Feb 2021 13:07:12 +0000
with message-id <[🔎] E1lAudk-0000FN-1x@fasolo.debian.org>
and subject line Bug#954831: Removed package(s) from unstable
has caused the Debian Bug report #915405,
regarding gcc-8: Spurious stringop-overflow  error when compiling with -O2
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact owner@bugs.debian.org
immediately.)


-- 
915405: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=915405
Debian Bug Tracking System
Contact owner@bugs.debian.org with problems
--- Begin Message ---
Package: gcc-8
Version: 8.2.0-9
Severity: normal

Dear Maintainer,
I have a piece of code in a CMake project that fails to compile when building
in RelWithDebInfo mode.
The problem seems to come from gcc-8 when both -Wall and -O2 options are set:

char* copy_string(const char* str) {
  int len = strlen(str)+1;
  char* dest = malloc(sizeof(char)*len);
  if(dest) {
    strncpy(dest, str, len);
  }
  return dest;
}

gcc reports the following error:

test_strncpy.c:7:3: error: ‘strncpy’ specified bound depends on the length of
the source argument [-Werror=stringop-overflow=]
   strncpy(dest, str, len);
   ^~~~~~~~~~~~~~~~~~~~~~~
test_strncpy.c:5:13: note: length computed here
   int len = strlen(str)+1;
             ^~~~~~~~~~~
cc1: all warnings being treated as errors


In this case, there is no problem in the source code, but -Werror=stringop-
overflow still reports an error.

Gcc only reports an error when -O2 and -Werror=stringop-overflow (which is
enabled by -Wall) are set. Replacing strncpy with memcpy also fixes the
problem.


*** Reporter, please consider answering these questions, where appropriate ***

   * What led up to the situation?
   * What exactly did you do (or not do) that was effective (or
     ineffective)?
   * What was the outcome of this action?
   * What outcome did you expect instead?

*** End of the template - remove these template lines ***



-- System Information:
Debian Release: buster/sid
  APT prefers testing
  APT policy: (500, 'testing'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.18.0-2-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE= (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gcc-8 depends on:
ii  binutils      2.31.1-10
ii  cpp-8         8.2.0-9
ii  gcc-8-base    8.2.0-9
ii  libc6         2.27-8
ii  libcc1-0      8.2.0-9
ii  libgcc-8-dev  8.2.0-9
ii  libgcc1       1:8.2.0-9
ii  libgmp10      2:6.1.2+dfsg-3
ii  libisl19      0.20-2
ii  libmpc3       1.1.0-1
ii  libmpfr6      4.0.1-1
ii  libstdc++6    8.2.0-9
ii  zlib1g        1:1.2.11.dfsg-1

Versions of packages gcc-8 recommends:
ii  libc6-dev  2.27-8

Versions of packages gcc-8 suggests:
pn  gcc-8-doc         <none>
pn  gcc-8-locales     <none>
ii  gcc-8-multilib    8.2.0-9
pn  libasan5-dbg      <none>
pn  libatomic1-dbg    <none>
pn  libgcc1-dbg       <none>
pn  libgomp1-dbg      <none>
pn  libitm1-dbg       <none>
pn  liblsan0-dbg      <none>
pn  libmpx2-dbg       <none>
pn  libquadmath0-dbg  <none>
pn  libtsan0-dbg      <none>
pn  libubsan1-dbg     <none>

-- no debconf information

--- End Message ---
--- Begin Message ---
Version: 1:8.4.0-7+rm

Dear submitter,

as the package gcc-8 has just been removed from the Debian archive
unstable we hereby close the associated bug reports.  We are sorry
that we couldn't deal with your issue properly.

For details on the removal, please see https://bugs.debian.org/954831

The version of this package that was in Debian prior to this removal
can still be found using http://snapshot.debian.org/.

Please note that the changes have been done on the master archive and
will not propagate to any mirrors until the next dinstall run at the
earliest.

This message was generated automatically; if you believe that there is
a problem with it please contact the archive administrators by mailing
ftpmaster@ftp-master.debian.org.

Debian distribution maintenance software
pp.
Joerg Jaspert (the ftpmaster behind the curtain)

--- End Message ---

Reply to: