https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90083

            Bug ID: 90083
           Summary: internal compiler error: in expand_debug_locations, at
                    cfgexpand.c:5403 with -O3 and -g
           Product: gcc
           Version: 8.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nheart at gmail dot com
  Target Milestone: ---

Created attachment 46163
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46163&action=edit
Sample triggering the bug

Hey,

The following code causes internal compiler error with -O{1-3} used in
conjunction with -g flag.

The bug gets triggered if you have a long a chain of functions that are
annotated with 

__attribute__ ((target ("avx2"))) 

But the attribute annotation is missing in one of them. The code compiles fine
with -mavx2:

g++ -O3 -g test.cpp -mavx2  

or with O0 (but produces warnings as expected):

g++ -O0 -g test.cpp      
test.cpp: In function ‘float fooBackend(const float*, const float*) [with
Register = __vector(8) float]’:
test.cpp:19:12: warning: AVX vector return without AVX enabled changes the ABI
[-Wpsabi]
   Register highest = and_ps(and_me, *begin);
            ^~~~~~~
test.cpp:19:28: warning: AVX vector argument without AVX enabled changes the
ABI [-Wpsabi]
   Register highest = and_ps(and_me, *begin);
                      ~~~~~~^~~~~~~~~~~~~~~~
test.cpp:19:28: note: The ABI for passing parameters with 32-byte alignment has
changed in GCC 4.6

Compilation also succeeds when just using O3, with warnings:

g++ -O3 test.cpp   
test.cpp: In function ‘float fooBackend(const float*, const float*) [with
Register = __vector(8) float]’:
test.cpp:19:12: warning: AVX vector return without AVX enabled changes the ABI
[-Wpsabi]
   Register highest = and_ps(and_me, *begin); 
            ^~~~~~~

However trying to compile with -O3 and -g results in a compiler crash:

g++ -O3 -g test.cpp
test.cpp: In function ‘float fooBackend(const float*, const float*) [with
Register = __vector(8) float]’:
test.cpp:19:12: warning: AVX vector return without AVX enabled changes the ABI
[-Wpsabi]
   Register highest = and_ps(and_me, *begin);
            ^~~~~~~
during RTL pass: expand
test.cpp: In function ‘float AVX2_foo(const float*, const float*)’:
test.cpp:24:41: internal compiler error: in expand_debug_locations, at
cfgexpand.c:5403
 __attribute__ ((target ("avx2"))) float AVX2_foo(const float *begin, const
float *end) {

OS: Archlinux

Reply via email to