Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 722774 - =sys-devel/gcc-10.1.0: hangs on -O3 -fopt-info-vec (ARCH=amd64)
Summary: =sys-devel/gcc-10.1.0: hangs on -O3 -fopt-info-vec (ARCH=amd64)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL: https://gcc.gnu.org/PR95118
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-13 00:16 UTC by Adrien Dessemond
Modified: 2020-06-11 23:05 UTC (History)
0 users

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


Attachments
build.log of app-arch/gzip (build.log,6.31 KB, application/octet-stream)
2020-05-13 18:57 UTC, Adrien Dessemond
Details
emerge --info (emerge_info.log,6.25 KB, text/plain)
2020-05-13 18:59 UTC, Adrien Dessemond
Details
perf top at the time the configure script hangs (perf_top.log,620 bytes, text/plain)
2020-05-13 19:51 UTC, Adrien Dessemond
Details
Proposed addition to the "Gentoo patch set" for GCC (29_all_pr95118-fix.patch,432 bytes, text/plain)
2020-05-14 14:28 UTC, Adrien Dessemond
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Adrien Dessemond 2020-05-13 00:16:40 UTC
When GCC is invoked in some autotools configure scripts, the script hangs at with a message like:
checking whether printf supports infinite 'long double' arguments...

This is perfectly reproducible when emerging app-arch/gzip (for example).

Doing an "iperf top" shows that cc1 is spinning in the C function "real_to_decimal_for_mode".

The issue comes from using "-O3" or "-O2 -ftree-vectorize" in CFLAGS so as soon as the vectorization is enabled.

Tested in my production environment and a brand new testing environment mounted from a very recent stage3 archive.

Not tested with a vanilla GCC 10.1, yet.


