Bug 1057611 - arm gcc internal compiler error: Segmentation fault while folding log2
Summary: arm gcc internal compiler error: Segmentation fault while folding log2
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Fedora
Classification: Fedora
Component: mpfr
Version: 19
Hardware: arm
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Frantisek Kluknavsky
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-01-24 13:18 UTC by Mark Wielaard
Modified: 2014-11-26 14:15 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-11-26 14:15:49 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Preprocessed source (57.53 KB, text/x-csrc)
2014-01-24 13:18 UTC, Mark Wielaard
no flags Details

Description Mark Wielaard 2014-01-24 13:18:22 UTC
Created attachment 854972 [details]
Preprocessed source

Description of problem:

Compiler crashes

Version-Release number of selected component (if applicable):

GNU C (GCC) version 4.8.2 20131212 (Red Hat 4.8.2-7) (armv7hl-redhat-linux-gnueabi)
	compiled by GNU C version 4.8.2 20131212 (Red Hat 4.8.2-7), GMP version 5.1.1, MPFR version 3.1.1, MPC version 1.0.1

How reproducible:

Always

Steps to Reproduce:

cat > fold_log.c <<\EOF
#include <stdio.h>
#include <math.h>

#define NMNES 515

int 
main (int argc, char **argv)
{
  printf ("#define LOG2 %ld\n", log2 (NMNES));
}
EOF

gcc -lm fold_log.c 
fold_log.c: In function ‘main’:
fold_log.c:9:3: internal compiler error: Segmentation fault
   printf ("#define LOG2 %ld\n", log2 (NMNES));
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccoxwyNa.out file, please attach this to your bugreport.

Additional info:

gcc -v output

Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/armv7hl-redhat-linux-gnueabi/4.8.2/lto-wrapper
Target: armv7hl-redhat-linux-gnueabi
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-linker-hash-style=gnu --enable-languages=c,c++,objc,obj-c++,java,fortran,go,lto --enable-plugin --enable-initfini-array --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-isl=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-armv7hl-redhat-linux-gnueabi/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.2-20131212/obj-armv7hl-redhat-linux-gnueabi/cloog-install --disable-sjlj-exceptions --with-cpu=cortex-a8 --with-tune=cortex-a8 --with-arch=armv7-a --with-float=hard --with-fpu=vfpv3-d16 --with-abi=aapcs-linux --build=armv7hl-redhat-linux-gnueabi
Thread model: posix
gcc version 4.8.2 20131212 (Red Hat 4.8.2-7) (GCC) 
COLLECT_GCC_OPTIONS='-v' '-march=armv7-a' '-mtune=cortex-a8' '-mfloat-abi=hard' '-mfpu=vfpv3-d16' '-mabi=aapcs-linux' '-mtls-dialect=gnu'
 /usr/libexec/gcc/armv7hl-redhat-linux-gnueabi/4.8.2/cc1 -quiet -v fold_log.c -quiet -dumpbase fold_log.c -march=armv7-a -mtune=cortex-a8 -mfloat-abi=hard -mfpu=vfpv3-d16 -mabi=aapcs-linux -mtls-dialect=gnu -auxbase fold_log -version -o /tmp/cczrUrzB.s
GNU C (GCC) version 4.8.2 20131212 (Red Hat 4.8.2-7) (armv7hl-redhat-linux-gnueabi)
	compiled by GNU C version 4.8.2 20131212 (Red Hat 4.8.2-7), GMP version 5.1.1, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128383
ignoring nonexistent directory "/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.2/include-fixed"
ignoring nonexistent directory "/usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.2/../../../../armv7hl-redhat-linux-gnueabi/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/armv7hl-redhat-linux-gnueabi/4.8.2/include
 /usr/local/include
 /usr/include
End of search list.
GNU C (GCC) version 4.8.2 20131212 (Red Hat 4.8.2-7) (armv7hl-redhat-linux-gnueabi)
	compiled by GNU C version 4.8.2 20131212 (Red Hat 4.8.2-7), GMP version 5.1.1, MPFR version 3.1.1, MPC version 1.0.1
GGC heuristics: --param ggc-min-expand=98 --param ggc-min-heapsize=128383
Compiler executable checksum: 877e64805a2c4885288c6cdee81b52fd
fold_log.c: In function ‘main’:
fold_log.c:9:3: internal compiler error: Segmentation fault
   printf ("#define LOG2 %ld\n", log2 (NMNES));
   ^
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccgEG2Xv.out file, please attach this to your bugreport.


gdb backtrace:

#0  0x00000000 in ?? ()
#1  0x46ffca28 in mpfr_cache (dest=dest@entry=0xbeffe070, cache=0xb6ff94e4, 
    rnd=rnd@entry=MPFR_RNDD) at cache.c:67
#2  0x46feff9c in mpfr_log2 (r=0xbeffe0b8, a=0xbeffe0b8, rnd_mode=MPFR_RNDN)
    at log2.c:118
#3  0x00172324 in do_mpfr_arg1 (arg=<optimized out>, arg@entry=0xb67f8d60, 
    type=type@entry=0xb69ed900, func=func@entry=0xda348 <mpfr_log2>, 
    min=0xb1d084 <dconst0>, max=max@entry=0x0, inclusive=inclusive@entry=false)
    at ../../gcc/builtins.c:13693
