/usr/lib/gcc/x86_64-linux-gnu/4.5/lto1 crashes with segmentation fault when both -fopenmp and -flto are used

Bug #690194 reported by Volodymyr Kolesnykov
16
This bug affects 1 person
Affects Status Importance Assigned to Milestone
binutils (Ubuntu)
Fix Released
Undecided
Unassigned
Oneiric
Fix Released
Undecided
Unassigned
gcc-4.5 (Ubuntu)
Invalid
Undecided
Unassigned
Oneiric
Invalid
Undecided
Unassigned
gcc-4.6 (Ubuntu)
Invalid
Undecided
Unassigned
Oneiric
Invalid
Undecided
Unassigned

Bug Description

Binary package hint: gcc-4.5

$ lsb_release -rd
Description: Ubuntu 10.10
Release: 10.10

$ LC_ALL=C apt-cache policy gcc-4.5
gcc-4.5:
  Installed: 4.5.1-7ubuntu2
  Candidate: 4.5.1-7ubuntu2
  Version table:
 *** 4.5.1-7ubuntu2 0
        500 http://ua.archive.ubuntu.com/ubuntu/ maverick/main amd64 Packages
        100 /var/lib/dpkg/status

Test file will be attached.

$ gcc-4.5 test.c -o test -O1 -fopenmp -flto -std=c99
lto1: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.5/README.Bugs> for instructions.
lto-wrapper: /usr/bin/gcc-4.5.real returned 1 exit status
collect2: lto-wrapper returned 1 exit status

The bug does not happen with -O0, or when either -flto or -fopenmp is not used

Despite 'ulimit -c unlimited', core file is not generated.
---
Architecture: amd64
DistroRelease: Ubuntu 10.10
NonfreeKernelModules: fglrx
Package: gcc-4.5 4.5.1-7ubuntu2
PackageArchitecture: amd64
ProcEnviron:
 LANGUAGE=ru_RU:ru
 LANG=ru_RU.UTF-8
 SHELL=/bin/bash
ProcVersionSignature: Ubuntu 2.6.35-23.41-server 2.6.35.7
Tags: maverick
Uname: Linux 2.6.35-23-server x86_64
UserGroups: adm admin cdrom dialout lpadmin plugdev sambashare vboxusers

Related branches

Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :

Minimal test case on which the bug can be reproduced

Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :

Preprocessed version of test.c

Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :

Backtrace.

Obtained by using

gcc-4.5 test.c -o test -Os -fopenmp -flto -std=c99 -save-temps -v

and then

gdb /usr/lib/gcc/x86_64-linux-gnu/4.5.1/lto1

with the arguments displayed by gcc -v

Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :

If necessary, can attach

/tmp/cc5yp0gX.lto.o
/tmp/ccvA4NFX
test.s

as well

tags: added: apport-collected
description: updated
Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote : Dependencies.txt

apport information

Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :

Same happens with -fwhopr instead of -flto

Revision history for this message
Matthias Klose (doko) wrote :

please could you recheck this with gcc-4.6 (in an oneiric chroot)

Changed in gcc-4.6 (Ubuntu):
status: New → Incomplete
Revision history for this message
Volodymyr Kolesnykov (sjinks) wrote :
Download full text (11.8 KiB)

With gcc-4.6 I see a different bug.

When compiling without -flto, ie

gcc test.c -o test -O1 -fopenmp -std=c99

everything is fine.

With -flto:

$ gcc test.c -o test -O1 -fopenmp -flto -std=c99
/tmp/cckxIhdE.ltrans0.ltrans.o: In function `main._omp_fn.0.2060.2020':
cckxIhdE.ltrans0.o:(.text+0x2): undefined reference to `omp_get_num_threads'
cckxIhdE.ltrans0.o:(.text+0x9): undefined reference to `omp_get_thread_num'
/tmp/cckxIhdE.ltrans0.ltrans.o: In function `main':
cckxIhdE.ltrans0.o:(.text+0x87): undefined reference to `GOMP_parallel_start'
cckxIhdE.ltrans0.o:(.text+0x8c): undefined reference to `GOMP_parallel_end'
collect2: ld returned 1 exit status

$ gcc test.c -o test -O1 -fopenmp -flto -std=c99 -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.1-4ubuntu1' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++,go --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-multiarch --with-multiarch-defaults=x86_64-linux-gnu --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib/x86_64-linux-gnu --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib/x86_64-linux-gnu --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.1 (Ubuntu/Linaro 4.6.1-4ubuntu1)
COLLECT_GCC_OPTIONS='-o' 'test' '-O1' '-fopenmp' '-flto' '-std=c99' '-v' '-mtune=generic' '-march=x86-64' '-pthread'
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/cc1 -quiet -v -D_REENTRANT test.c -quiet -dumpbase test.c -mtune=generic -march=x86-64 -auxbase test -O1 -std=c99 -version -fopenmp -flto -fstack-protector -o /tmp/ccjn2A1G.s
GNU C (Ubuntu/Linaro 4.6.1-4ubuntu1) version 4.6.1 (x86_64-linux-gnu)
        compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory "/usr/local/include/x86_64-linux-gnu"
ignoring nonexistent directory "/usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/../../../../../x86_64-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include
 /usr/local/include
 /usr/lib/x86_64-linux-gnu/gcc/x86_64-linux-gnu/4.6.1/include-fixed
 /usr/include/x86_64-linux-gnu
 /usr/include
End of search list.
GNU C (Ubuntu/Linaro 4.6.1-4ubuntu1) version 4.6.1 (x86_64-linux-gnu)
        compiled by GNU C version 4.6.1, GMP version 5.0.1, MPFR version 3.0.1-p3, MPC version 0.9
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: f4dac7f0dc853914603e09c85c5ce51e
COLLECT_GCC_OPTIONS='-o' 'test' '-O1' '-fopenmp' '-flto' '-std=c99' '-v' '-mtune=ge...

Matthias Klose (doko)
Changed in gcc-4.5 (Ubuntu):
status: New → Invalid
Changed in gcc-4.6 (Ubuntu):
status: Incomplete → Invalid
Changed in binutils (Ubuntu):
status: New → In Progress
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils - 2.21.53.20110810-0ubuntu3

---------------
binutils (2.21.53.20110810-0ubuntu3) oneiric; urgency=low

  * Fix PR ld/13201, link error with --as-needed and -flto. LP: #778292.
    LP: #690194.
 -- Matthias Klose <email address hidden> Tue, 20 Sep 2011 11:34:33 +0200

Changed in binutils (Ubuntu Oneiric):
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.