<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - segfault with __builtin_return_address() on s390x"
   href="https://llvm.org/bugs/show_bug.cgi?id=27060">27060</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>segfault with __builtin_return_address() on s390x
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>3.7
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Other
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>daniel@danielstender.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Hi,

we've discovered that there is a segfault with __builtin_return_address() on
s390x (e.g. IBM z196 enterprise mainframe):

test.c:
#include <stdio.h>
int main() { printf("%p\n", __builtin_return_address(0)); return 0; }

<log>
$ clang-3.7 -o test test.c 
0  libLLVM-3.7.so.1 0x000003fffbca207e
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 38
1  libLLVM-3.7.so.1 0x000003fffbca12be
2  libLLVM-3.7.so.1 0x000003ffff80192c
3  libLLVM-3.7.so.1 0x000003fffc444e3a
llvm::SystemZTargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&)
const + 74
4  libLLVM-3.7.so.1 0x000003fffbabe13e
5  libLLVM-3.7.so.1 0x000003fffbac0cea llvm::SelectionDAG::Legalize() + 418
6  libLLVM-3.7.so.1 0x000003fffbbccf70
llvm::SelectionDAGISel::CodeGenAndEmitDAG() + 616
7  libLLVM-3.7.so.1 0x000003fffbbd126e
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) + 1126
8  libLLVM-3.7.so.1 0x000003fffbbd2cfe
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) + 1078
9  libLLVM-3.7.so.1 0x000003fffb292710
llvm::FPPassManager::runOnFunction(llvm::Function&) + 584
10 libLLVM-3.7.so.1 0x000003fffb292a0e
llvm::FPPassManager::runOnModule(llvm::Module&) + 54
11 libLLVM-3.7.so.1 0x000003fffb2922be
llvm::legacy::PassManagerImpl::run(llvm::Module&) + 990
12 clang            0x00000000804f274c
clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
const&, clang::TargetOptions const&, clang::LangOptions const&,
llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_pwrite_stream*)
+ 2700
13 clang            0x00000000804da5c8
14 clang            0x00000000806fdcac clang::ParseAST(clang::Sema&, bool,
bool) + 868
15 clang            0x00000000802ff7f6 clang::FrontendAction::Execute() + 622
16 clang            0x00000000802d1fd6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 398
17 clang            0x00000000802b58aa
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 2346
18 clang            0x00000000802af932 cc1_main(llvm::ArrayRef<char const*>,
char const*, void*) + 2754
19 clang            0x00000000802abc4c main + 1380
20 libc.so.6        0x000003fffa6504c0 __libc_start_main + 272
21 clang            0x00000000802ae6d6
Stack dump:
0.    Program arguments: /usr/lib/llvm-3.7/bin/clang -cc1 -triple
s390x-ibm-linux-gnu -emit-obj -mrelax-all -disable-free -disable-llvm-verifier
-main-file-name test.c -mrelocation-model static -mthread-model posix
-mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases
-fuse-init-array -target-cpu z10 -target-linker-version 2.26 -dwarf-column-info
-resource-dir /usr/lib/llvm-3.7/bin/../lib/clang/3.7.1 -internal-isystem
/usr/local/include -internal-isystem
/usr/lib/llvm-3.7/bin/../lib/clang/3.7.1/include -internal-externc-isystem
/usr/include/s390x-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdebug-compilation-dir /home/stender
-ferror-limit 19 -fmessage-length 105 -mstackrealign -fno-signed-char
-fobjc-runtime=gcc -fdiagnostics-show-option -fcolor-diagnostics -o
/tmp/test-a4ff09.o -x c test.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'test.c'.
4.    Running pass 'SystemZ DAG->DAG Pattern Instruction Selection' on function
'@main'
clang: error: unable to execute command: Segmentation fault
</log>

The clang is 3.7.1, but the same errors occurs throughout clang-3.6 to
clang-3.8 versions.

Thanks,
DS</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>