Bug 1573429

Summary: gcc crash when compiling with -mfma
Product: Red Hat Developer Toolset Reporter: Duncan Muirhead <Duncan.Muirhead>
Component: gccAssignee: Marek Polacek <mpolacek>
Status: CLOSED ERRATA QA Contact: Michael Petlan <mpetlan>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: DTS 7.0 RHEL 7CC: jakub, jorton, kanderso, law, mcermak, mnewsome, ohudlick
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: devtoolset-8-gcc-8.1.1-5.el7 Doc Type: Bug Fix
Doc Text:
Previously, GCC could crash when vectorizing code using FMA (Fused multiply–add) when processing a ternary operand. This bug has been fixed and the code compiles correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-11-13 08:38:30 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:
Description Flags
preprocessed source none

Description Duncan Muirhead 2018-05-01 09:04:37 UTC
Created attachment 1429136 [details]
preprocessed source

/opt/rh/devtoolset-7/root/usr/bin/gcc -std=gnu11 -Wall -g  -D_GNU_SOURCE -m64 -fopenmp  -mavx2 -O3  -ffast-math -fno-unsafe-math-optimizations -mfma fmabug.c -lm -o fmabugf
fmabug.c: In function ‘main’:
fmabug.c:63:5: internal compiler error: in compute_live_loop_exits, at tree-ssa-loop-manip.c:229
 int main( int argc, char** argv)

I wrote a small test program to try to understand why I was getting wrong answers when using the fma() function, with -mfma enabled. I built the program twice, once without -mfma, in which case it compiled and ran fine, and once with  when I got the compiler crash above.

Version-Release number of selected component (if applicable):
/user/dmuir/utils/la/test% /opt/rh/devtoolset-7/root/usr/bin/gcc --version
gcc (GCC) 7.2.1 20170829 (Red Hat 7.2.1-1)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO

How reproducible:
Compile the program

Additional info:

Comment 2 Marek Polacek 2018-05-01 13:05:41 UTC
Thanks for the bug report.  This fails even with current trunk; I'll reduce and open an upstream PR.

Comment 4 Marek Polacek 2018-05-24 15:16:15 UTC
Too late for DTS 7.

Comment 6 Marek Polacek 2018-07-13 18:14:13 UTC

Comment 8 Michael Petlan 2018-10-04 23:01:43 UTC
Reproduced with devtoolset-7-gcc.
Works with devtoolset-8-gcc-8.2.1-3.el8.x86_64.

Comment 10 errata-xmlrpc 2018-11-13 08:38:30 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.