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

            Bug ID: 67741
           Summary: Invalid built-in usage should not cause segmentation
                    fault in compiler
           Product: gcc
           Version: 5.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kostikbel at ukr dot net
  Target Milestone: ---

Created attachment 36406
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36406&action=edit
Test case causing segfault

With gcc 5.2.0, on freebsd both x86_64 and armv6, the attached example
segfaults the compiler, if compiled with optimization:

x86_64:
pooma% /usr/local/opt/gcc-5.2.0/bin/gcc -O -c 1.c
1.c: In function 'cabsf':
1.c:6:22: warning: argument 'fc' doesn't match built-in prototype
 struct singlecomplex fc ;
                      ^
1.c:5:7: internal compiler error: Segmentation fault
 float cabsf(fc)
       ^
0x9d4b5f crash_signal
        ../../gcc-5.2.0/gcc/toplev.c:383
0x69f835 mathfn_built_in_1
        ../../gcc-5.2.0/gcc/builtins.c:1969
0xad6d21 gimple_expand_builtin_cabs
        ../../gcc-5.2.0/gcc/tree-ssa-math-opts.c:1403
0xad6d21 execute
        ../../gcc-5.2.0/gcc/tree-ssa-math-opts.c:1584
Please submit a full bug report,
with preprocessed source if appropriate.

arm:
rp% /usr/local/bin/gcc5 -O -g -march=armv7-a -mfloat-abi=softfp -ffloat-store
-DNO_FUNCF -DNTESTS=1000000 -DNREGIONS=16 -DQUIET -DNO_FAIL -c /tmp/1.c
/tmp/1.c: In function 'cabsf':
/tmp/1.c:6:22: warning: argument 'fc' doesn't match built-in prototype
 struct singlecomplex fc ;
                      ^
/tmp/1.c:5:7: internal compiler error: Segmentation fault
 float cabsf(fc)
       ^
libbacktrace could not find executable to open
Please submit a full bug report,
with preprocessed source if appropriate.

The code fragment is from the UCBTEST http://www.netlib.org/fp/ucbtest.tgz

Apparently, gcc 5.1.1 from fc22 also segfaults on the sample.

Reply via email to