[LLVMbugs] [Bug 15560] New: Segmentation fault when compiling function template with deep recursion

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Mar 21 09:17:29 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=15560

            Bug ID: 15560
           Summary: Segmentation fault when compiling function template
                    with deep recursion
           Product: clang
           Version: 3.2
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: Juan.Arrieta at jpl.nasa.gov
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

This program uses a template-based definition of some common polynomials, and
them attempts to evaluate them at large orders. While it may seem artificial to
use a 200th-order polynomial, it is quite common in cases like geopotential
evaluation using spherical harmonics.

There are other means to evaluate the geopotential function, but this program
aims to test whether the compiler optimizations made available by means of
templates can expedite the computations and reduce roundoff errors.

This program uses the ``constexpr`` specifier (which marks a function as a
compile-time target). For this reason, only a compiler with C++11 support will
be able to compile.

The program runs extremely slowly when compiled with g++ with N=100. It runs
great when compiled with clang++ up to N~170. Compilation crashes in clang++ at
N=192. The last successful compilation looks as follows:

       clang++ polynomials.cpp -std=c++11 -O3 -DORDER=191   

Attempting the next compilation:

       clang++ polynomials.cpp -std=c++11 -O3 -DORDER=192

yields the following result:

clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-apple-darwin11.4.2
Thread model: posix
clang: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg:
/var/folders/zz/zyxvpxvq6csfxvn_n0001dkm000bcn/T/polynomials-zXGdTS.cpp
clang: note: diagnostic msg:
/var/folders/zz/zyxvpxvq6csfxvn_n0001dkm000bcn/T/polynomials-zXGdTS.sh
clang: note: diagnostic msg: 

********************


clang++ version information:
clang version 3.2 (tags/RELEASE_32/final)
Target: x86_64-apple-darwin11.4.2
Thread model: posix

g++ version information:
Using built-in specs.
COLLECT_GCC=/usr/local/bin/g++
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-apple-darwin11.4.2/4.7.2/lto-wrapper
Target: x86_64-apple-darwin11.4.2
Configured with: ./configure
Thread model: posix
gcc version 4.7.2 (GCC)


System information:
OS X 10.7.4
Processor: 2.7 GHz Intel Core i7
Memory: 16GB 1600 MHz DDR3

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130321/8df318db/attachment.html>


More information about the llvm-bugs mailing list