#4  0x00180c28 in fold_builtin_logarithm (loc=loc@entry=844139, 
    fndecl=fndecl@entry=0xb6a15f00, arg=arg@entry=0xb67f8d60, 
    func=0xda348 <mpfr_log2>) at ../../gcc/builtins.c:8259
#5  0x00184ee8 in fold_builtin_1 (loc=844139, fndecl=0xb6a15f00, 
    arg0=0xb67f8d60, ignore=ignore@entry=false) at ../../gcc/builtins.c:10524
#6  0x0017db2c in fold_builtin_n (loc=loc@entry=844139, 
    fndecl=fndecl@entry=0xb6a15f00, args=args@entry=0xb68132fc, 
    nargs=nargs@entry=1, ignore=ignore@entry=false)
    at ../../gcc/builtins.c:11067
#7  0x00186598 in fold_call_expr (loc=844139, exp=exp@entry=0xb68132e0, 
    ignore=ignore@entry=false) at ../../gcc/builtins.c:11194
#8  0x00291714 in fold (expr=expr@entry=0xb68132e0)
    at ../../gcc/fold-const.c:14525
#9  0x00142b44 in c_fully_fold_internal (expr=expr@entry=0xb68132e0, 
    in_init=<optimized out>, 
    maybe_const_operands=maybe_const_operands@entry=0xbeffe356, 
    maybe_const_itself=0x7a, maybe_const_itself@entry=0xbeffe34f)
    at ../../gcc/c-family/c-common.c:1112
#10 0x00143994 in c_fully_fold (expr=expr@entry=0xb68132e0, 
    in_init=in_init@entry=false, maybe_const=0xbeffe356, maybe_const@entry=0x0)
    at ../../gcc/c-family/c-common.c:1062
#11 0x00106e5c in convert_arguments (fundecl=<optimized out>, function=0x0, 
    origtypes=0xb680f8b8, values=0x0, typelist=0xb69fae10)
    at ../../gcc/c/c-typeck.c:2979
#12 build_function_call_vec (loc=0, loc@entry=844133, function=0xb68132e0, 
    function@entry=0xb6a05a80, params=0x0, params@entry=0xb680f810, 
    origtypes=0xb680f8b8) at ../../gcc/c/c-typeck.c:2771
#13 0x00115b18 in c_parser_postfix_expression_after_primary (
    parser=parser@entry=0xb6b66de0, expr_loc=3204441544, 
    expr_loc@entry=844128, expr=...) at ../../gcc/c/c-parser.c:6908
#14 0x0010ec7c in c_parser_postfix_expression (parser=parser@entry=0xb6b66de0)
    at ../../gcc/c/c-parser.c:6770
#15 0x00110518 in c_parser_unary_expression (parser=parser@entry=0xb6b66de0)
    at ../../gcc/c/c-parser.c:5969
#16 0x00113bb0 in c_parser_cast_expression (parser=0xb6b66de0, 
    parser@entry=0x0, after=after@entry=0x0) at ../../gcc/c/c-parser.c:5821
#17 0x00113da4 in c_parser_binary_expression (parser=0x0, 
    parser@entry=0xb6b66de0, after=0x0, prec=prec@entry=PREC_NONE)
    at ../../gcc/c/c-parser.c:5632
#18 0x001144d4 in c_parser_conditional_expression (
    parser=parser@entry=0xb6b66de0, after=<optimized out>)
    at ../../gcc/c/c-parser.c:5427
#19 0x001148f4 in c_parser_expr_no_commas (parser=parser@entry=0xb6b66de0, 
    after=after@entry=0x0) at ../../gcc/c/c-parser.c:5347
#20 0x0011531c in c_parser_expr_list (parser=parser@entry=0xb6b66de0, 
    convert_p=convert_p@entry=true, fold_p=fold_p@entry=false,

Comment 1 Mark Wielaard 2014-01-25 20:39:56 UTC
This seems f19 specific. I upgraded to the gcc f20 version:

GNU C (GCC) version 4.8.2 20131212 (Red Hat 4.8.2-7) (armv7hl-redhat-linux-gnueabi)
	compiled by GNU C version 4.8.2 20131212 (Red Hat 4.8.2-7), GMP version 5.1.2, MPFR version 3.1.2, MPC version 1.0.1

That version does compile and runs the code just fine.

Comment 2 Jakub Jelinek 2014-01-27 07:09:18 UTC
Sounds like a mpfr bug to me.

Comment 3 Frantisek Kluknavsky 2014-11-26 14:15:49 UTC
Works for me in both F19 and F20. 
3.9.5-301.fc19.armv7hl #1 SMP Wed Jun 12 14:56:17 UTC 2013 armv7l GNU/Linux
model name      : ARMv7 Processor rev 0 (v7l)
BogoMIPS        : 2190.54
Features        : swp half thumb fastmult vfp edsp thumbee neon vfpv3 tls 
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x3
CPU part        : 0xc09
CPU revision    : 0
gcc-4.8.1-1.fc19.armv7hl
mpfr-3.1.1-2.fc19.armv7hl

Considering the F19 nearing end of life and rebase of MPFR in F20 I will close this bug. If you still need it fixed, feel free to reopen.

I know it is a big demand, but providing access to a machine where the crash happens would be absolutely awesome.


Note You need to log in before you can comment on or make changes to this bug.