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

            Bug ID: 90075
           Summary: [AArch64] ICE during RTL pass when member of union
                    passed to copysignf
           Product: gcc
           Version: 8.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jjhelmus at gmail dot com
  Target Milestone: ---

Created attachment 46156
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=46156&action=edit
preprocessed source of code mentioned in report

GCC 8.3.0 as well as other releases in the 8.x and 7.x line fail with an
internal compiler error when compiling the following example with -fPIC and
optimization enabled.

#include <math.h>

typedef struct { float one, two; } twofloats;

float
bug(twofloats tf)
{
    float f1, f2;
    union {
        twofloats tfloats; 
        float arr[2]; 
    } utfloats;
    utfloats.tfloats = tf; 
    f1 = utfloats.arr[1];
    f2 = copysignf(0, f1);
    return f2;
}

Using the gcc 8.3.0 docker image on a AArch64 system (RockChip rk3399) running
Ubunutu 18.04 produces the following results:

root@37bc4cc2fc49:/io# gcc --version
gcc (GCC) 8.3.0
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

root@37bc4cc2fc49:/io# gcc -Wall -Wextra -O1 -fPIC -c mre.c
during RTL pass: expand
mre.c: In function 'bug':
mre.c:15:10: internal compiler error: Segmentation fault
     f2 = copysignf(0, f1);
          ^~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.


Removing the -O1 or -fPIC arguments allow for successful compilation.

The preprocessed source is attached.

This issue was initially detected while attempting to build NumPy 1.16.3, a
popular Python library for Numerical computation, for AArch64,
https://github.com/conda-forge/numpy-feedstock/pull/138.

Reply via email to