Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 757792 - sys-devel/gcc-10.2.0-r3: strncmp miscompiles as memcmp (breaks sys-apps/smartmontools)
Summary: sys-devel/gcc-10.2.0-r3: strncmp miscompiles as memcmp (breaks sys-apps/smart...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/bugzilla/show_bug...
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 915000
  Show dependency tree
 
Reported: 2020-11-30 18:28 UTC by Matt Whitlock
Modified: 2023-10-01 06:04 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Whitlock 2020-11-30 18:28:33 UTC
Could we please have a hotfix for sys-devel/gcc-10.2.0 to include the patch for the upstream bug linked in [URL]?

The patch[1] applies cleanly to sys-devel/gcc-10.2.0-r3 and resolves the issue in sys-apps/smartmontools discussed at [2].

[1] https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=0dbfa88edafbe913a7a9099246041e0190aa3948;hp=7e53436da1902061af797d0aaa744c52bd9829ae

[2] https://bugzilla.redhat.com/show_bug.cgi?id=1896161

To summarize: sys-apps/smartmontools-7.1 is unable to directly address drives behind a 3ware RAID controller due to a miscompilation of a strncmp function call caused by a bug in GCC 10 that has been patched upstream and is to be included in GCC 10.3.

While we wait for the release of GCC 10.3, could we get a revbump of GCC 10.2 to include the patch for this bug and maybe also Bug 746749? That bug is currently marked as "wait for upstream release" but, like this bug, is causing miscompilations today and could easily be patched in a hotfix revbump.
Comment 1 Larry the Git Cow gentoo-dev 2020-12-01 19:18:30 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=9b342fdeb8588681bb106e072cefd481a045fb21

commit 9b342fdeb8588681bb106e072cefd481a045fb21
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-12-01 19:16:33 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-12-01 19:16:33 +0000

    10.2.0: backport strncmp() folding
    
    Reported-by: Matt Whitlock
    Bug: https://bugs.gentoo.org/757792
    Bug: https://gcc.gnu.org/PR96758
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/41_all_strlen-PR96758.patch | 95 +++++++++++++++++++++++++++++++
 10.2.0/gentoo/README.history              |  3 +
 2 files changed, 98 insertions(+)
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-12-01 19:19:54 UTC
Queued patch for next gcc-10.2.0 patchset. It usually takes a few weeks to cut a new release. Meanwhile you can drop a patch to /etc/portage/patches/sys-devel/gcc:10/ and verify if it's enough to fix the underlying bug.
Comment 3 Matt Whitlock 2020-12-01 20:09:13 UTC
(In reply to Sergei Trofimovich from comment #2)
> Meanwhile you can drop a patch to
> /etc/portage/patches/sys-devel/gcc:10/ and verify if it's enough to fix the
> underlying bug.

I did that. (Actually to /etc/portage/patches/sys-devel/gcc-10.2.0-r3 so I don't have to remember to delete it when -r4 is released.) It does solve the underlying issue, as I noted. My smartctl is again able to address the underlying drives in my 3ware RAID.
Comment 4 Larry the Git Cow gentoo-dev 2020-12-18 21:04:26 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f0e31bd8e8a4d7a67033600a0331a6deb7db1cc4

commit f0e31bd8e8a4d7a67033600a0331a6deb7db1cc4
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-12-18 21:03:32 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-12-18 21:04:24 +0000

    sys-devel/gcc:  10.2.0: cut 5 patchset
    
    Single new patch:
    + 41_all_strlen-PR96758.patch: fix string comparison against literals
    
    Bug: https://bugs.gentoo.org/757792
    Package-Manager: Portage-3.0.12, Repoman-3.0.2
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/gcc/Manifest             |  1 +
 sys-devel/gcc/gcc-10.2.0-r4.ebuild | 18 ++++++++++++++++++
 2 files changed, 19 insertions(+)
Comment 5 Larry the Git Cow gentoo-dev 2020-12-29 09:55:21 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/gcc-patches.git/commit/?id=e71e59c25315ebda3ebf4014bb108db9dda08a27

commit e71e59c25315ebda3ebf4014bb108db9dda08a27
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-12-18 20:57:44 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-12-18 20:57:44 +0000

    10.2.0: cut 5 patchset
    
    Single new patch:
    + 41_all_strlen-PR96758.patch: fix string comparison against literals
    
    Bug: https://bugs.gentoo.org/757792
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.2.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)