Reproducible: Always
Comment 1 Adrien Dessemond 2020-05-13 00:34:35 UTC
"iperf top" => "perf top" sorry for the typo.
Comment 2 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-13 18:10:54 UTC
(In reply to Adrien Dessemond from comment #0)
> When GCC is invoked in some autotools configure scripts, the script hangs at
> with a message like:
> checking whether printf supports infinite 'long double' arguments...
> 
> This is perfectly reproducible when emerging app-arch/gzip (for example).
> 
> Doing an "iperf top" shows that cc1 is spinning in the C function
> "real_to_decimal_for_mode".
> 
> The issue comes from using "-O3" or "-O2 -ftree-vectorize" in CFLAGS so as
> soon as the vectorization is enabled.
> 
> Tested in my production environment and a brand new testing environment
> mounted from a very recent stage3 archive.
> 
> Not tested with a vanilla GCC 10.1, yet.
> 
> 
> Reproducible: Always

Can you provide 'emerge --info' and 'build.log' of a hung gzip?
Comment 3 Adrien Dessemond 2020-05-13 18:57:22 UTC
Created attachment 638652 [details]
build.log of app-arch/gzip

Log of "emerge app-arch/gzip", the last line is where the configure script hungs at.  (Ctrl-C pressed).
Comment 4 Adrien Dessemond 2020-05-13 18:59:27 UTC
Created attachment 638654 [details]
emerge --info

-march=native => znver2 (AND Zen 2)
Comment 5 Adrien Dessemond 2020-05-13 19:51:12 UTC
Created attachment 638660 [details]
perf top at the time the configure script hangs

Revisiting this report a bit, we see what is attached in 'perf_top.log' when the hangs occurs.
Comment 6 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-13 21:28:26 UTC
Can you extract exact .c source file that configure is running on your machine and verify it still hangs on the same compiler flags running manually?

config.log should contain the compiler command and https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide has hints on how to extract preprocessed file.
Comment 7 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-13 21:40:01 UTC
Reproduced locally. I should be able to proceed myself.
Comment 8 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-13 22:04:33 UTC
The following seems to be an enough reproducer:

// $ cat bug.c
void a();
void b() {
  union {
    int c[4];
    long double d;
  } e = {{0, 0, 4}};
  a(e.d);
}

$ /usr/bin/x86_64-pc-linux-gnu-gcc -o conftest -O3 -fopt-info-vec -c bug.c
<hangs>

You might want to remove -fopt-info-vec as a workaround meanwhile.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-13 22:11:01 UTC
Reported upstream as https://gcc.gnu.org/PR95118
Comment 10 Adrien Dessemond 2020-05-14 01:05:34 UTC
I removed "-fopt-info-vec" and the hang does not occur. Good catch, thank you so much for your quick handling.
Comment 11 Adrien Dessemond 2020-05-14 14:22:46 UTC
After applying the upstream commit 568c985113b29574c4e25e1a016475668fc17c28 to the file real.c (see https://gcc.gnu.org/git/gitweb.cgi?p=gcc.git;h=568c985113b29574c4e25e1a016475668fc17c28 ), the hang does not occur anymore.
Comment 12 Adrien Dessemond 2020-05-14 14:28:43 UTC
Created attachment 638984 [details]
Proposed addition to the "Gentoo patch set" for GCC

I have added this file to my local copy of gcc-10.1.0-patches-1.tar.bz2. GCC 10.1.0 can be emerged builds without any issue and the emerged GCC does not hang anymore with -fopt-info-vec :)
Comment 13 Larry the Git Cow gentoo-dev 2020-05-14 17:58:25 UTC
The bug has been referenced in the following commit(s):

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

commit c355f9b13f537be7717c3dafe1510976cdb8584e
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-05-14 17:57:26 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-05-14 17:57:26 +0000

    10.1.0: backport infinite loop in float print, bug #722774
    
    Reported-by: Adrien Dessemond
    Bug: https://gcc.gnu.org/PR95118
    Bug: https://bugs.gentoo.org/722774
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.1.0/gentoo/29_all_fix-float-hang-PR95118.patch | 54 +++++++++++++++++++++++
 10.1.0/gentoo/README.history                      |  3 ++
 2 files changed, 57 insertions(+)
Comment 14 Sergei Trofimovich (RETIRED) gentoo-dev 2020-05-14 18:00:29 UTC
Queued the fix for next patchset of gcc (might take weeks to months to get to gentoo).

Meanwhile you can drop the patch to /etc/portage/patches/ and see if it works for you.
Comment 15 Larry the Git Cow gentoo-dev 2020-06-11 23:00:21 UTC
The bug has been referenced in the following commit(s):

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

commit 3c29cc8edec29f4cc48ffc77004cfd9d06b220c7
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-06-11 22:52:51 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-06-11 22:52:51 +0000

    10.1.0: cut 2 patchset
    
    Four new patches:
    + 29_all_fix-float-hang-PR95118.patch: fix looping in printing real numbers
    + 30_all_lto-intl-workaround-PR95194.patch: add a workaround to fix gettext LTO
    + 31_all_ctor-range-PR95241.patch: fix constexpr constructors with ranges
    + 32_all_plugin-objdump.patch: user tuple-prefixed objdump
    
    Bug: https://gcc.gnu.org/PR95118
    Bug: https://bugs.gentoo.org/722774
    Reported-by: Andrew Savchenko
    Bug: https://gcc.gnu.org/PR95194
    Bug: https://bugs.gentoo.org/723370
    Bug: https://gcc.gnu.org/PR95241
    Bug: https://bugs.gentoo.org/726644
    Bug: https://gcc.gnu.org/PR95648
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 10.1.0/gentoo/README.history | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 16 Larry the Git Cow gentoo-dev 2020-06-11 23:05:15 UTC
The bug has been closed via the following commit(s):

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

commit 376f4a461521d7d7482c6ba4bc34a798bca0a120
Author:     Sergei Trofimovich <slyfox@gentoo.org>
AuthorDate: 2020-06-11 23:01:24 +0000
Commit:     Sergei Trofimovich <slyfox@gentoo.org>
CommitDate: 2020-06-11 23:05:10 +0000

    sys-devel/gcc: 10.1.0: cut 2 patchset
    
    Four new patches:
    + 29_all_fix-float-hang-PR95118.patch: fix looping in printing real numbers
    + 30_all_lto-intl-workaround-PR95194.patch: add a workaround to fix gettext LTO
    + 31_all_ctor-range-PR95241.patch: fix constexpr constructors with ranges
    + 32_all_plugin-objdump.patch: user tuple-prefixed objdump
    
    Bug: https://gcc.gnu.org/PR95118
    Closes: https://bugs.gentoo.org/722774
    Reported-by: Andrew Savchenko
    Bug: https://gcc.gnu.org/PR95194
    Closes: https://bugs.gentoo.org/723370
    Bug: https://gcc.gnu.org/PR95241
    Closes: https://bugs.gentoo.org/726644
    Bug: https://gcc.gnu.org/PR95648
    Package-Manager: Portage-2.3.100, Repoman-2.3.22
    Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>

 sys-devel/gcc/Manifest             |  1 +
 sys-devel/gcc/gcc-10.1.0-r1.ebuild | 13 +++++++++++++
 2 files changed, 14 insertions(+)