ld version 2.16.1 crashes due to a null pointer when trying to report a warning related to a gcc object file compiled with -fopenmp. The offending line in 2.16.1 is bfd.c:481, where abfd is NULL:
if (p[1] == 'B') { bfd *abfd = va_arg (ap, bfd *); if (abfd->my_archive) snprintf (bufp, avail, "%s(%s)", abfd->my_archive->filename, abfd->filename); This bug can be reproduced using as follows, using the 2 files ctp.c and csimple.c, and gcc 4.2.0 20060601. (The ld -r line is necessary here.) (776)% cat ctp.c float matrix; void ctp() { #pragma omp threadprivate(matrix) matrix = 0.0; } (777)% cat csimple.c void ctp(); int main() { ctp(); return 0; } (778)% gcc -fopenmp -c ctp.c (779)% ld -r ctp.o -o ctpr.o (780)% gcc -fopenmp csimple.c ctp.o (781)% gcc -fopenmp csimple.c ctpr.o collect2: ld terminated with signal 11 [Segmentation fault], core dumped ld: (782)% I modified bfd.c so I could get the error message that should have been printed, which was: (792)% gcc -fopenmp csimple.c ctpr.o ld: Warning: alignment 1 of symbol `matrix' in abfd->my_archive->filename(abfd->filename) is smaller than 4 in ctpr.o -- Summary: Segmentation fault in bfd.c during error handling Product: binutils Version: 2.16 Status: NEW Severity: normal Priority: P2 Component: binutils AssignedTo: unassigned at sources dot redhat dot com ReportedBy: langton at gcc dot gnu dot org CC: bug-binutils at gnu dot org GCC build triplet: i686-pc-linux GCC host triplet: i686-pc-linux GCC target triplet: i686-pc-linux http://sourceware.org/bugzilla/show_bug.cgi?id=2735 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils