Bug 1538648

Summary: gcc: internal compiler error: in ix86_expand_prologue:14572
Product: [Fedora] Fedora Reporter: Miroslav Lichvar <mlichvar>
Component: gccAssignee: Jeff Law <law>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: aoliva, davejohansen, fweimer, herrold, jakub, jaruga, jwakely, law, mpolacek, sergio, tagoh, tomek, wcohen
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: gcc-8.0.1-0.8.fc28 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-02-01 14:37:13 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
bz1538648-2.ii
none
bz1538648-1.i
none
Fixed librpm.so.8.0.1 for i686 none

Description Miroslav Lichvar 2018-01-25 14:16:36 UTC
Description of problem:
The current chrony package in rawhide fails to build on i686. If fails on multiple files with "internal compiler error: in ix86_expand_prologue, at config/i386/i386.c:14572".

https://kojipkgs.fedoraproject.org//work/tasks/8628/24438628/build.log

Version-Release number of selected component (if applicable):
gcc-7.2.1-8.fc28

How reproducible:
Always

Comment 1 Marek Polacek 2018-01-25 14:20:19 UTC
Preprocessed source stored into /tmp/cc3j4g1g.out file, please attach this to your bugreport.

Can you please provide one of these?

Comment 2 Jeff Law 2018-01-25 14:28:39 UTC
Definitely need the cpp output.

Comment 3 Florian Weimer 2018-01-25 14:34:15 UTC
Created attachment 1386105 [details]
bz1538648-2.ii

Preprocessed sources from building audacious-plugins-3.9-4.fc28.

Compile with -march=i686 -fstack-clash-protection -O2.

Comment 4 Miroslav Lichvar 2018-01-25 14:37:49 UTC
Hm, I'm not sure how to get a file from a Fedora build machine. FWIW, a local build with gcc-7.2.1-7.fc28 works. Any chance it is related to bug #1536555, which was addressed in -8?

Comment 5 Florian Weimer 2018-01-25 14:40:01 UTC
Created attachment 1386106 [details]
bz1538648-1.i

Preprocessed sources from chrony-3.2-2.fc28.

Compile with: -O2 -march=i686 -fstack-clash-protection

Comment 6 Florian Weimer 2018-01-25 14:43:08 UTC
Obviously, we need to fix this, but an immediate workaround would be to switch to generic tuning (-mtune=generic) on i686, like we do on x86-64, via redhat-rpm-config.

Comment 7 Florian Weimer 2018-01-25 15:37:10 UTC
That we run into this bug made me realize that we do not build i686 with generic tuning, as intended, and as is the GCC default (otherwise, we wouldn't have to specify -march=i686 explicitly to trigger this bug).

redhat-rpm-config-85-1.fc28 is now in the rawhide buildroot which activates generic tuning for i686, thus papering over all the instances of the bug I have seen so far.  (And stack clash protection is still enabled.)

Comment 8 Florian Weimer 2018-01-25 16:00:45 UTC
Created attachment 1386187 [details]
Fixed librpm.so.8.0.1 for i686

librpm from rpm-4.14.1-3.fc28

Comment 9 Florian Weimer 2018-01-25 16:02:46 UTC
To recover rpm on an affected i686 system, use these steps:

# curl https://bugzilla.redhat.com/attachment.cgi?id=1386187 > /usr/lib/librpm.so.8.0.1.new
# mv /usr/lib/librpm.so.8.0.1.new /usr/lib/librpm.so.8.0.1

After that, you can update rpm-libs regularly.

Comment 10 Florian Weimer 2018-01-25 16:26:48 UTC
bz1538648-1.i also crashes with upstream GCC (trunk@257053):

during RTL pass: pro_and_epilogue
array.c: In function ‘ARR_CreateInstance’:
array.c:57:1: internal compiler error: in ix86_expand_prologue, at config/i386/i386.c:13740

Comment 11 Sergio Basto 2018-01-25 17:08:50 UTC
Hope that can help something: 

https://kojipkgs.fedoraproject.org//work/tasks/9268/24439268/build.log

cd /builddir/build/BUILD/opencv-3.3.1/build/modules/core && /usr/bin/c++  -DCVAPI_EXPORTS -D_USE_MATH_DEFINES -D__OPENCV_BUILD=1 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DHAVE_MALLOC_H=1 -DHAVE_MEMALIGN=1 -DHAVE_POSIX_MEMALIGN=1 -I/builddir/build/BUILD/opencv-3.3.1/build -isystem /usr/include/gdal -isystem /usr/include/eigen3 -isystem /usr/include/openblas -I/builddir/build/BUILD/opencv-3.3.1/modules/core/include -I/builddir/build/BUILD/opencv-3.3.1/modules/core/src -I/builddir/build/BUILD/opencv-3.3.1/build/modules/core  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m32 -march=i686 -fasynchronous-unwind-tables -fstack-clash-protection -Wl,--as-needed   -fsigned-char -W -Wall -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Winit-self -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-comment -Wno-implicit-fallthrough -fdiagnostics-show-option -pthread -march=i686 -fomit-frame-pointer -ffunction-sections  -msse -msse2 -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden -fPIC   -o CMakeFiles/opencv_core.dir/src/alloc.cpp.o -c /builddir/build/BUILD/opencv-3.3.1/modules/core/src/alloc.cpp

make[2]: Leaving directory '/builddir/build/BUILD/opencv-3.3.1/build'
*** WARNING *** there are active plugins, do not report this as a bug unless you can reproduce it without enabling any plugins.
Event                            | Plugins
PLUGIN_FINISH_UNIT               | Generate final annotations
PLUGIN_START_UNIT                | Generate global annotations
PLUGIN_ALL_PASSES_END            | Generate per-function annotations
/builddir/build/BUILD/opencv-3.3.1/modules/core/src/algorithm.cpp: In destructor 'cv::Algorithm::~Algorithm()':
/builddir/build/BUILD/opencv-3.3.1/modules/core/src/algorithm.cpp:56:1: internal compiler error: in ix86_expand_prologue, at config/i386/i386.c:14572
 }
 ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
{standard input}: Assembler messages:
{standard input}: Error: .size expression for algorithm.cpp does not evaluate to a constant
Preprocessed source stored into /tmp/ccmTqu4D.out file, please attach this to your bugreport.
make[2]: *** [modules/core/CMakeFiles/opencv_core.dir/build.make:93: modules/core/CMakeFiles/opencv_core.dir/src/algorithm.cpp.o] Error 1

Comment 12 Florian Weimer 2018-01-26 13:23:39 UTC
Reduced test case from bz1538648-1.i (the size argument to the memcpy matters):

void
f (void *p1, void *p2)
{
  __builtin_memcpy (p1, p2, 1000);
}

Compile with: -O2 -m32 -march=i686 -fstack-clash-protection

Comment 13 Florian Weimer 2018-01-29 11:07:09 UTC
*** Bug 1539625 has been marked as a duplicate of this bug. ***

Comment 14 Tomasz Torcz 2018-01-31 16:37:39 UTC
FYI, owfs also failed with that:
https://kojipkgs.fedoraproject.org//work/tasks/9943/24599943/build.log

Only on i686, so it's not important.